diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2018-04-24 04:04:35 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2018-04-26 08:17:55 -0400 |
commit | 40ec260363b2d3ca5b2e8d1a68c22bd609243411 (patch) | |
tree | 2b1ddefb4c4854e558321b9cc10ff6681a696ccf | |
parent | c554bb045511bd6b498b6a61cffa48e473853703 (diff) |
HID: multitouch: make use of HID_QUIRK_INPUT_PER_APP
We now have HID_QUIRK_INPUT_PER_APPLICATION that splits the devices
into several devices. This helps us as we can now rely on hid-input
to set the names for us.
Also, this helps removing some magical numbers '0' when calling
.input_configured().
The only thing to take care of is that the field .report in struct
hid_input is now null. We need to iterate over the full list of
reports attached to a hid_input.
This is required for some Advanced Silicon touchscreen to correctly apply
the HID_QUIRK_INPUT_PER_APPLICATION as they have 2 reports associated
with the hidinput node. One contains the Input data, the other one
contains the Output data.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-multitouch.c | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index dad2fbb0e3f8..43784d31a1a3 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -1274,54 +1274,48 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) | |||
1274 | struct mt_device *td = hid_get_drvdata(hdev); | 1274 | struct mt_device *td = hid_get_drvdata(hdev); |
1275 | char *name; | 1275 | char *name; |
1276 | const char *suffix = NULL; | 1276 | const char *suffix = NULL; |
1277 | struct hid_field *field = hi->report->field[0]; | 1277 | unsigned int application = 0; |
1278 | struct hid_report *report; | ||
1278 | int ret; | 1279 | int ret; |
1279 | 1280 | ||
1280 | if (hi->report->id == td->mt_report_id) { | 1281 | list_for_each_entry(report, &hi->reports, hidinput_list) { |
1281 | ret = mt_touch_input_configured(hdev, hi); | 1282 | application = report->application; |
1282 | if (ret) | 1283 | if (report->id == td->mt_report_id) { |
1283 | return ret; | 1284 | ret = mt_touch_input_configured(hdev, hi); |
1285 | if (ret) | ||
1286 | return ret; | ||
1287 | } | ||
1288 | |||
1289 | /* | ||
1290 | * some egalax touchscreens have "application == DG_TOUCHSCREEN" | ||
1291 | * for the stylus. Check this first, and then rely on | ||
1292 | * the application field. | ||
1293 | */ | ||
1294 | if (report->field[0]->physical == HID_DG_STYLUS) { | ||
1295 | suffix = "Pen"; | ||
1296 | /* force BTN_STYLUS to allow tablet matching in udev */ | ||
1297 | __set_bit(BTN_STYLUS, hi->input->keybit); | ||
1298 | } | ||
1284 | } | 1299 | } |
1285 | 1300 | ||
1286 | /* | 1301 | if (!suffix) { |
1287 | * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" | 1302 | switch (application) { |
1288 | * for the stylus. Check this first, and then rely on the application | ||
1289 | * field. | ||
1290 | */ | ||
1291 | if (hi->report->field[0]->physical == HID_DG_STYLUS) { | ||
1292 | suffix = "Pen"; | ||
1293 | /* force BTN_STYLUS to allow tablet matching in udev */ | ||
1294 | __set_bit(BTN_STYLUS, hi->input->keybit); | ||
1295 | } else { | ||
1296 | switch (field->application) { | ||
1297 | case HID_GD_KEYBOARD: | 1303 | case HID_GD_KEYBOARD: |
1298 | suffix = "Keyboard"; | ||
1299 | break; | ||
1300 | case HID_GD_KEYPAD: | 1304 | case HID_GD_KEYPAD: |
1301 | suffix = "Keypad"; | ||
1302 | break; | ||
1303 | case HID_GD_MOUSE: | 1305 | case HID_GD_MOUSE: |
1304 | suffix = "Mouse"; | ||
1305 | break; | ||
1306 | case HID_DG_STYLUS: | ||
1307 | suffix = "Pen"; | ||
1308 | /* force BTN_STYLUS to allow tablet matching in udev */ | ||
1309 | __set_bit(BTN_STYLUS, hi->input->keybit); | ||
1310 | break; | ||
1311 | case HID_DG_TOUCHSCREEN: | ||
1312 | /* we do not set suffix = "Touchscreen" */ | ||
1313 | break; | ||
1314 | case HID_DG_TOUCHPAD: | 1306 | case HID_DG_TOUCHPAD: |
1315 | suffix = "Touchpad"; | ||
1316 | break; | ||
1317 | case HID_GD_SYSTEM_CONTROL: | 1307 | case HID_GD_SYSTEM_CONTROL: |
1318 | suffix = "System Control"; | ||
1319 | break; | ||
1320 | case HID_CP_CONSUMER_CONTROL: | 1308 | case HID_CP_CONSUMER_CONTROL: |
1321 | suffix = "Consumer Control"; | ||
1322 | break; | ||
1323 | case HID_GD_WIRELESS_RADIO_CTLS: | 1309 | case HID_GD_WIRELESS_RADIO_CTLS: |
1324 | suffix = "Wireless Radio Control"; | 1310 | /* already handled by hid core */ |
1311 | break; | ||
1312 | case HID_DG_TOUCHSCREEN: | ||
1313 | /* we do not set suffix = "Touchscreen" */ | ||
1314 | hi->input->name = hdev->name; | ||
1315 | break; | ||
1316 | case HID_DG_STYLUS: | ||
1317 | /* force BTN_STYLUS to allow tablet matching in udev */ | ||
1318 | __set_bit(BTN_STYLUS, hi->input->keybit); | ||
1325 | break; | 1319 | break; |
1326 | case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: | 1320 | case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: |
1327 | suffix = "Custom Media Keys"; | 1321 | suffix = "Custom Media Keys"; |
@@ -1459,10 +1453,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1459 | 1453 | ||
1460 | /* | 1454 | /* |
1461 | * This allows the driver to handle different input sensors | 1455 | * This allows the driver to handle different input sensors |
1462 | * that emits events through different reports on the same HID | 1456 | * that emits events through different applications on the same HID |
1463 | * device. | 1457 | * device. |
1464 | */ | 1458 | */ |
1465 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; | 1459 | hdev->quirks |= HID_QUIRK_INPUT_PER_APP; |
1466 | 1460 | ||
1467 | timer_setup(&td->release_timer, mt_expired_timeout, 0); | 1461 | timer_setup(&td->release_timer, mt_expired_timeout, 0); |
1468 | 1462 | ||