Skip to contentSkip to conversation

Extra keycodes

DISCUSSION Matthew Garrett 3 participants 5 messages Feb 23, 2006 – Mar 8, 2006 Input drivers

lore
Share & tools
lore
#0 lore raw

Hi,

Several laptops have keys that are intended to show battery status. In order to present a consistent view to userspace, it would be nice to have a standard keycode to map them to. linux/input.h doesn't currently provide anything appropriate. What's the correct way of allocating another keycode?

Signature · 1 line
Matthew Garrett | [email protected]
#1 lore raw
Quoted 8 lines · Matthew Garrett

Hi,

Several laptops have keys that are intended to show battery status. In order to present a consistent view to userspace, it would be nice to have a standard keycode to map them to. linux/input.h doesn't currently provide anything appropriate. What's the correct way of allocating another keycode?

Just post a patch adding it to input.h and we'll discuss... Who is intended user? What interface is expected to be used (evdev)?

Signature · 1 line
Dmitry
#2 lore raw
Quoted 2 lines · Dmitry Torokhov

Just post a patch adding it to input.h and we'll discuss... Who is intended user? What interface is expected to be used (evdev)?

Patch included. We have code to pop up battery information in gnome-power-manager in response to this key being pressed, and evdev is the current interface for getting the keypress event.

include/linux/input.h +2 -0
index 3c58233..1714630 100644
@@ -344,6 +344,8 @@ struct input_absinfo {
 #define KEY_SAVE		234
 #define KEY_DOCUMENTS		235
 
+#define KEY_BATTERY             236
+
 #define KEY_UNKNOWN		240
 
 #define BTN_MISC		0x100
Signature · 1 line
Matthew Garrett | [email protected]
#3 lore raw
Quoted 3 lines · Matthew Garrett

Patch included. We have code to pop up battery information in gnome-power-manager in response to this key being pressed, and evdev is the current interface for getting the keypress event.

Hi - any feedback on this?

Thanks,

Signature · 1 line
Matthew Garrett | [email protected]
maintainer
#4 lore raw
Quoted 8 lines · Matthew Garrett
Quoted 3 lines · Matthew Garrett

Patch included. We have code to pop up battery information in gnome-power-manager in response to this key being pressed, and evdev is the current interface for getting the keypress event.

Hi - any feedback on this?

Oh, I am sorry. I will add it to my tree.

--
Dmitry