|
@@ -1319,6 +1319,13 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
return mt_touch_input_mapping(hdev, hi, field, usage, bit, max,
|
|
return mt_touch_input_mapping(hdev, hi, field, usage, bit, max,
|
|
application);
|
|
application);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * some egalax touchscreens have "application == DG_TOUCHSCREEN"
|
|
|
|
+ * for the stylus. Overwrite the hid_input application
|
|
|
|
+ */
|
|
|
|
+ if (field->physical == HID_DG_STYLUS)
|
|
|
|
+ hi->application = HID_DG_STYLUS;
|
|
|
|
+
|
|
/* let hid-core decide for the others */
|
|
/* let hid-core decide for the others */
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -1507,14 +1514,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
|
|
struct mt_device *td = hid_get_drvdata(hdev);
|
|
struct mt_device *td = hid_get_drvdata(hdev);
|
|
char *name;
|
|
char *name;
|
|
const char *suffix = NULL;
|
|
const char *suffix = NULL;
|
|
- unsigned int application = 0;
|
|
|
|
struct mt_report_data *rdata;
|
|
struct mt_report_data *rdata;
|
|
struct mt_application *mt_application = NULL;
|
|
struct mt_application *mt_application = NULL;
|
|
struct hid_report *report;
|
|
struct hid_report *report;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
list_for_each_entry(report, &hi->reports, hidinput_list) {
|
|
list_for_each_entry(report, &hi->reports, hidinput_list) {
|
|
- application = report->application;
|
|
|
|
rdata = mt_find_report_data(td, report);
|
|
rdata = mt_find_report_data(td, report);
|
|
if (!rdata) {
|
|
if (!rdata) {
|
|
hid_err(hdev, "failed to allocate data for report\n");
|
|
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)
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
-
|
|
|
|
- /*
|
|
|
|
- * some egalax touchscreens have "application == DG_TOUCHSCREEN"
|
|
|
|
- * for the stylus. Check this first, and then rely on
|
|
|
|
- * the application field.
|
|
|
|
- */
|
|
|
|
- if (report->field[0]->physical == HID_DG_STYLUS) {
|
|
|
|
- suffix = "Pen";
|
|
|
|
- /* force BTN_STYLUS to allow tablet matching in udev */
|
|
|
|
- __set_bit(BTN_STYLUS, hi->input->keybit);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if (!suffix) {
|
|
|
|
- switch (application) {
|
|
|
|
- case HID_GD_KEYBOARD:
|
|
|
|
- case HID_GD_KEYPAD:
|
|
|
|
- case HID_GD_MOUSE:
|
|
|
|
- case HID_DG_TOUCHPAD:
|
|
|
|
- case HID_GD_SYSTEM_CONTROL:
|
|
|
|
- case HID_CP_CONSUMER_CONTROL:
|
|
|
|
- case HID_GD_WIRELESS_RADIO_CTLS:
|
|
|
|
- case HID_GD_SYSTEM_MULTIAXIS:
|
|
|
|
- /* already handled by hid core */
|
|
|
|
- break;
|
|
|
|
- case HID_DG_TOUCHSCREEN:
|
|
|
|
- /* we do not set suffix = "Touchscreen" */
|
|
|
|
- hi->input->name = hdev->name;
|
|
|
|
- break;
|
|
|
|
- case HID_DG_STYLUS:
|
|
|
|
- /* force BTN_STYLUS to allow tablet matching in udev */
|
|
|
|
- __set_bit(BTN_STYLUS, hi->input->keybit);
|
|
|
|
- break;
|
|
|
|
- case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
|
|
|
|
- suffix = "Custom Media Keys";
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- suffix = "UNKNOWN";
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ switch (hi->application) {
|
|
|
|
+ case HID_GD_KEYBOARD:
|
|
|
|
+ case HID_GD_KEYPAD:
|
|
|
|
+ case HID_GD_MOUSE:
|
|
|
|
+ case HID_DG_TOUCHPAD:
|
|
|
|
+ case HID_GD_SYSTEM_CONTROL:
|
|
|
|
+ case HID_CP_CONSUMER_CONTROL:
|
|
|
|
+ case HID_GD_WIRELESS_RADIO_CTLS:
|
|
|
|
+ case HID_GD_SYSTEM_MULTIAXIS:
|
|
|
|
+ /* already handled by hid core */
|
|
|
|
+ break;
|
|
|
|
+ case HID_DG_TOUCHSCREEN:
|
|
|
|
+ /* we do not set suffix = "Touchscreen" */
|
|
|
|
+ hi->input->name = hdev->name;
|
|
|
|
+ break;
|
|
|
|
+ case HID_DG_STYLUS:
|
|
|
|
+ /* force BTN_STYLUS to allow tablet matching in udev */
|
|
|
|
+ __set_bit(BTN_STYLUS, hi->input->keybit);
|
|
|
|
+ break;
|
|
|
|
+ case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
|
|
|
|
+ suffix = "Custom Media Keys";
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ suffix = "UNKNOWN";
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
|
|
if (suffix) {
|
|
if (suffix) {
|