Skip to content

Commit eda01da

Browse files
PinglinuxJiri Kosina
authored andcommitted
HID: wacom: Add four new Intuos devices
This series of devices supports both pen and touch. It reports touch data in Bamboo3 format and pen data in Intuos pro format. Signed-off-by: Ping Cheng <[email protected]> Tested-By: Aaron Skomra <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 3b164a0 commit eda01da

File tree

3 files changed

+82
-28
lines changed

3 files changed

+82
-28
lines changed

drivers/hid/wacom_sys.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,7 +1569,8 @@ static void wacom_wireless_work(struct work_struct *work)
15691569

15701570
/* Touch interface */
15711571
if (wacom_wac1->features.touch_max ||
1572-
wacom_wac1->features.type == INTUOSHT) {
1572+
(wacom_wac1->features.type >= INTUOSHT &&
1573+
wacom_wac1->features.type <= BAMBOO_PT)) {
15731574
wacom_wac2->features =
15741575
*((struct wacom_features *)id->driver_data);
15751576
wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1592,7 +1593,8 @@ static void wacom_wireless_work(struct work_struct *work)
15921593
if (error)
15931594
goto fail;
15941595

1595-
if (wacom_wac1->features.type == INTUOSHT &&
1596+
if ((wacom_wac1->features.type == INTUOSHT ||
1597+
wacom_wac1->features.type == INTUOSHT2) &&
15961598
wacom_wac1->features.touch_max)
15971599
wacom_wac->shared->touch_input = wacom_wac2->touch_input;
15981600
}
@@ -1834,8 +1836,9 @@ static int wacom_probe(struct hid_device *hdev,
18341836
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
18351837
error = hid_hw_open(hdev);
18361838

1837-
if (wacom_wac->features.type == INTUOSHT &&
1838-
wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH) {
1839+
if ((wacom_wac->features.type == INTUOSHT ||
1840+
wacom_wac->features.type == INTUOSHT2) &&
1841+
(wacom_wac->features.device_type & WACOM_DEVICETYPE_TOUCH)) {
18391842
wacom_wac->shared->touch_input = wacom_wac->touch_input;
18401843
}
18411844

drivers/hid/wacom_wac.c

Lines changed: 73 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,11 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
769769
t = (t << 1) | (data[1] & 1);
770770
}
771771
input_report_abs(input, ABS_PRESSURE, t);
772-
input_report_abs(input, ABS_TILT_X,
772+
if (features->type != INTUOSHT2) {
773+
input_report_abs(input, ABS_TILT_X,
773774
(((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64);
774-
input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64);
775+
input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64);
776+
}
775777
input_report_key(input, BTN_STYLUS, data[1] & 2);
776778
input_report_key(input, BTN_STYLUS2, data[1] & 4);
777779
input_report_key(input, BTN_TOUCH, t > 10);
@@ -799,6 +801,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
799801
data[0] != WACOM_REPORT_INTUOSREAD &&
800802
data[0] != WACOM_REPORT_INTUOSWRITE &&
801803
data[0] != WACOM_REPORT_INTUOSPAD &&
804+
data[0] != WACOM_REPORT_INTUOS_PEN &&
802805
data[0] != WACOM_REPORT_CINTIQ &&
803806
data[0] != WACOM_REPORT_CINTIQPAD &&
804807
data[0] != WACOM_REPORT_INTUOS5PAD) {
@@ -1896,7 +1899,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
18961899
int y = (data[3] << 4) | (data[4] & 0x0f);
18971900
int width, height;
18981901

1899-
if (features->type >= INTUOSPS && features->type <= INTUOSHT) {
1902+
if (features->type >= INTUOSPS && features->type <= INTUOSHT2) {
19001903
width = data[5] * 100;
19011904
height = data[6] * 100;
19021905
} else {
@@ -1924,7 +1927,7 @@ static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
19241927
struct input_dev *input = wacom->pad_input;
19251928
struct wacom_features *features = &wacom->features;
19261929

1927-
if (features->type == INTUOSHT) {
1930+
if (features->type == INTUOSHT || features->type == INTUOSHT2) {
19281931
input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
19291932
input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
19301933
} else {
@@ -1939,7 +1942,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
19391942
{
19401943
unsigned char *data = wacom->data;
19411944
int count = data[1] & 0x07;
1942-
int i;
1945+
int touch_changed = 0, i;
19431946

19441947
if (data[0] != 0x02)
19451948
return 0;
@@ -1949,15 +1952,16 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
19491952
int offset = (8 * i) + 2;
19501953
int msg_id = data[offset];
19511954

1952-
if (msg_id >= 2 && msg_id <= 17)
1955+
if (msg_id >= 2 && msg_id <= 17) {
19531956
wacom_bpt3_touch_msg(wacom, data + offset);
1954-
else if (msg_id == 128)
1957+
touch_changed++;
1958+
} else if (msg_id == 128)
19551959
wacom_bpt3_button_msg(wacom, data + offset);
19561960

19571961
}
19581962

1959-
/* only update the touch if we actually have a touchpad */
1960-
if (wacom->touch_registered) {
1963+
/* only update touch if we actually have a touchpad and touch data changed */
1964+
if (wacom->touch_registered && touch_changed) {
19611965
input_mt_sync_frame(wacom->touch_input);
19621966
wacom->shared->touch_down = wacom_wac_finger_count_touches(wacom);
19631967
}
@@ -2038,7 +2042,13 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
20382042

20392043
static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
20402044
{
2041-
if (len == WACOM_PKGLEN_BBTOUCH)
2045+
struct wacom_features *features = &wacom->features;
2046+
2047+
if ((features->type == INTUOSHT2) &&
2048+
(wacom->data[0] == WACOM_REPORT_INTUOS_PEN) &&
2049+
(features->device_type & WACOM_DEVICETYPE_PEN))
2050+
return wacom_intuos_irq(wacom);
2051+
else if (len == WACOM_PKGLEN_BBTOUCH)
20422052
return wacom_bpt_touch(wacom);
20432053
else if (len == WACOM_PKGLEN_BBTOUCH3)
20442054
return wacom_bpt3_touch(wacom);
@@ -2145,7 +2155,8 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
21452155
if (connected) {
21462156
int pid, battery, charging;
21472157

2148-
if ((wacom->shared->type == INTUOSHT) &&
2158+
if ((wacom->shared->type == INTUOSHT ||
2159+
wacom->shared->type == INTUOSHT2) &&
21492160
wacom->shared->touch_input &&
21502161
wacom->shared->touch_max) {
21512162
input_report_switch(wacom->shared->touch_input,
@@ -2183,7 +2194,8 @@ static int wacom_status_irq(struct wacom_wac *wacom_wac, size_t len)
21832194
if (data[0] != WACOM_REPORT_USB)
21842195
return 0;
21852196

2186-
if (features->type == INTUOSHT &&
2197+
if ((features->type == INTUOSHT ||
2198+
features->type == INTUOSHT2) &&
21872199
wacom_wac->shared->touch_input &&
21882200
features->touch_max) {
21892201
input_report_switch(wacom_wac->shared->touch_input,
@@ -2303,6 +2315,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
23032315
case BAMBOO_PEN:
23042316
case BAMBOO_TOUCH:
23052317
case INTUOSHT:
2318+
case INTUOSHT2:
23062319
if (wacom_wac->data[0] == WACOM_REPORT_USB)
23072320
sync = wacom_status_irq(wacom_wac, len);
23082321
else
@@ -2339,22 +2352,31 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
23392352
}
23402353
}
23412354

2342-
static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
2355+
static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac)
23432356
{
23442357
struct input_dev *input_dev = wacom_wac->pen_input;
23452358

23462359
input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
23472360

2348-
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
23492361
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
2350-
__set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
2351-
__set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
2352-
__set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
23532362
__set_bit(BTN_STYLUS, input_dev->keybit);
23542363
__set_bit(BTN_STYLUS2, input_dev->keybit);
23552364

23562365
input_set_abs_params(input_dev, ABS_DISTANCE,
23572366
0, wacom_wac->features.distance_max, 0, 0);
2367+
}
2368+
2369+
static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
2370+
{
2371+
struct input_dev *input_dev = wacom_wac->pen_input;
2372+
2373+
wacom_setup_basic_pro_pen(wacom_wac);
2374+
2375+
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
2376+
__set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
2377+
__set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
2378+
__set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
2379+
23582380
input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
23592381
input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0);
23602382
input_abs_set_res(input_dev, ABS_TILT_X, 57);
@@ -2600,16 +2622,21 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev,
26002622
case INTUOSHT:
26012623
case BAMBOO_PT:
26022624
case BAMBOO_PEN:
2603-
__clear_bit(ABS_MISC, input_dev->absbit);
2604-
2625+
case INTUOSHT2:
26052626
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
2606-
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
2607-
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
2608-
__set_bit(BTN_STYLUS, input_dev->keybit);
2609-
__set_bit(BTN_STYLUS2, input_dev->keybit);
2610-
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
2627+
2628+
if (features->type == INTUOSHT2) {
2629+
wacom_setup_basic_pro_pen(wacom_wac);
2630+
} else {
2631+
__clear_bit(ABS_MISC, input_dev->absbit);
2632+
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
2633+
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
2634+
__set_bit(BTN_STYLUS, input_dev->keybit);
2635+
__set_bit(BTN_STYLUS2, input_dev->keybit);
2636+
input_set_abs_params(input_dev, ABS_DISTANCE, 0,
26112637
features->distance_max,
26122638
0, 0);
2639+
}
26132640
break;
26142641
case BAMBOO_PAD:
26152642
__clear_bit(ABS_MISC, input_dev->absbit);
@@ -2690,6 +2717,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
26902717
break;
26912718

26922719
case INTUOSHT:
2720+
case INTUOSHT2:
26932721
input_dev->evbit[0] |= BIT_MASK(EV_SW);
26942722
__set_bit(SW_MUTE_DEVICE, input_dev->swbit);
26952723
/* fall through */
@@ -2849,6 +2877,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
28492877
case INTUOSHT:
28502878
case BAMBOO_PT:
28512879
case BAMBOO_TOUCH:
2880+
case INTUOSHT2:
28522881
__clear_bit(ABS_MISC, input_dev->absbit);
28532882

28542883
__set_bit(BTN_LEFT, input_dev->keybit);
@@ -3335,6 +3364,22 @@ static const struct wacom_features wacom_features_0x331 =
33353364
{ "Wacom Express Key Remote", .type = REMOTE,
33363365
.numbered_buttons = 18, .check_for_hid_type = true,
33373366
.hid_type = HID_TYPE_USBNONE };
3367+
static const struct wacom_features wacom_features_0x33B =
3368+
{ "Wacom Intuos S 2", 15200, 9500, 2047, 63,
3369+
INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
3370+
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
3371+
static const struct wacom_features wacom_features_0x33C =
3372+
{ "Wacom Intuos PT S 2", 15200, 9500, 2047, 63,
3373+
INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16,
3374+
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
3375+
static const struct wacom_features wacom_features_0x33D =
3376+
{ "Wacom Intuos P M 2", 21600, 13500, 2047, 63,
3377+
INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
3378+
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
3379+
static const struct wacom_features wacom_features_0x33E =
3380+
{ "Wacom Intuos PT M 2", 21600, 13500, 2047, 63,
3381+
INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16,
3382+
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
33383383

33393384
static const struct wacom_features wacom_features_HID_ANY_ID =
33403385
{ "Wacom HID", .type = HID_GENERIC };
@@ -3494,6 +3539,10 @@ const struct hid_device_id wacom_ids[] = {
34943539
{ USB_DEVICE_WACOM(0x333) },
34953540
{ USB_DEVICE_WACOM(0x335) },
34963541
{ USB_DEVICE_WACOM(0x336) },
3542+
{ USB_DEVICE_WACOM(0x33B) },
3543+
{ USB_DEVICE_WACOM(0x33C) },
3544+
{ USB_DEVICE_WACOM(0x33D) },
3545+
{ USB_DEVICE_WACOM(0x33E) },
34973546
{ USB_DEVICE_WACOM(0x4001) },
34983547
{ USB_DEVICE_WACOM(0x4004) },
34993548
{ USB_DEVICE_WACOM(0x5000) },

drivers/hid/wacom_wac.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
#define WACOM_REPORT_BPAD_PEN 3
6969
#define WACOM_REPORT_BPAD_TOUCH 16
7070
#define WACOM_REPORT_DEVICE_LIST 16
71+
#define WACOM_REPORT_INTUOS_PEN 16
7172
#define WACOM_REPORT_REMOTE 17
7273

7374
/* device quirks */
@@ -130,6 +131,7 @@ enum {
130131
WIRELESS,
131132
BAMBOO_PEN,
132133
INTUOSHT,
134+
INTUOSHT2,
133135
BAMBOO_TOUCH,
134136
BAMBOO_PT,
135137
WACOM_24HDT,

0 commit comments

Comments
 (0)