aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/wacom_wac.c18
-rw-r--r--drivers/hid/wacom_wac.h2
-rw-r--r--include/uapi/linux/input-event-codes.h1
3 files changed, 19 insertions, 2 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index e3223b0c4f90..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);
@@ -2254,6 +2260,12 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
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
@@ -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 8a03654048bf..69dda27e8dde 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -291,6 +291,8 @@ struct hid_data {
291 bool inrange_state; 291 bool inrange_state;
292 bool invert_state; 292 bool invert_state;
293 bool tipswitch; 293 bool tipswitch;
294 bool barrelswitch;
295 bool barrelswitch2;
294 int x; 296 int x;
295 int y; 297 int y;
296 int pressure; 298 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