diff options
author | Aaron Armstrong Skomra <skomra@gmail.com> | 2017-01-25 15:08:40 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-01-26 15:46:44 -0500 |
commit | ac2423c975dbd3e8c2afc6dec53ee25be38f723b (patch) | |
tree | 572452586dab9e57cda4d995dd1f665f7b46e813 | |
parent | 60a221869803a0864c4b1683395ef574ee15aba6 (diff) |
HID: wacom: generic: add vendor defined touch
Add vendor defined touch to support the second generation Intuos Pro.
Previously all generic Wacom devices used true HID to report their touch.
Signed-off-by: Aaron Skomra <aaron.skomra@wacom.com>
Reviewed-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/wacom.h | 1 | ||||
-rw-r--r-- | drivers/hid/wacom_sys.c | 13 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.c | 22 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.h | 16 |
4 files changed, 43 insertions, 9 deletions
diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h index 8d8fe309c872..0e7b840bb80b 100644 --- a/drivers/hid/wacom.h +++ b/drivers/hid/wacom.h | |||
@@ -219,4 +219,5 @@ enum led_brightness wacom_leds_brightness_get(struct wacom_led *led); | |||
219 | struct wacom_led *wacom_led_find(struct wacom *wacom, unsigned int group, | 219 | struct wacom_led *wacom_led_find(struct wacom *wacom, unsigned int group, |
220 | unsigned int id); | 220 | unsigned int id); |
221 | struct wacom_led *wacom_led_next(struct wacom *wacom, struct wacom_led *cur); | 221 | struct wacom_led *wacom_led_next(struct wacom *wacom, struct wacom_led *cur); |
222 | int wacom_equivalent_usage(int usage); | ||
222 | #endif | 223 | #endif |
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 4a70783e64e1..a4884e78b3f8 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -112,11 +112,12 @@ static void wacom_feature_mapping(struct hid_device *hdev, | |||
112 | struct wacom *wacom = hid_get_drvdata(hdev); | 112 | struct wacom *wacom = hid_get_drvdata(hdev); |
113 | struct wacom_features *features = &wacom->wacom_wac.features; | 113 | struct wacom_features *features = &wacom->wacom_wac.features; |
114 | struct hid_data *hid_data = &wacom->wacom_wac.hid_data; | 114 | struct hid_data *hid_data = &wacom->wacom_wac.hid_data; |
115 | unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); | ||
115 | u8 *data; | 116 | u8 *data; |
116 | int ret; | 117 | int ret; |
117 | int n; | 118 | int n; |
118 | 119 | ||
119 | switch (usage->hid) { | 120 | switch (equivalent_usage) { |
120 | case HID_DG_CONTACTMAX: | 121 | case HID_DG_CONTACTMAX: |
121 | /* leave touch_max as is if predefined */ | 122 | /* leave touch_max as is if predefined */ |
122 | if (!features->touch_max) { | 123 | if (!features->touch_max) { |
@@ -325,8 +326,14 @@ static void wacom_post_parse_hid(struct hid_device *hdev, | |||
325 | if (features->type == HID_GENERIC) { | 326 | if (features->type == HID_GENERIC) { |
326 | /* Any last-minute generic device setup */ | 327 | /* Any last-minute generic device setup */ |
327 | if (features->touch_max > 1) { | 328 | if (features->touch_max > 1) { |
328 | input_mt_init_slots(wacom_wac->touch_input, wacom_wac->features.touch_max, | 329 | if (features->device_type & WACOM_DEVICETYPE_DIRECT) |
329 | INPUT_MT_DIRECT); | 330 | input_mt_init_slots(wacom_wac->touch_input, |
331 | wacom_wac->features.touch_max, | ||
332 | INPUT_MT_DIRECT); | ||
333 | else | ||
334 | input_mt_init_slots(wacom_wac->touch_input, | ||
335 | wacom_wac->features.touch_max, | ||
336 | INPUT_MT_POINTER); | ||
330 | } | 337 | } |
331 | } | 338 | } |
332 | } | 339 | } |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 636c4a1ee958..2eeaa05e2068 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -1599,7 +1599,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) | |||
1599 | return 0; | 1599 | return 0; |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | static int wacom_equivalent_usage(int usage) | 1602 | int wacom_equivalent_usage(int usage) |
1603 | { | 1603 | { |
1604 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) { | 1604 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) { |
1605 | int subpage = (usage & 0xFF00) << 8; | 1605 | int subpage = (usage & 0xFF00) << 8; |
@@ -1626,6 +1626,16 @@ static int wacom_equivalent_usage(int usage) | |||
1626 | return subpage | subusage; | 1626 | return subpage | subusage; |
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMTOUCH) { | ||
1630 | int subpage = (usage & 0xFF00) << 8; | ||
1631 | int subusage = (usage & 0xFF); | ||
1632 | |||
1633 | if (subpage == HID_UP_UNDEFINED) | ||
1634 | subpage = WACOM_HID_SP_DIGITIZER; | ||
1635 | |||
1636 | return subpage | subusage; | ||
1637 | } | ||
1638 | |||
1629 | return usage; | 1639 | return usage; |
1630 | } | 1640 | } |
1631 | 1641 | ||
@@ -2218,8 +2228,10 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, | |||
2218 | 2228 | ||
2219 | for (j = 0; j < field->maxusage; j++) { | 2229 | for (j = 0; j < field->maxusage; j++) { |
2220 | struct hid_usage *usage = &field->usage[j]; | 2230 | struct hid_usage *usage = &field->usage[j]; |
2231 | unsigned int equivalent_usage = | ||
2232 | wacom_equivalent_usage(usage->hid); | ||
2221 | 2233 | ||
2222 | switch (usage->hid) { | 2234 | switch (equivalent_usage) { |
2223 | case HID_GD_X: | 2235 | case HID_GD_X: |
2224 | case HID_GD_Y: | 2236 | case HID_GD_Y: |
2225 | case HID_DG_WIDTH: | 2237 | case HID_DG_WIDTH: |
@@ -2228,7 +2240,7 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, | |||
2228 | case HID_DG_INRANGE: | 2240 | case HID_DG_INRANGE: |
2229 | case HID_DG_INVERT: | 2241 | case HID_DG_INVERT: |
2230 | case HID_DG_TIPSWITCH: | 2242 | case HID_DG_TIPSWITCH: |
2231 | hid_data->last_slot_field = usage->hid; | 2243 | hid_data->last_slot_field = equivalent_usage; |
2232 | break; | 2244 | break; |
2233 | case HID_DG_CONTACTCOUNT: | 2245 | case HID_DG_CONTACTCOUNT: |
2234 | hid_data->cc_report = report->id; | 2246 | hid_data->cc_report = report->id; |
@@ -2283,8 +2295,8 @@ void wacom_wac_usage_mapping(struct hid_device *hdev, | |||
2283 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 2295 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
2284 | struct wacom_features *features = &wacom_wac->features; | 2296 | struct wacom_features *features = &wacom_wac->features; |
2285 | 2297 | ||
2286 | /* currently, only direct devices have proper hid report descriptors */ | 2298 | if (WACOM_DIRECT_DEVICE(field)) |
2287 | features->device_type |= WACOM_DEVICETYPE_DIRECT; | 2299 | features->device_type |= WACOM_DEVICETYPE_DIRECT; |
2288 | 2300 | ||
2289 | if (WACOM_PAD_FIELD(field)) | 2301 | if (WACOM_PAD_FIELD(field)) |
2290 | wacom_wac_pad_usage_mapping(hdev, field, usage); | 2302 | wacom_wac_pad_usage_mapping(hdev, field, usage); |
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index dac95ba49888..da38f7736a7a 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
@@ -101,6 +101,7 @@ | |||
101 | #define WACOM_HID_SP_DIGITIZER 0x000d0000 | 101 | #define WACOM_HID_SP_DIGITIZER 0x000d0000 |
102 | #define WACOM_HID_SP_DIGITIZERINFO 0x00100000 | 102 | #define WACOM_HID_SP_DIGITIZERINFO 0x00100000 |
103 | #define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01) | 103 | #define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01) |
104 | #define WACOM_HID_WD_PEN (WACOM_HID_UP_WACOMDIGITIZER | 0x02) | ||
104 | #define WACOM_HID_WD_SENSE (WACOM_HID_UP_WACOMDIGITIZER | 0x36) | 105 | #define WACOM_HID_WD_SENSE (WACOM_HID_UP_WACOMDIGITIZER | 0x36) |
105 | #define WACOM_HID_WD_DIGITIZERFNKEYS (WACOM_HID_UP_WACOMDIGITIZER | 0x39) | 106 | #define WACOM_HID_WD_DIGITIZERFNKEYS (WACOM_HID_UP_WACOMDIGITIZER | 0x39) |
106 | #define WACOM_HID_WD_SERIALHI (WACOM_HID_UP_WACOMDIGITIZER | 0x5c) | 107 | #define WACOM_HID_WD_SERIALHI (WACOM_HID_UP_WACOMDIGITIZER | 0x5c) |
@@ -137,6 +138,12 @@ | |||
137 | #define WACOM_HID_UP_G11 0xff110000 | 138 | #define WACOM_HID_UP_G11 0xff110000 |
138 | #define WACOM_HID_G11_PEN (WACOM_HID_UP_G11 | 0x02) | 139 | #define WACOM_HID_G11_PEN (WACOM_HID_UP_G11 | 0x02) |
139 | #define WACOM_HID_G11_TOUCHSCREEN (WACOM_HID_UP_G11 | 0x11) | 140 | #define WACOM_HID_G11_TOUCHSCREEN (WACOM_HID_UP_G11 | 0x11) |
141 | #define WACOM_HID_UP_WACOMTOUCH 0xff000000 | ||
142 | #define WACOM_HID_WT_TOUCHSCREEN (WACOM_HID_UP_WACOMTOUCH | 0x04) | ||
143 | #define WACOM_HID_WT_TOUCHPAD (WACOM_HID_UP_WACOMTOUCH | 0x05) | ||
144 | #define WACOM_HID_WT_CONTACTMAX (WACOM_HID_UP_WACOMTOUCH | 0x55) | ||
145 | #define WACOM_HID_WT_X (WACOM_HID_UP_WACOMTOUCH | 0x130) | ||
146 | #define WACOM_HID_WT_Y (WACOM_HID_UP_WACOMTOUCH | 0x131) | ||
140 | 147 | ||
141 | #define WACOM_PAD_FIELD(f) (((f)->physical == HID_DG_TABLETFUNCTIONKEY) || \ | 148 | #define WACOM_PAD_FIELD(f) (((f)->physical == HID_DG_TABLETFUNCTIONKEY) || \ |
142 | ((f)->physical == WACOM_HID_WD_DIGITIZERFNKEYS) || \ | 149 | ((f)->physical == WACOM_HID_WD_DIGITIZERFNKEYS) || \ |
@@ -154,7 +161,14 @@ | |||
154 | ((f)->physical == HID_DG_FINGER) || \ | 161 | ((f)->physical == HID_DG_FINGER) || \ |
155 | ((f)->application == HID_DG_TOUCHSCREEN) || \ | 162 | ((f)->application == HID_DG_TOUCHSCREEN) || \ |
156 | ((f)->application == WACOM_HID_G9_TOUCHSCREEN) || \ | 163 | ((f)->application == WACOM_HID_G9_TOUCHSCREEN) || \ |
157 | ((f)->application == WACOM_HID_G11_TOUCHSCREEN)) | 164 | ((f)->application == WACOM_HID_G11_TOUCHSCREEN) || \ |
165 | ((f)->application == WACOM_HID_WT_TOUCHPAD) || \ | ||
166 | ((f)->application == HID_DG_TOUCHPAD)) | ||
167 | |||
168 | #define WACOM_DIRECT_DEVICE(f) (((f)->application == HID_DG_TOUCHSCREEN) || \ | ||
169 | ((f)->application == WACOM_HID_WT_TOUCHSCREEN) || \ | ||
170 | ((f)->application == HID_DG_PEN) || \ | ||
171 | ((f)->application == WACOM_HID_WD_PEN)) | ||
158 | 172 | ||
159 | enum { | 173 | enum { |
160 | PENPARTNER = 0, | 174 | PENPARTNER = 0, |