diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hid/hid-ntrig.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c index 86a969f63292..79ab34949cb1 100644 --- a/drivers/hid/hid-ntrig.c +++ b/drivers/hid/hid-ntrig.c | |||
| @@ -858,12 +858,43 @@ not_claimed_input: | |||
| 858 | return 1; | 858 | return 1; |
| 859 | } | 859 | } |
| 860 | 860 | ||
| 861 | static void ntrig_input_configured(struct hid_device *hid, | ||
| 862 | struct hid_input *hidinput) | ||
| 863 | |||
| 864 | { | ||
| 865 | struct input_dev *input = hidinput->input; | ||
| 866 | |||
| 867 | if (hidinput->report->maxfield < 1) | ||
| 868 | return; | ||
| 869 | |||
| 870 | switch (hidinput->report->field[0]->application) { | ||
| 871 | case HID_DG_PEN: | ||
| 872 | input->name = "N-Trig Pen"; | ||
| 873 | break; | ||
| 874 | case HID_DG_TOUCHSCREEN: | ||
| 875 | /* These keys are redundant for fingers, clear them | ||
| 876 | * to prevent incorrect identification */ | ||
| 877 | __clear_bit(BTN_TOOL_PEN, input->keybit); | ||
| 878 | __clear_bit(BTN_TOOL_FINGER, input->keybit); | ||
| 879 | __clear_bit(BTN_0, input->keybit); | ||
| 880 | __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); | ||
| 881 | /* | ||
| 882 | * The physical touchscreen (single touch) | ||
| 883 | * input has a value for physical, whereas | ||
| 884 | * the multitouch only has logical input | ||
| 885 | * fields. | ||
| 886 | */ | ||
| 887 | input->name = (hidinput->report->field[0]->physical) ? | ||
| 888 | "N-Trig Touchscreen" : | ||
| 889 | "N-Trig MultiTouch"; | ||
| 890 | break; | ||
| 891 | } | ||
| 892 | } | ||
| 893 | |||
| 861 | static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) | 894 | static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) |
| 862 | { | 895 | { |
| 863 | int ret; | 896 | int ret; |
| 864 | struct ntrig_data *nd; | 897 | struct ntrig_data *nd; |
| 865 | struct hid_input *hidinput; | ||
| 866 | struct input_dev *input; | ||
| 867 | struct hid_report *report; | 898 | struct hid_report *report; |
| 868 | 899 | ||
| 869 | if (id->driver_data) | 900 | if (id->driver_data) |
| @@ -901,38 +932,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 901 | goto err_free; | 932 | goto err_free; |
| 902 | } | 933 | } |
| 903 | 934 | ||
| 904 | |||
| 905 | list_for_each_entry(hidinput, &hdev->inputs, list) { | ||
| 906 | if (hidinput->report->maxfield < 1) | ||
| 907 | continue; | ||
| 908 | |||
| 909 | input = hidinput->input; | ||
| 910 | switch (hidinput->report->field[0]->application) { | ||
| 911 | case HID_DG_PEN: | ||
| 912 | input->name = "N-Trig Pen"; | ||
| 913 | break; | ||
| 914 | case HID_DG_TOUCHSCREEN: | ||
| 915 | /* These keys are redundant for fingers, clear them | ||
| 916 | * to prevent incorrect identification */ | ||
| 917 | __clear_bit(BTN_TOOL_PEN, input->keybit); | ||
| 918 | __clear_bit(BTN_TOOL_FINGER, input->keybit); | ||
| 919 | __clear_bit(BTN_0, input->keybit); | ||
| 920 | __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); | ||
| 921 | /* | ||
| 922 | * The physical touchscreen (single touch) | ||
| 923 | * input has a value for physical, whereas | ||
| 924 | * the multitouch only has logical input | ||
| 925 | * fields. | ||
| 926 | */ | ||
| 927 | input->name = | ||
| 928 | (hidinput->report->field[0] | ||
| 929 | ->physical) ? | ||
| 930 | "N-Trig Touchscreen" : | ||
| 931 | "N-Trig MultiTouch"; | ||
| 932 | break; | ||
| 933 | } | ||
| 934 | } | ||
| 935 | |||
| 936 | /* This is needed for devices with more recent firmware versions */ | 935 | /* This is needed for devices with more recent firmware versions */ |
| 937 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a]; | 936 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a]; |
| 938 | if (report) { | 937 | if (report) { |
| @@ -1023,6 +1022,7 @@ static struct hid_driver ntrig_driver = { | |||
| 1023 | .remove = ntrig_remove, | 1022 | .remove = ntrig_remove, |
| 1024 | .input_mapping = ntrig_input_mapping, | 1023 | .input_mapping = ntrig_input_mapping, |
| 1025 | .input_mapped = ntrig_input_mapped, | 1024 | .input_mapped = ntrig_input_mapped, |
| 1025 | .input_configured = ntrig_input_configured, | ||
| 1026 | .usage_table = ntrig_grabbed_usages, | 1026 | .usage_table = ntrig_grabbed_usages, |
| 1027 | .event = ntrig_event, | 1027 | .event = ntrig_event, |
| 1028 | }; | 1028 | }; |
