Commit e5bc8eb1 authored by Jason Gerecke's avatar Jason Gerecke Committed by Jiri Kosina

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: default avatarJason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 9956953e
...@@ -1750,10 +1750,10 @@ void wacom_wac_usage_mapping(struct hid_device *hdev, ...@@ -1750,10 +1750,10 @@ void wacom_wac_usage_mapping(struct hid_device *hdev,
{ {
struct wacom *wacom = hid_get_drvdata(hdev); struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct wacom_features *features = &wacom_wac->features;
/* currently, only direct devices have proper hid report descriptors */ /* currently, only direct devices have proper hid report descriptors */
__set_bit(INPUT_PROP_DIRECT, wacom_wac->pen_input->propbit); features->device_type |= WACOM_DEVICETYPE_DIRECT;
__set_bit(INPUT_PROP_DIRECT, wacom_wac->touch_input->propbit);
if (WACOM_PEN_FIELD(field)) if (WACOM_PEN_FIELD(field))
return wacom_wac_pen_usage_mapping(hdev, field, usage); return wacom_wac_pen_usage_mapping(hdev, field, usage);
...@@ -2459,6 +2459,33 @@ void wacom_setup_device_quirks(struct wacom *wacom) ...@@ -2459,6 +2459,33 @@ void wacom_setup_device_quirks(struct wacom *wacom)
if (features->type == REMOTE) if (features->type == REMOTE)
features->device_type = WACOM_DEVICETYPE_PAD; features->device_type = WACOM_DEVICETYPE_PAD;
switch (features->type) {
case PL:
case DTU:
case DTUS:
case DTUSX:
case WACOM_21UX2:
case WACOM_22HD:
case DTK:
case WACOM_24HD:
case WACOM_27QHD:
case CINTIQ_HYBRID:
case CINTIQ_COMPANION_2:
case CINTIQ:
case WACOM_BEE:
case WACOM_13HD:
case WACOM_24HDT:
case WACOM_27QHDT:
case TABLETPC:
case TABLETPCE:
case TABLETPC2FG:
case MTSCREEN:
case MTTPC:
case MTTPC_B:
features->device_type |= WACOM_DEVICETYPE_DIRECT;
break;
}
if (wacom->hdev->bus == BUS_BLUETOOTH) if (wacom->hdev->bus == BUS_BLUETOOTH)
features->quirks |= WACOM_QUIRK_BATTERY; features->quirks |= WACOM_QUIRK_BATTERY;
...@@ -2492,6 +2519,11 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2492,6 +2519,11 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
if (!(features->device_type & WACOM_DEVICETYPE_PEN)) if (!(features->device_type & WACOM_DEVICETYPE_PEN))
return -ENODEV; return -ENODEV;
if (features->device_type & WACOM_DEVICETYPE_DIRECT)
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
else
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
if (features->type == HID_GENERIC) if (features->type == HID_GENERIC)
/* setup has already been done */ /* setup has already been done */
return 0; return 0;
...@@ -2510,7 +2542,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2510,7 +2542,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
input_abs_set_res(input_dev, ABS_X, features->x_resolution); input_abs_set_res(input_dev, ABS_X, features->x_resolution);
input_abs_set_res(input_dev, ABS_Y, features->y_resolution); input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
switch (features->type) { switch (features->type) {
case GRAPHIRE_BT: case GRAPHIRE_BT:
__clear_bit(ABS_MISC, input_dev->absbit); __clear_bit(ABS_MISC, input_dev->absbit);
...@@ -2534,8 +2565,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2534,8 +2565,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_TOOL_MOUSE, input_dev->keybit); __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
__set_bit(BTN_STYLUS, input_dev->keybit); __set_bit(BTN_STYLUS, input_dev->keybit);
__set_bit(BTN_STYLUS2, input_dev->keybit); __set_bit(BTN_STYLUS2, input_dev->keybit);
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
break; break;
case WACOM_27QHD: case WACOM_27QHD:
...@@ -2550,7 +2579,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2550,7 +2579,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
case CINTIQ_COMPANION_2: case CINTIQ_COMPANION_2:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287); input_abs_set_res(input_dev, ABS_Z, 287);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
wacom_setup_cintiq(wacom_wac); wacom_setup_cintiq(wacom_wac);
break; break;
...@@ -2566,8 +2594,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2566,8 +2594,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
/* fall through */ /* fall through */
case INTUOS: case INTUOS:
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
wacom_setup_intuos(wacom_wac); wacom_setup_intuos(wacom_wac);
break; break;
...@@ -2577,8 +2603,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2577,8 +2603,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
case INTUOSPL: case INTUOSPL:
case INTUOS5S: case INTUOS5S:
case INTUOSPS: case INTUOSPS:
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
input_set_abs_params(input_dev, ABS_DISTANCE, 0, input_set_abs_params(input_dev, ABS_DISTANCE, 0,
features->distance_max, features->distance_max,
features->distance_fuzz, 0); features->distance_fuzz, 0);
...@@ -2608,8 +2632,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2608,8 +2632,6 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit); __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_STYLUS, input_dev->keybit); __set_bit(BTN_STYLUS, input_dev->keybit);
__set_bit(BTN_STYLUS2, input_dev->keybit); __set_bit(BTN_STYLUS2, input_dev->keybit);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
break; break;
case PTU: case PTU:
...@@ -2620,16 +2642,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, ...@@ -2620,16 +2642,12 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
__set_bit(BTN_TOOL_PEN, input_dev->keybit); __set_bit(BTN_TOOL_PEN, input_dev->keybit);
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit); __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
__set_bit(BTN_STYLUS, input_dev->keybit); __set_bit(BTN_STYLUS, input_dev->keybit);
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
break; break;
case INTUOSHT: case INTUOSHT:
case BAMBOO_PT: case BAMBOO_PT:
case BAMBOO_PEN: case BAMBOO_PEN:
case INTUOSHT2: case INTUOSHT2:
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
if (features->type == INTUOSHT2) { if (features->type == INTUOSHT2) {
wacom_setup_basic_pro_pen(wacom_wac); wacom_setup_basic_pro_pen(wacom_wac);
} else { } else {
...@@ -2660,6 +2678,11 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, ...@@ -2660,6 +2678,11 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
if (!(features->device_type & WACOM_DEVICETYPE_TOUCH)) if (!(features->device_type & WACOM_DEVICETYPE_TOUCH))
return -ENODEV; return -ENODEV;
if (features->device_type & WACOM_DEVICETYPE_DIRECT)
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
else
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
if (features->type == HID_GENERIC) if (features->type == HID_GENERIC)
/* setup has already been done */ /* setup has already been done */
return 0; return 0;
...@@ -2694,8 +2717,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev, ...@@ -2694,8 +2717,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
case INTUOSPL: case INTUOSPL:
case INTUOS5S: case INTUOS5S:
case INTUOSPS: case INTUOSPS:
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0); input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, features->y_max, 0, 0);
input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); 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, ...@@ -2718,7 +2739,6 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
case TABLETPC: case TABLETPC:
case TABLETPCE: case TABLETPCE:
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
break; break;
case INTUOSHT: case INTUOSHT:
......
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
#define WACOM_DEVICETYPE_TOUCH 0x0002 #define WACOM_DEVICETYPE_TOUCH 0x0002
#define WACOM_DEVICETYPE_PAD 0x0004 #define WACOM_DEVICETYPE_PAD 0x0004
#define WACOM_DEVICETYPE_WL_MONITOR 0x0008 #define WACOM_DEVICETYPE_WL_MONITOR 0x0008
#define WACOM_DEVICETYPE_DIRECT 0x0010
#define WACOM_VENDORDEFINED_PEN 0xff0d0001 #define WACOM_VENDORDEFINED_PEN 0xff0d0001
#define WACOM_G9_PAGE 0xff090000 #define WACOM_G9_PAGE 0xff090000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment