aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-multitouch.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 3b4739bde05d..504a95e0388f 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -74,6 +74,7 @@ MODULE_LICENSE("GPL");
74#define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15) 74#define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15)
75#define MT_QUIRK_STICKY_FINGERS BIT(16) 75#define MT_QUIRK_STICKY_FINGERS BIT(16)
76#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17) 76#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17)
77#define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18)
77 78
78#define MT_INPUTMODE_TOUCHSCREEN 0x02 79#define MT_INPUTMODE_TOUCHSCREEN 0x02
79#define MT_INPUTMODE_TOUCHPAD 0x03 80#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -241,7 +242,8 @@ static struct mt_class mt_classes[] = {
241 MT_QUIRK_IGNORE_DUPLICATES | 242 MT_QUIRK_IGNORE_DUPLICATES |
242 MT_QUIRK_HOVERING | 243 MT_QUIRK_HOVERING |
243 MT_QUIRK_CONTACT_CNT_ACCURATE | 244 MT_QUIRK_CONTACT_CNT_ACCURATE |
244 MT_QUIRK_STICKY_FINGERS }, 245 MT_QUIRK_STICKY_FINGERS |
246 MT_QUIRK_WIN8_PTP_BUTTONS },
245 { .name = MT_CLS_EXPORT_ALL_INPUTS, 247 { .name = MT_CLS_EXPORT_ALL_INPUTS,
246 .quirks = MT_QUIRK_ALWAYS_VALID | 248 .quirks = MT_QUIRK_ALWAYS_VALID |
247 MT_QUIRK_CONTACT_CNT_ACCURATE, 249 MT_QUIRK_CONTACT_CNT_ACCURATE,
@@ -250,7 +252,8 @@ static struct mt_class mt_classes[] = {
250 .quirks = MT_QUIRK_ALWAYS_VALID | 252 .quirks = MT_QUIRK_ALWAYS_VALID |
251 MT_QUIRK_IGNORE_DUPLICATES | 253 MT_QUIRK_IGNORE_DUPLICATES |
252 MT_QUIRK_HOVERING | 254 MT_QUIRK_HOVERING |
253 MT_QUIRK_CONTACT_CNT_ACCURATE, 255 MT_QUIRK_CONTACT_CNT_ACCURATE |
256 MT_QUIRK_WIN8_PTP_BUTTONS,
254 .export_all_inputs = true }, 257 .export_all_inputs = true },
255 258
256 /* 259 /*
@@ -659,8 +662,7 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
659 * MS PTP spec says that external buttons left and right have 662 * MS PTP spec says that external buttons left and right have
660 * usages 2 and 3. 663 * usages 2 and 3.
661 */ 664 */
662 if ((cls->name == MT_CLS_WIN_8 || 665 if ((cls->quirks & MT_QUIRK_WIN8_PTP_BUTTONS) &&
663 cls->name == MT_CLS_WIN_8_DUAL) &&
664 field->application == HID_DG_TOUCHPAD && 666 field->application == HID_DG_TOUCHPAD &&
665 (usage->hid & HID_USAGE) > 1) 667 (usage->hid & HID_USAGE) > 1)
666 code--; 668 code--;
@@ -772,9 +774,7 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
772 */ 774 */
773static void mt_sync_frame(struct mt_device *td, struct input_dev *input) 775static void mt_sync_frame(struct mt_device *td, struct input_dev *input)
774{ 776{
775 __s32 cls = td->mtclass.name; 777 if (td->mtclass.quirks & MT_QUIRK_WIN8_PTP_BUTTONS)
776
777 if (cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL)
778 input_event(input, EV_KEY, BTN_LEFT, td->left_button_state); 778 input_event(input, EV_KEY, BTN_LEFT, td->left_button_state);
779 779
780 input_mt_sync_frame(input); 780 input_mt_sync_frame(input);
@@ -826,7 +826,6 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
826 bool first_packet) 826 bool first_packet)
827{ 827{
828 struct mt_device *td = hid_get_drvdata(hid); 828 struct mt_device *td = hid_get_drvdata(hid);
829 __s32 cls = td->mtclass.name;
830 __s32 quirks = td->mtclass.quirks; 829 __s32 quirks = td->mtclass.quirks;
831 struct input_dev *input = field->hidinput->input; 830 struct input_dev *input = field->hidinput->input;
832 831
@@ -904,7 +903,7 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
904 * non finger/touch events in the first_packet of 903 * non finger/touch events in the first_packet of
905 * a (possible) multi-packet frame. 904 * a (possible) multi-packet frame.
906 */ 905 */
907 if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && 906 if ((quirks & MT_QUIRK_WIN8_PTP_BUTTONS) &&
908 !first_packet) 907 !first_packet)
909 return; 908 return;
910 909
@@ -915,7 +914,7 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
915 * BTN_LEFT if either is pressed, so we or all values 914 * BTN_LEFT if either is pressed, so we or all values
916 * together and report the result in mt_sync_frame(). 915 * together and report the result in mt_sync_frame().
917 */ 916 */
918 if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && 917 if ((quirks & MT_QUIRK_WIN8_PTP_BUTTONS) &&
919 usage->type == EV_KEY && usage->code == BTN_LEFT) { 918 usage->type == EV_KEY && usage->code == BTN_LEFT) {
920 td->left_button_state |= value; 919 td->left_button_state |= value;
921 return; 920 return;
@@ -939,7 +938,6 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
939static void mt_touch_report(struct hid_device *hid, struct hid_report *report) 938static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
940{ 939{
941 struct mt_device *td = hid_get_drvdata(hid); 940 struct mt_device *td = hid_get_drvdata(hid);
942 __s32 cls = td->mtclass.name;
943 struct hid_field *field; 941 struct hid_field *field;
944 bool first_packet; 942 bool first_packet;
945 unsigned count; 943 unsigned count;
@@ -968,7 +966,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
968 * of a possible multi-packet frame be checking that the 966 * of a possible multi-packet frame be checking that the
969 * timestamp has changed. 967 * timestamp has changed.
970 */ 968 */
971 if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && 969 if ((td->mtclass.quirks & MT_QUIRK_WIN8_PTP_BUTTONS) &&
972 td->num_received == 0 && td->prev_scantime != scantime) 970 td->num_received == 0 && td->prev_scantime != scantime)
973 td->num_expected = value; 971 td->num_expected = value;
974 /* A non 0 contact count always indicates a first packet */ 972 /* A non 0 contact count always indicates a first packet */