Skip to content

Commit b5fd2a3

Browse files
Pinglinuxdtor
authored andcommitted
Input: wacom - add support for three new Intuos devices
Two tablets in this series support both pen and touch. One (Intuos S) only supports pen. This patch also updates the driver to process wireless devices that do not support touch interface. Tested-by: Jason Gerecke <[email protected]> Reviewed-by: Chris Bagwell <[email protected]> Signed-off-by: Ping Cheng <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 1d0d6df commit b5fd2a3

File tree

3 files changed

+51
-18
lines changed

3 files changed

+51
-18
lines changed

drivers/input/tablet/wacom_sys.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,8 @@ static void wacom_wireless_work(struct work_struct *work)
11981198
goto fail;
11991199

12001200
/* Touch interface */
1201-
if (wacom_wac1->features.touch_max) {
1201+
if (wacom_wac1->features.touch_max ||
1202+
wacom_wac1->features.type == INTUOSHT) {
12021203
wacom_wac2->features =
12031204
*((struct wacom_features *)id->driver_info);
12041205
wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1321,7 +1322,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
13211322
* HID descriptor. If this is the touch interface (wMaxPacketSize
13221323
* of WACOM_PKGLEN_BBTOUCH3), override the table values.
13231324
*/
1324-
if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
1325+
if (features->type >= INTUOS5S && features->type <= INTUOSHT) {
13251326
if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
13261327
features->device_type = BTN_TOOL_FINGER;
13271328
features->pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1391,7 +1392,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
13911392
goto fail5;
13921393
}
13931394
}
1394-
13951395
return 0;
13961396

13971397
fail5: wacom_destroy_leds(wacom);

drivers/input/tablet/wacom_wac.c

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,10 +1176,16 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
11761176
static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
11771177
{
11781178
struct input_dev *input = wacom->input;
1179+
struct wacom_features *features = &wacom->features;
11791180

1180-
input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
1181+
if (features->type == INTUOSHT) {
1182+
input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
1183+
input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
1184+
} else {
1185+
input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
1186+
input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
1187+
}
11811188
input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
1182-
input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
11831189
input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
11841190
}
11851191

@@ -1217,7 +1223,7 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
12171223
unsigned char *data = wacom->data;
12181224
int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
12191225

1220-
if (data[0] != 0x02)
1226+
if (data[0] != WACOM_REPORT_PENABLED)
12211227
return 0;
12221228

12231229
prox = (data[1] & 0x20) == 0x20;
@@ -1297,7 +1303,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
12971303
unsigned char *data = wacom->data;
12981304
int connected;
12991305

1300-
if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
1306+
if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL)
13011307
return 0;
13021308

13031309
connected = data[1] & 0x01;
@@ -1391,6 +1397,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
13911397
break;
13921398

13931399
case BAMBOO_PT:
1400+
case INTUOSHT:
13941401
sync = wacom_bpt_irq(wacom_wac, len);
13951402
break;
13961403

@@ -1459,7 +1466,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
14591466

14601467
/* these device have multiple inputs */
14611468
if (features->type >= WIRELESS ||
1462-
(features->type >= INTUOS5S && features->type <= INTUOSPL) ||
1469+
(features->type >= INTUOS5S && features->type <= INTUOSHT) ||
14631470
(features->oVid && features->oPid))
14641471
features->quirks |= WACOM_QUIRK_MULTI_INPUT;
14651472

@@ -1771,33 +1778,43 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
17711778
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
17721779
break;
17731780

1781+
case INTUOSHT:
17741782
case BAMBOO_PT:
17751783
__clear_bit(ABS_MISC, input_dev->absbit);
17761784

