@@ -1319,6 +1319,13 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
1319
1319
return mt_touch_input_mapping (hdev , hi , field , usage , bit , max ,
1320
1320
application );
1321
1321
1322
+ /*
1323
+ * some egalax touchscreens have "application == DG_TOUCHSCREEN"
1324
+ * for the stylus. Overwrite the hid_input application
1325
+ */
1326
+ if (field -> physical == HID_DG_STYLUS )
1327
+ hi -> application = HID_DG_STYLUS ;
1328
+
1322
1329
/* let hid-core decide for the others */
1323
1330
return 0 ;
1324
1331
}
@@ -1507,14 +1514,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
1507
1514
struct mt_device * td = hid_get_drvdata (hdev );
1508
1515
char * name ;
1509
1516
const char * suffix = NULL ;
1510
- unsigned int application = 0 ;
1511
1517
struct mt_report_data * rdata ;
1512
1518
struct mt_application * mt_application = NULL ;
1513
1519
struct hid_report * report ;
1514
1520
int ret ;
1515
1521
1516
1522
list_for_each_entry (report , & hi -> reports , hidinput_list ) {
1517
- application = report -> application ;
1518
1523
rdata = mt_find_report_data (td , report );
1519
1524
if (!rdata ) {
1520
1525
hid_err (hdev , "failed to allocate data for report\n" );
@@ -1529,46 +1534,33 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
1529
1534
if (ret )
1530
1535
return ret ;
1531
1536
}
1532
-
1533
- /*
1534
- * some egalax touchscreens have "application == DG_TOUCHSCREEN"
1535
- * for the stylus. Check this first, and then rely on
1536
- * the application field.
1537
- */
1538
- if (report -> field [0 ]-> physical == HID_DG_STYLUS ) {
1539
- suffix = "Pen" ;
1540
- /* force BTN_STYLUS to allow tablet matching in udev */
1541
- __set_bit (BTN_STYLUS , hi -> input -> keybit );
1542
- }
1543
1537
}
1544
1538
1545
- if (!suffix ) {
1546
- switch (application ) {
1547
- case HID_GD_KEYBOARD :
1548
- case HID_GD_KEYPAD :
1549
- case HID_GD_MOUSE :
1550
- case HID_DG_TOUCHPAD :
1551
- case HID_GD_SYSTEM_CONTROL :
1552
- case HID_CP_CONSUMER_CONTROL :
1553
- case HID_GD_WIRELESS_RADIO_CTLS :
1554
- case HID_GD_SYSTEM_MULTIAXIS :
1555
- /* already handled by hid core */
1556
- break ;
1557
- case HID_DG_TOUCHSCREEN :
1558
- /* we do not set suffix = "Touchscreen" */
1559
- hi -> input -> name = hdev -> name ;
1560
- break ;
1561
- case HID_DG_STYLUS :
1562
- /* force BTN_STYLUS to allow tablet matching in udev */
1563
- __set_bit (BTN_STYLUS , hi -> input -> keybit );
1564
- break ;
1565
- case HID_VD_ASUS_CUSTOM_MEDIA_KEYS :
1566
- suffix = "Custom Media Keys" ;
1567
- break ;
1568
- default :
1569
- suffix = "UNKNOWN" ;
1570
- break ;
1571
- }
1539
+ switch (hi -> application ) {
1540
+ case HID_GD_KEYBOARD :
1541
+ case HID_GD_KEYPAD :
1542
+ case HID_GD_MOUSE :
1543
+ case HID_DG_TOUCHPAD :
1544
+ case HID_GD_SYSTEM_CONTROL :
1545
+ case HID_CP_CONSUMER_CONTROL :
1546
+ case HID_GD_WIRELESS_RADIO_CTLS :
1547
+ case HID_GD_SYSTEM_MULTIAXIS :
1548
+ /* already handled by hid core */
1549
+ break ;
1550
+ case HID_DG_TOUCHSCREEN :
1551
+ /* we do not set suffix = "Touchscreen" */
1552
+ hi -> input -> name = hdev -> name ;
1553
+ break ;
1554
+ case HID_DG_STYLUS :
1555
+ /* force BTN_STYLUS to allow tablet matching in udev */
1556
+ __set_bit (BTN_STYLUS , hi -> input -> keybit );
1557
+ break ;
1558
+ case HID_VD_ASUS_CUSTOM_MEDIA_KEYS :
1559
+ suffix = "Custom Media Keys" ;
1560
+ break ;
1561
+ default :
1562
+ suffix = "UNKNOWN" ;
1563
+ break ;
1572
1564
}
1573
1565
1574
1566
if (suffix ) {
0 commit comments