aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c4
-rw-r--r--drivers/hid/hid-input.c19
2 files changed, 20 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1e1a7770a6b9..38db8321b211 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -880,6 +880,10 @@ static void hid_output_field(struct hid_field *field, __u8 *data)
880 unsigned size = field->report_size; 880 unsigned size = field->report_size;
881 unsigned n; 881 unsigned n;
882 882
883 /* make sure the unused bits in the last byte are zeros */
884 if (count > 0 && size > 0)
885 data[(count*size-1)/8] = 0;
886
883 for (n = 0; n < count; n++) { 887 for (n = 0; n < count; n++) {
884 if (field->logical_minimum < 0) /* signed values */ 888 if (field->logical_minimum < 0) /* signed values */
885 implement(data, offset + n * size, size, s32ton(field->value[n], size)); 889 implement(data, offset + n * size, size, s32ton(field->value[n], size));
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
364 break; 364 break;
365 365
366 case HID_UP_LED: 366 case HID_UP_LED:
367 if (((usage->hid - 1) & 0xffff) >= LED_MAX) 367
368 goto ignore; 368 switch (usage->hid & 0xffff) { /* HID-Value: */
369 map_led((usage->hid - 1) & 0xffff); 369 case 0x01: map_led (LED_NUML); break; /* "Num Lock" */
370 case 0x02: map_led (LED_CAPSL); break; /* "Caps Lock" */
371 case 0x03: map_led (LED_SCROLLL); break; /* "Scroll Lock" */
372 case 0x04: map_led (LED_COMPOSE); break; /* "Compose" */
373 case 0x05: map_led (LED_KANA); break; /* "Kana" */
374 case 0x27: map_led (LED_SLEEP); break; /* "Stand-By" */
375 case 0x4c: map_led (LED_SUSPEND); break; /* "System Suspend" */
376 case 0x09: map_led (LED_MUTE); break; /* "Mute" */
377 case 0x4b: map_led (LED_MISC); break; /* "Generic Indicator" */
378 case 0x19: map_led (LED_MAIL); break; /* "Message Waiting" */
379 case 0x4d: map_led (LED_CHARGING); break; /* "External Power Connected" */
380
381 default: goto ignore;
382 }
370 break; 383 break;
371 384
372 case HID_UP_DIGITIZER: 385 case HID_UP_DIGITIZER: