@@ -1860,22 +1860,16 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
1860
1860
usage -> type = type ;
1861
1861
usage -> code = code ;
1862
1862
1863
- set_bit (type , input -> evbit );
1864
-
1865
1863
switch (type ) {
1866
1864
case EV_ABS :
1867
1865
input_set_abs_params (input , code , fmin , fmax , fuzz , 0 );
1868
1866
input_abs_set_res (input , code ,
1869
1867
hidinput_calc_abs_res (field , resolution_code ));
1870
1868
break ;
1871
1869
case EV_KEY :
1872
- input_set_capability (input , EV_KEY , code );
1873
- break ;
1874
1870
case EV_MSC :
1875
- input_set_capability (input , EV_MSC , code );
1876
- break ;
1877
1871
case EV_SW :
1878
- input_set_capability (input , EV_SW , code );
1872
+ input_set_capability (input , type , code );
1879
1873
break ;
1880
1874
}
1881
1875
}
@@ -2187,6 +2181,18 @@ static void wacom_wac_pad_report(struct hid_device *hdev,
2187
2181
}
2188
2182
}
2189
2183
2184
+ static void wacom_set_barrel_switch3_usage (struct wacom_wac * wacom_wac )
2185
+ {
2186
+ struct input_dev * input = wacom_wac -> pen_input ;
2187
+ struct wacom_features * features = & wacom_wac -> features ;
2188
+
2189
+ if (!(features -> quirks & WACOM_QUIRK_AESPEN ) &&
2190
+ wacom_wac -> hid_data .barrelswitch &&
2191
+ wacom_wac -> hid_data .barrelswitch2 &&
2192
+ wacom_wac -> hid_data .serialhi )
2193
+ input_set_capability (input , EV_KEY , BTN_STYLUS3 );
2194
+ }
2195
+
2190
2196
static void wacom_wac_pen_usage_mapping (struct hid_device * hdev ,
2191
2197
struct hid_field * field , struct hid_usage * usage )
2192
2198
{
@@ -2227,13 +2233,21 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
2227
2233
wacom_map_usage (input , usage , field , EV_ABS , ABS_Z , 0 );
2228
2234
break ;
2229
2235
case HID_DG_ERASER :
2236
+ input_set_capability (input , EV_KEY , BTN_TOOL_RUBBER );
2237
+ wacom_map_usage (input , usage , field , EV_KEY , BTN_TOUCH , 0 );
2238
+ break ;
2230
2239
case HID_DG_TIPSWITCH :
2240
+ input_set_capability (input , EV_KEY , BTN_TOOL_PEN );
2231
2241
wacom_map_usage (input , usage , field , EV_KEY , BTN_TOUCH , 0 );
2232
2242
break ;
2233
2243
case HID_DG_BARRELSWITCH :
2244
+ wacom_wac -> hid_data .barrelswitch = true;
2245
+ wacom_set_barrel_switch3_usage (wacom_wac );
2234
2246
wacom_map_usage (input , usage , field , EV_KEY , BTN_STYLUS , 0 );
2235
2247
break ;
2236
2248
case HID_DG_BARRELSWITCH2 :
2249
+ wacom_wac -> hid_data .barrelswitch2 = true;
2250
+ wacom_set_barrel_switch3_usage (wacom_wac );
2237
2251
wacom_map_usage (input , usage , field , EV_KEY , BTN_STYLUS2 , 0 );
2238
2252
break ;
2239
2253
case HID_DG_TOOLSERIALNUMBER :
@@ -2245,22 +2259,12 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
2245
2259
wacom_map_usage (input , usage , field , EV_KEY , BTN_TOOL_PEN , 0 );
2246
2260
break ;
2247
2261
case WACOM_HID_WD_SERIALHI :
2262
+ wacom_wac -> hid_data .serialhi = true;
2263
+ wacom_set_barrel_switch3_usage (wacom_wac );
2248
2264
wacom_map_usage (input , usage , field , EV_ABS , ABS_MISC , 0 );
2249
-
2250
- if (!(features -> quirks & WACOM_QUIRK_AESPEN )) {
2251
- set_bit (EV_KEY , input -> evbit );
2252
- input_set_capability (input , EV_KEY , BTN_TOOL_PEN );
2253
- input_set_capability (input , EV_KEY , BTN_TOOL_RUBBER );
2254
- input_set_capability (input , EV_KEY , BTN_TOOL_BRUSH );
2255
- input_set_capability (input , EV_KEY , BTN_TOOL_PENCIL );
2256
- input_set_capability (input , EV_KEY , BTN_TOOL_AIRBRUSH );
2257
- if (!(features -> device_type & WACOM_DEVICETYPE_DIRECT )) {
2258
- input_set_capability (input , EV_KEY , BTN_TOOL_MOUSE );
2259
- input_set_capability (input , EV_KEY , BTN_TOOL_LENS );
2260
- }
2261
- }
2262
2265
break ;
2263
2266
case WACOM_HID_WD_FINGERWHEEL :
2267
+ input_set_capability (input , EV_KEY , BTN_TOOL_AIRBRUSH );
2264
2268
wacom_map_usage (input , usage , field , EV_ABS , ABS_WHEEL , 0 );
2265
2269
break ;
2266
2270
}
@@ -3582,11 +3586,9 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
3582
3586
else
3583
3587
__set_bit (INPUT_PROP_POINTER , input_dev -> propbit );
3584
3588
3585
- if (features -> type == HID_GENERIC ) {
3586
- /* setup has already been done; apply otherwise-undetectible quirks */
3587
- input_set_capability (input_dev , EV_KEY , BTN_STYLUS3 );
3589
+ if (features -> type == HID_GENERIC )
3590
+ /* setup has already been done */
3588
3591
return 0 ;
3589
- }
3590
3592
3591
3593
input_dev -> evbit [0 ] |= BIT_MASK (EV_KEY ) | BIT_MASK (EV_ABS );
3592
3594
__set_bit (BTN_TOUCH , input_dev -> keybit );
0 commit comments