All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>, linux-kernel@vger.kernel.org
Subject: Re: Fwd: Patch for initial CapsLock
Date: Wed, 8 Jan 2003 09:45:21 +0100	[thread overview]
Message-ID: <20030108094521.A23278@ucw.cz> (raw)
In-Reply-To: <20030107170746.A2689@devserv.devel.redhat.com>; from zaitcev@redhat.com on Tue, Jan 07, 2003 at 05:07:46PM -0500

On Tue, Jan 07, 2003 at 05:07:46PM -0500, Pete Zaitcev wrote:
> > > Do you want me to do the same for 2.5? It should be a little
> > > simpler there, and no new exports.
> > 
> > Yes, please.
> 
> Done, works for me.
> 
> I toyed with the idea to trigger keyboard tasklet instead of
> locking it out and calling methods, but I did not see how
> to force updates for unchanged ledstate. Changing ledstate to 0xff
> just looked so very wrong...

Thanks, this looks very good.

> 
> -- Pete
> 
> --- linux-2.5.54/drivers/char/keyboard.c	2002-12-15 18:07:54.000000000 -0800
> +++ linux-2.5.54-p3/drivers/char/keyboard.c	2003-01-07 13:55:25.000000000 -0800
> @@ -894,9 +894,9 @@
>   * Aside from timing (which isn't really that important for
>   * keyboard interrupts as they happen often), using the software
>   * interrupt routines for this thing allows us to easily mask
> - * this when we don't want any of the above to happen. Not yet
> - * used, but this allows for easy and efficient race-condition
> - * prevention later on.
> + * this when we don't want any of the above to happen.
> + * This allows for easy and efficient race-condition prevention
> + * for kbd_refresh_leds => input_event(dev, EV_LED, ...) => ...
>   */
>  
>  static void kbd_bh(unsigned long dummy)
> @@ -918,6 +918,22 @@
>  
>  DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
>  
> +/*
> + * This allows a newly plugged keyboard to pick the LED state.
> + */
> +void kbd_refresh_leds(struct input_handle *handle)
> +{
> +	unsigned char leds = ledstate;
> +
> +	tasklet_disable(&keyboard_tasklet);
> +	if (leds != 0xff) {
> +		input_event(handle->dev, EV_LED, LED_SCROLLL, !!(leds & 0x01));
> +		input_event(handle->dev, EV_LED, LED_NUML,    !!(leds & 0x02));
> +		input_event(handle->dev, EV_LED, LED_CAPSL,   !!(leds & 0x04));
> +	}
> +	tasklet_enable(&keyboard_tasklet);
> +}
> +
>  #if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64)
>  
>  static unsigned short x86_keycodes[256] =
> @@ -1159,6 +1175,7 @@
>  	handle->name = kbd_name;
>  
>  	input_open_device(handle);
> +	kbd_refresh_leds(handle);
>  
>  	return handle;
>  }

-- 
Vojtech Pavlik
SuSE Labs

      reply	other threads:[~2003-01-08  8:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-06 18:37 Fwd: Patch for initial CapsLock Pete Zaitcev
2003-01-06 21:52 ` Vojtech Pavlik
2003-01-06 22:17   ` Pete Zaitcev
2003-01-07  8:54     ` Vojtech Pavlik
2003-01-07 22:07       ` Pete Zaitcev
2003-01-08  8:45         ` Vojtech Pavlik [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030108094521.A23278@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.