LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] export getledstate()
@ 2008-02-19 18:57 Karl Dahlke
  2008-02-19 19:45 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Dahlke @ 2008-02-19 18:57 UTC (permalink / raw)
  To: linux-kernel

I write adapters for disabled people, and we often have to do
specialized functions based on keystrokes and key chords.
I would like to do certain things when keys are hit and num lock is on,
but there is no easy way to get the led state.
There is a nice function getledstate()
in keyboard.c, it just isn't exported.
Here is the patch that would do that.
Can you apply this patch, or, is there another easy way to get this information,
or, would it be better to fold this information into keyboard_notifier_param,
along with shift state etc.
I use notifiers, so this would be natural, and almost as easy.
I'd be happy to write that patch, if you think that would be a superior design.

--- drivers/char/keyboard.c	2008-02-18 21:05:23.000000000 -0500
+++ drivers/char/keyboard.c.new	2008-02-18 21:06:34.000000000 -0500
@@ -963,6 +963,7 @@ unsigned char getledstate(void)
 {
 	return ledstate;
 }
+EXPORT_SYMBOL_GPL(getledstate);
 
 void setledstate(struct kbd_struct *kbd, unsigned int led)
 {

Thanks.

Karl Dahlke

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] export getledstate()
  2008-02-19 18:57 [PATCH] export getledstate() Karl Dahlke
@ 2008-02-19 19:45 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2008-02-19 19:45 UTC (permalink / raw)
  To: Karl Dahlke; +Cc: linux-kernel, dmitry.torokhov

On Tue, 19 Feb 2008 13:57:23 -0500 Karl Dahlke wrote:

> I write adapters for disabled people, and we often have to do
> specialized functions based on keystrokes and key chords.
> I would like to do certain things when keys are hit and num lock is on,
> but there is no easy way to get the led state.
> There is a nice function getledstate()
> in keyboard.c, it just isn't exported.
> Here is the patch that would do that.
> Can you apply this patch, or, is there another easy way to get this information,
> or, would it be better to fold this information into keyboard_notifier_param,
> along with shift state etc.
> I use notifiers, so this would be natural, and almost as easy.
> I'd be happy to write that patch, if you think that would be a superior design.

cc Dmitry added.

I don't oppose the export, but it seems that using getledstate()
asynchronously could return out-of-sync info, while adding this info
to the notifier data would synchronize the info..
Maybe it depends on how it's done.

> 
> --- drivers/char/keyboard.c	2008-02-18 21:05:23.000000000 -0500
> +++ drivers/char/keyboard.c.new	2008-02-18 21:06:34.000000000 -0500

--- linux/drivers/char/keyboard.c.old
+++ linux/drivers/char/keyboard.c

is the preferred form.  (a) keep the top-level linux dir name.
(b) the +++ line has the correct file name.

> @@ -963,6 +963,7 @@ unsigned char getledstate(void)
>  {
>  	return ledstate;
>  }
> +EXPORT_SYMBOL_GPL(getledstate);
>  
>  void setledstate(struct kbd_struct *kbd, unsigned int led)
>  {


---
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-19 19:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-19 18:57 [PATCH] export getledstate() Karl Dahlke
2008-02-19 19:45 ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).