diff options
author | Jiri Kosina <jkosina@suse.cz> | 2017-11-15 05:14:23 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-11-15 05:14:23 -0500 |
commit | 01125b2d1fe9d691333cc90b17a4e2fd5bb908a2 (patch) | |
tree | 7fab7e06d41302e621d7ad00493b15baf81b8ea4 | |
parent | 4b545304947147bd4b9890160d328780c97bac33 (diff) | |
parent | 5b01b3b8b122fde7fbe116803f7863667b4c5beb (diff) |
Merge branch 'for-4.15/wacom' into for-linus
- High resolution mode for DEll canvas support, from Benjamin Tissoires
- A lot of improvements to pen handling in the Wacom driver, from Jason Gerecke
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/wacom_sys.c | 7 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.c | 44 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.h | 2 | ||||
-rw-r--r-- | include/uapi/linux/input-event-codes.h | 1 |
4 files changed, 39 insertions, 15 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 906e654fb0ba..ee71ad9b6cc1 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -196,6 +196,13 @@ static void wacom_feature_mapping(struct hid_device *hdev, | |||
196 | kfree(data); | 196 | kfree(data); |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | |||
200 | if (hdev->vendor == USB_VENDOR_ID_WACOM && | ||
201 | hdev->product == 0x4200 /* Dell Canvas 27 */ && | ||
202 | field->application == HID_UP_MSVENDOR) { | ||
203 | wacom->wacom_wac.mode_report = field->report->id; | ||
204 | wacom->wacom_wac.mode_value = 2; | ||
205 | } | ||
199 | } | 206 | } |
200 | 207 | ||
201 | /* | 208 | /* |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index aa692e28b2cd..16af6886e828 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -2140,6 +2140,12 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field | |||
2140 | case HID_DG_TIPSWITCH: | 2140 | case HID_DG_TIPSWITCH: |
2141 | wacom_wac->hid_data.tipswitch |= value; | 2141 | wacom_wac->hid_data.tipswitch |= value; |
2142 | return; | 2142 | return; |
2143 | case HID_DG_BARRELSWITCH: | ||
2144 | wacom_wac->hid_data.barrelswitch = value; | ||
2145 | return; | ||
2146 | case HID_DG_BARRELSWITCH2: | ||
2147 | wacom_wac->hid_data.barrelswitch2 = value; | ||
2148 | return; | ||
2143 | case HID_DG_TOOLSERIALNUMBER: | 2149 | case HID_DG_TOOLSERIALNUMBER: |
2144 | if (value) { | 2150 | if (value) { |
2145 | wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); | 2151 | wacom_wac->serial[0] = (wacom_wac->serial[0] & ~0xFFFFFFFFULL); |
@@ -2217,11 +2223,11 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field | |||
2217 | if (!usage->type || delay_pen_events(wacom_wac)) | 2223 | if (!usage->type || delay_pen_events(wacom_wac)) |
2218 | return; | 2224 | return; |
2219 | 2225 | ||
2220 | /* send pen events only when the pen is in/entering/leaving proximity */ | 2226 | /* send pen events only when the pen is in range */ |
2221 | if (!wacom_wac->hid_data.inrange_state && !wacom_wac->tool[0]) | 2227 | if (wacom_wac->hid_data.inrange_state) |
2222 | return; | 2228 | input_event(input, usage->type, usage->code, value); |
2223 | 2229 | else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) | |
2224 | input_event(input, usage->type, usage->code, value); | 2230 | input_event(input, usage->type, usage->code, 0); |
2225 | } | 2231 | } |
2226 | 2232 | ||
2227 | static void wacom_wac_pen_pre_report(struct hid_device *hdev, | 2233 | static void wacom_wac_pen_pre_report(struct hid_device *hdev, |
@@ -2236,11 +2242,11 @@ static void wacom_wac_pen_report(struct hid_device *hdev, | |||
2236 | struct wacom *wacom = hid_get_drvdata(hdev); | 2242 | struct wacom *wacom = hid_get_drvdata(hdev); |
2237 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 2243 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
2238 | struct input_dev *input = wacom_wac->pen_input; | 2244 | struct input_dev *input = wacom_wac->pen_input; |
2239 | bool prox = wacom_wac->hid_data.inrange_state; | 2245 | bool range = wacom_wac->hid_data.inrange_state; |
2240 | bool range = wacom_wac->hid_data.sense_state; | 2246 | bool sense = wacom_wac->hid_data.sense_state; |
2241 | 2247 | ||
2242 | if (!wacom_wac->tool[0] && prox) { /* first in prox */ | 2248 | if (!wacom_wac->tool[0] && range) { /* first in range */ |
2243 | /* Going into proximity select tool */ | 2249 | /* Going into range select tool */ |
2244 | if (wacom_wac->hid_data.invert_state) | 2250 | if (wacom_wac->hid_data.invert_state) |
2245 | wacom_wac->tool[0] = BTN_TOOL_RUBBER; | 2251 | wacom_wac->tool[0] = BTN_TOOL_RUBBER; |
2246 | else if (wacom_wac->id[0]) | 2252 | else if (wacom_wac->id[0]) |
@@ -2250,10 +2256,16 @@ static void wacom_wac_pen_report(struct hid_device *hdev, | |||
2250 | } | 2256 | } |
2251 | 2257 | ||
2252 | /* keep pen state for touch events */ | 2258 | /* keep pen state for touch events */ |
2253 | wacom_wac->shared->stylus_in_proximity = range; | 2259 | wacom_wac->shared->stylus_in_proximity = sense; |
2254 | 2260 | ||
2255 | if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { | 2261 | if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) { |
2256 | int id = wacom_wac->id[0]; | 2262 | int id = wacom_wac->id[0]; |
2263 | int sw_state = wacom_wac->hid_data.barrelswitch | | ||
2264 | (wacom_wac->hid_data.barrelswitch2 << 1); | ||
2265 | |||
2266 | input_report_key(input, BTN_STYLUS, sw_state == 1); | ||
2267 | input_report_key(input, BTN_STYLUS2, sw_state == 2); | ||
2268 | input_report_key(input, BTN_STYLUS3, sw_state == 3); | ||
2257 | 2269 | ||
2258 | /* | 2270 | /* |
2259 | * Non-USI EMR tools should have their IDs mangled to | 2271 | * Non-USI EMR tools should have their IDs mangled to |
@@ -2269,10 +2281,10 @@ static void wacom_wac_pen_report(struct hid_device *hdev, | |||
2269 | */ | 2281 | */ |
2270 | input_report_key(input, BTN_TOUCH, | 2282 | input_report_key(input, BTN_TOUCH, |
2271 | wacom_wac->hid_data.tipswitch); | 2283 | wacom_wac->hid_data.tipswitch); |
2272 | input_report_key(input, wacom_wac->tool[0], prox); | 2284 | input_report_key(input, wacom_wac->tool[0], sense); |
2273 | if (wacom_wac->serial[0]) { | 2285 | if (wacom_wac->serial[0]) { |
2274 | input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); | 2286 | input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); |
2275 | input_report_abs(input, ABS_MISC, prox ? id : 0); | 2287 | input_report_abs(input, ABS_MISC, sense ? id : 0); |
2276 | } | 2288 | } |
2277 | 2289 | ||
2278 | wacom_wac->hid_data.tipswitch = false; | 2290 | wacom_wac->hid_data.tipswitch = false; |
@@ -2280,7 +2292,7 @@ static void wacom_wac_pen_report(struct hid_device *hdev, | |||
2280 | input_sync(input); | 2292 | input_sync(input); |
2281 | } | 2293 | } |
2282 | 2294 | ||
2283 | if (!prox) { | 2295 | if (!sense) { |
2284 | wacom_wac->tool[0] = 0; | 2296 | wacom_wac->tool[0] = 0; |
2285 | wacom_wac->id[0] = 0; | 2297 | wacom_wac->id[0] = 0; |
2286 | wacom_wac->serial[0] = 0; | 2298 | wacom_wac->serial[0] = 0; |
@@ -3300,9 +3312,11 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, | |||
3300 | else | 3312 | else |
3301 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 3313 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
3302 | 3314 | ||
3303 | if (features->type == HID_GENERIC) | 3315 | if (features->type == HID_GENERIC) { |
3304 | /* setup has already been done */ | 3316 | /* setup has already been done; apply otherwise-undetectible quirks */ |
3317 | input_set_capability(input_dev, EV_KEY, BTN_STYLUS3); | ||
3305 | return 0; | 3318 | return 0; |
3319 | } | ||
3306 | 3320 | ||
3307 | __set_bit(BTN_TOUCH, input_dev->keybit); | 3321 | __set_bit(BTN_TOUCH, input_dev->keybit); |
3308 | __set_bit(ABS_MISC, input_dev->absbit); | 3322 | __set_bit(ABS_MISC, input_dev->absbit); |
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index feb62fd4dfc3..64d8f014602e 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
@@ -292,6 +292,8 @@ struct hid_data { | |||
292 | bool inrange_state; | 292 | bool inrange_state; |
293 | bool invert_state; | 293 | bool invert_state; |
294 | bool tipswitch; | 294 | bool tipswitch; |
295 | bool barrelswitch; | ||
296 | bool barrelswitch2; | ||
295 | int x; | 297 | int x; |
296 | int y; | 298 | int y; |
297 | int pressure; | 299 | int pressure; |
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 179891074b3c..9b3a522f50d1 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h | |||
@@ -406,6 +406,7 @@ | |||
406 | #define BTN_TOOL_MOUSE 0x146 | 406 | #define BTN_TOOL_MOUSE 0x146 |
407 | #define BTN_TOOL_LENS 0x147 | 407 | #define BTN_TOOL_LENS 0x147 |
408 | #define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ | 408 | #define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ |
409 | #define BTN_STYLUS3 0x149 | ||
409 | #define BTN_TOUCH 0x14a | 410 | #define BTN_TOUCH 0x14a |
410 | #define BTN_STYLUS 0x14b | 411 | #define BTN_STYLUS 0x14b |
411 | #define BTN_STYLUS2 0x14c | 412 | #define BTN_STYLUS2 0x14c |