1777-
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1778-
17791785
if (features->device_type == BTN_TOOL_FINGER) {
1780-
unsigned int flags = INPUT_MT_POINTER;
17811786

17821787
__set_bit(BTN_LEFT, input_dev->keybit);
17831788
__set_bit(BTN_FORWARD, input_dev->keybit);
17841789
__set_bit(BTN_BACK, input_dev->keybit);
17851790
__set_bit(BTN_RIGHT, input_dev->keybit);
17861791

1787-
if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
1788-
input_set_abs_params(input_dev,
1792+
if (features->touch_max) {
1793+
/* touch interface */
1794+
unsigned int flags = INPUT_MT_POINTER;
1795+
1796+
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1797+
if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
1798+
input_set_abs_params(input_dev,
17891799
ABS_MT_TOUCH_MAJOR,
17901800
0, features->x_max, 0, 0);
1791-
input_set_abs_params(input_dev,
1801+
input_set_abs_params(input_dev,
17921802
ABS_MT_TOUCH_MINOR,
17931803
0, features->y_max, 0, 0);
1804+
} else {
1805+
__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1806+
__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1807+
flags = 0;
1808+
}
1809+
input_mt_init_slots(input_dev, features->touch_max, flags);
17941810
} else {
1795-
__set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1796-
__set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1797-
flags = 0;
1811+
/* buttons/keys only interface */
1812+
__clear_bit(ABS_X, input_dev->absbit);
1813+
__clear_bit(ABS_Y, input_dev->absbit);
1814+
__clear_bit(BTN_TOUCH, input_dev->keybit);
17981815
}
1799-
input_mt_init_slots(input_dev, features->touch_max, flags);
18001816
} else if (features->device_type == BTN_TOOL_PEN) {
1817+
__set_bit(INPUT_PROP_POINTER, input_dev->propbit);
18011818
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
18021819
__set_bit(BTN_TOOL_PEN, input_dev->keybit);
18031820
__set_bit(BTN_STYLUS, input_dev->keybit);
@@ -2194,6 +2211,17 @@ static const struct wacom_features wacom_features_0x300 =
21942211
static const struct wacom_features wacom_features_0x301 =
21952212
{ "Wacom Bamboo One M", WACOM_PKGLEN_BBPEN, 21648, 13530, 1023,
21962213
31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2214+
static const struct wacom_features wacom_features_0x302 =
2215+
{ "Wacom Intuos PT S", WACOM_PKGLEN_BBPEN, 15200, 9500, 1023,
2216+
31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2217+
.touch_max = 16 };
2218+
static const struct wacom_features wacom_features_0x303 =
2219+
{ "Wacom Intuos PT M", WACOM_PKGLEN_BBPEN, 21600, 13500, 1023,
2220+
31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2221+
.touch_max = 16 };
2222+
static const struct wacom_features wacom_features_0x30E =
2223+
{ "Wacom Intuos S", WACOM_PKGLEN_BBPEN, 15200, 9500, 1023,
2224+
31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
21972225
static const struct wacom_features wacom_features_0x6004 =
21982226
{ "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
21992227
0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2329,6 +2357,9 @@ const struct usb_device_id wacom_ids[] = {
23292357
{ USB_DEVICE_WACOM(0x10D) },
23302358
{ USB_DEVICE_WACOM(0x300) },
23312359
{ USB_DEVICE_WACOM(0x301) },
2360+
{ USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) },
2361+
{ USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) },
2362+
{ USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) },
23322363
{ USB_DEVICE_WACOM(0x304) },
23332364
{ USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
23342365
{ USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },

drivers/input/tablet/wacom_wac.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#define WACOM_REPORT_TPCST 16
5555
#define WACOM_REPORT_TPC1FGE 18
5656
#define WACOM_REPORT_24HDT 1
57+
#define WACOM_REPORT_WL 128
5758

5859
/* device quirks */
5960
#define WACOM_QUIRK_MULTI_INPUT 0x0001
@@ -81,6 +82,7 @@ enum {
8182
INTUOSPS,
8283
INTUOSPM,
8384
INTUOSPL,
85+
INTUOSHT,
8486
WACOM_21UX2,
8587
WACOM_22HD,
8688
DTK,

0 commit comments

Comments
 (0)