Skip to content

Commit e5bc8eb

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Add WACOM_DEVICETYPE_DIRECT for Cintiqs and similar
"Direct" input devices like Cintiqs and Tablet PCs set the INPUT_PROP_DIRECT property to notify userspace that the sensor and screen are overlaid. This information can also be useful elsewhere within the kernel driver, however, so we introduce a new WACOM_DEVICETYPE_DIRECT that signals this to other kernel code. Signed-off-by: Jason Gerecke <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 9956953 commit e5bc8eb

File tree

2 files changed

+40
-19
lines changed

2 files changed

+40
-19
lines changed

drivers/hid/wacom_wac.c

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,10 +1750,10 @@ void wacom_wac_usage_mapping(struct hid_device *hdev,
17501750
{
17511751
struct wacom *wacom = hid_get_drvdata(hdev);
17521752
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
1753+
struct wacom_features *features = &wacom_wac->features;
17531754

17541755
/* currently, only direct devices have proper hid report descriptors */
1755-
__set_bit(INPUT_PROP_DIRECT, wacom_wac->pen_input->propbit);
1756-
__set_bit(INPUT_PROP_DIRECT, wacom_wac->touch_input->propbit);
1756+
features->device_type |= WACOM_DEVICETYPE_DIRECT;
17571757

17581758
if (WACOM_PEN_FIELD(field))
17591759
return wacom_wac_pen_usage_mapping(hdev, field, usage);
@@ -2459,6 +2459,33 @@ void wacom_setup_device_quirks(struct wacom *wacom)
24592459
if (features->type == REMOTE)
24602460
features->device_type = WACOM_DEVICETYPE_PAD;
24612461

2462+
switch (features->type) {
2463+
case PL:
2464+
case DTU:
2465+
case DTUS:
2466+
case DTUSX:
2467+
case WACOM_21UX2:
2468+
case WACOM_22HD:
2469+
case DTK:
2470+
case WACOM_24HD:
2471+
case WACOM_27QHD:
2472+
case CINTIQ_HYBRID:
2473+
case CINTIQ_COMPANION_2:
2474+
case CINTIQ:
2475+
case WACOM_BEE:
2476+
case WACOM_13HD:
2477+
case WACOM_24HDT:
2478+
case WACOM_27QHDT:
2479+
case TABLETPC:
2480+
case TABLETPCE:
2481+
case TABLETPC2FG:
2482+
case MTSCREEN:
2483+
case MTTPC:
2484+
case MTTPC_B:
2485+
features->device_type |= WACOM_DEVICETYPE_DIRECT;
2486+
break;
2487+
}
2488+
24622489
if (wacom->hdev->bus == BUS_BLUETOOTH)
24632490
features->quirks |= WACOM_QUIRK_BATTERY;
24642491

@@ -2492,6 +2519,11 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
24922519
if (!(features->device_type & WACOM_DEVICETYPE_PEN))
24932520
return -ENODEV;
24942521

2522+
if (features->device_type & WACOM_DEVICETYPE_DIRECT)
2523+
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
2524+
else
2525+
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2526+
24952527
if (features->type == HID_GENERIC)
24962528
/* setup has already been done */
24972529
return 0;
@@ -2510,7 +2542,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
25102542
input_abs_set_res(input_dev, ABS_X, features->x_resolution);
25112543
input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
25122544

2513-
25142545
switch (features->type) {
25152546
case GRAPHIRE_BT:
25162547
__clear_bit(ABS_MISC, input_dev->absbit);
@@ -2534,8 +2565,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
25342565
__set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
25352566
__set_bit(BTN_STYLUS, input_dev->keybit);
25362567
__set_bit(BTN_STYLUS2, input_dev->keybit);
2537-
2538-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
25392568
break;
25402569

25412570
case WACOM_27QHD:
@@ -2550,7 +2579,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
25502579
case CINTIQ_COMPANION_2:
25512580
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
25522581
input_abs_set_res(input_dev, ABS_Z, 287);
2553-
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
25542582
wacom_setup_cintiq(wacom_wac);
25552583
break;
25562584

@@ -2566,8 +2594,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
25662594
/* fall through */
25672595

25682596
case INTUOS:
2569-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2570-
25712597
wacom_setup_intuos(wacom_wac);
25722598
break;
25732599

@@ -2577,8 +2603,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
25772603
case INTUOSPL:
25782604
case INTUOS5S:
25792605
case INTUOSPS:
2580-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2581-
25822606
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
25832607
features->distance_max,
25842608
features->distance_fuzz, 0);
@@ -2608,8 +2632,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
26082632
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
26092633
__set_bit(BTN_STYLUS, input_dev->keybit);
26102634
__set_bit(BTN_STYLUS2, input_dev->keybit);
2611-
2612-
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
26132635
break;
26142636

26152637
case PTU:
@@ -2620,16 +2642,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
26202642
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
26212643
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
26222644
__set_bit(BTN_STYLUS, input_dev->keybit);
2623-
2624-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
26252645
break;
26262646

26272647
case INTUOSHT:
26282648
case BAMBOO_PT:
26292649
case BAMBOO_PEN:
26302650
case INTUOSHT2:
2631-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2632-
26332651
if (features->type == INTUOSHT2) {
26342652
wacom_setup_basic_pro_pen(wacom_wac);
26352653
} else {
@@ -2660,6 +2678,11 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
26602678
if (!(features->device_type & WACOM_DEVICETYPE_TOUCH))
26612679
return -ENODEV;
26622680

2681+
if (features->device_type & WACOM_DEVICETYPE_DIRECT)
2682+
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
2683+
else
2684+
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2685+
26632686
if (features->type == HID_GENERIC)
26642687
/* setup has already been done */
26652688
return 0;
@@ -2694,8 +2717,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
26942717
case INTUOSPL:
26952718
case INTUOS5S:
26962719
case INTUOSPS:
2697-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2698-
26992720
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
27002721
input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0);
27012722
input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER);
@@ -2718,7 +2739,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
27182739

27192740
case TABLETPC:
27202741
case TABLETPCE:
2721-
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
27222742
break;
27232743

27242744
case INTUOSHT:

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#define WACOM_DEVICETYPE_TOUCH 0x0002
8383
#define WACOM_DEVICETYPE_PAD 0x0004
8484
#define WACOM_DEVICETYPE_WL_MONITOR 0x0008
85+
#define WACOM_DEVICETYPE_DIRECT 0x0010
8586

8687
#define WACOM_VENDORDEFINED_PEN 0xff0d0001
8788
#define WACOM_G9_PAGE 0xff090000

0 commit comments

Comments
 (0)