aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-multitouch.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 61cc4cbe0f3e..9a3891e00cdd 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -83,6 +83,7 @@ struct mt_device {
83 unsigned last_field_index; /* last field index of the report */ 83 unsigned last_field_index; /* last field index of the report */
84 unsigned last_slot_field; /* the last field of a slot */ 84 unsigned last_slot_field; /* the last field of a slot */
85 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ 85 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
86 __s8 inputmode_index; /* InputMode HID feature index in the report */
86 __s8 maxcontact_report_id; /* Maximum Contact Number HID feature, 87 __s8 maxcontact_report_id; /* Maximum Contact Number HID feature,
87 -1 if non-existent */ 88 -1 if non-existent */
88 __u8 num_received; /* how many contacts we received */ 89 __u8 num_received; /* how many contacts we received */
@@ -260,10 +261,20 @@ static void mt_feature_mapping(struct hid_device *hdev,
260 struct hid_field *field, struct hid_usage *usage) 261 struct hid_field *field, struct hid_usage *usage)
261{ 262{
262 struct mt_device *td = hid_get_drvdata(hdev); 263 struct mt_device *td = hid_get_drvdata(hdev);
264 int i;
263 265
264 switch (usage->hid) { 266 switch (usage->hid) {
265 case HID_DG_INPUTMODE: 267 case HID_DG_INPUTMODE:
266 td->inputmode = field->report->id; 268 td->inputmode = field->report->id;
269 td->inputmode_index = 0; /* has to be updated below */
270
271 for (i=0; i < field->maxusage; i++) {
272 if (field->usage[i].hid == usage->hid) {
273 td->inputmode_index = i;
274 break;
275 }
276 }
277
267 break; 278 break;
268 case HID_DG_CONTACTMAX: 279 case HID_DG_CONTACTMAX:
269 td->maxcontact_report_id = field->report->id; 280 td->maxcontact_report_id = field->report->id;
@@ -618,7 +629,7 @@ static void mt_set_input_mode(struct hid_device *hdev)
618 re = &(hdev->report_enum[HID_FEATURE_REPORT]); 629 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
619 r = re->report_id_hash[td->inputmode]; 630 r = re->report_id_hash[td->inputmode];
620 if (r) { 631 if (r) {
621 r->field[0]->value[0] = 0x02; 632 r->field[0]->value[td->inputmode_index] = 0x02;
622 usbhid_submit_report(hdev, r, USB_DIR_OUT); 633 usbhid_submit_report(hdev, r, USB_DIR_OUT);
623 } 634 }
624} 635}