aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-core.c4
-rw-r--r--include/linux/hid.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f5004e2ca0c5..b5974cd45968 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -92,6 +92,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
92static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) 92static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
93{ 93{
94 struct hid_field *field; 94 struct hid_field *field;
95 int i;
95 96
96 if (report->maxfield == HID_MAX_FIELDS) { 97 if (report->maxfield == HID_MAX_FIELDS) {
97 hid_err(report->device, "too many fields in report\n"); 98 hid_err(report->device, "too many fields in report\n");
@@ -110,6 +111,9 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
110 field->value = (s32 *)(field->usage + usages); 111 field->value = (s32 *)(field->usage + usages);
111 field->report = report; 112 field->report = report;
112 113
114 for (i = 0; i < usages; i++)
115 field->usage[i].usage_index = i;
116
113 return field; 117 return field;
114} 118}
115 119
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 4161bf2c0b5b..d2c42dd222c1 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -342,6 +342,7 @@ struct hid_collection {
342struct hid_usage { 342struct hid_usage {
343 unsigned hid; /* hid usage code */ 343 unsigned hid; /* hid usage code */
344 unsigned collection_index; /* index into collection array */ 344 unsigned collection_index; /* index into collection array */
345 unsigned usage_index; /* index into usage array */
345 /* hidinput data */ 346 /* hidinput data */
346 __u16 code; /* input driver code */ 347 __u16 code; /* input driver code */
347 __u8 type; /* input driver type */ 348 __u8 type; /* input driver type */