summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorSimon Budig <simon@budig.de>2007-01-15 17:28:47 +0100
committerJiri Kosina <jkosina@suse.cz>2007-01-21 22:17:53 +0100
commitd4ae650a904612ffb7edd3f28b69b022988d2466 (patch)
tree77e2eb83d78f5102182858bf6016481cc1d799dc /drivers/hid/hid-input.c
parent641266fdaa3c137c632f8ad2e4124248bafe7a98 (diff)
downloadlwn-d4ae650a904612ffb7edd3f28b69b022988d2466.tar.gz
lwn-d4ae650a904612ffb7edd3f28b69b022988d2466.zip
HID: proper LED-mapping for SpaceNavigator
This change introduces a mapping for LED indicators between the HID specification and the Linux input subsystem. The previous code properly mapped the LEDs relevant for Keyboards, but garbeled the remaining ones. With this change all LED enums from the input system get mapped to more or less equivalent LED numbers from the HID specification. This patch also ensures that the unused bits in a HID report to the device are zeroed out. This makes the 3Dconnexion SpaceNavigator fully usable with the linux input system. Signed-off-by: Simon Budig <simon@budig.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 28689e3eb552..95b9573c5f93 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -364,9 +364,22 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
break;
case HID_UP_LED:
- if (((usage->hid - 1) & 0xffff) >= LED_MAX)
- goto ignore;
- map_led((usage->hid - 1) & 0xffff);
+
+ switch (usage->hid & 0xffff) { /* HID-Value: */
+ case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
+ case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
+ case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */
+ case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */
+ case 0x05: map_led (LED_KANA); break; /* "Kana" */
+ case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */
+ case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */
+ case 0x09: map_led (LED_MUTE); break; /* "Mute" */
+ case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */
+ case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */
+ case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */
+
+ default: goto ignore;
+ }
break;
case HID_UP_DIGITIZER: