Skip to content

Commit 34cc25c

Browse files
committed
adds XP Pen artist 13.3
1 parent 8b228a7 commit 34cc25c

File tree

4 files changed

+164
-2
lines changed

4 files changed

+164
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
obj-m := hid-kye.o hid-uclogic.o hid-polostar.o hid-viewsonic.o
1+
obj-m := hid-kye.o hid-uclogic.o hid-polostar.o hid-viewsonic.o hid-xppen.o
22
hid-uclogic-objs := \
33
hid-uclogic-core.o \
44
hid-uclogic-rdesc.o \
@@ -43,6 +43,7 @@ udev_rules_uninstall:
4343
modules_uninstall:
4444
rm -vf /lib/modules/*/extra/hid-kye.ko \
4545
/lib/modules/*/extra/hid-polostar.ko \
46+
/lib/modules/*/extra/hid-xppen.ko \
4647
/lib/modules/*/extra/hid-uclogic.ko \
4748
/lib/modules/*/extra/hid-viewsonic.ko
4849

hid-ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define USB_DEVICE_ID_UGEE_TABLET_G5 0x0074
5757
#define USB_DEVICE_ID_UGEE_TABLET_EX07S 0x0071
5858
#define USB_DEVICE_ID_UGEE_TABLET_RAINBOW_CV720 0x0055
59+
#define USB_DEVICE_ID_UGEE_XPPEN_ARTIST_133 0x000b
5960

6061
/* ViewSonic Corporation */
6162
#define USB_VENDOR_ID_VIEWSONIC 0x0543

hid-xppen.c

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* Copyright (c) 2019 Gabriel Zöller
4+
*/
5+
6+
/*
7+
* This program is free software; you can redistribute it and/or modify it
8+
* under the terms of the GNU General Public License as published by the Free
9+
* Software Foundation; either version 2 of the License, or (at your option)
10+
* any later version.
11+
*/
12+
13+
#include <linux/device.h>
14+
#include <linux/hid.h>
15+
#include <linux/module.h>
16+
#include <linux/usb.h>
17+
18+
#include "hid-ids.h"
19+
20+
/* Size of the original descriptor of Artist 13.3 tablets */
21+
#define ARTIST133_RDESC_ORIG_SIZE 140
22+
23+
/* Fixed ARTIST133 report descriptor */
24+
static __u8 artist133_rdesc_fixed[] = {
25+
0x05, 0x0D, /* Usage Page (Digitizer), */
26+
0x09, 0x02, /* Usage (Pen), */
27+
0xA1, 0x01, /* Collection (Application), */
28+
0x85, 0x07, /* Report ID (7), */
29+
0x09, 0x20, /* Usage (Stylus), */
30+
0xA1, 0x00, /* Collection (Physical), */
31+
0x09, 0x42, /* Usage (Tip Switch), */
32+
0x09, 0x44, /* Usage (Barrel Switch), */
33+
// changed from eraser to tablet pick
34+
0x09, 0x46, /* Usage (Tablet Pick), */
35+
0x15, 0x00, /* Logical Minimum (0), */
36+
0x25, 0x01, /* Logical Maximum (1), */
37+
0x75, 0x01, /* Report Size (1), */
38+
0x95, 0x03, /* Report Count (3), */
39+
0x81, 0x02, /* Input (Variable), */
40+
0x95, 0x02, /* Report Count (2), */
41+
0x81, 0x03, /* Input (Constant, Variable), */
42+
0x09, 0x32, /* Usage (In Range), */
43+
0x95, 0x01, /* Report Count (1), */
44+
0x81, 0x02, /* Input (Variable), */
45+
0x95, 0x02, /* Report Count (2), */
46+
0x81, 0x03, /* Input (Constant, Variable), */
47+
0x75, 0x10, /* Report Size (16), */
48+
0x95, 0x01, /* Report Count (1), */
49+
0x35, 0x00, /* Physical Minimum (0), */
50+
0xA4, /* Push, */
51+
0x05, 0x01, /* Usage Page (Desktop), */
52+
0x09, 0x30, /* Usage (X), */
53+
0x65, 0x13, /* Unit (Inch), */
54+
0x55, 0x0D, /* Unit Exponent (13), */
55+
0x46, 0x2D, 0x2D, /* Physical Maximum (11565), */
56+
0x27, 0xC0, 0x72, 0x00, 0x00, /* Logical Maximum (29376), */
57+
0x81, 0x02, /* Input (Variable), */
58+
0x09, 0x31, /* Usage (Y), */
59+
0x46, 0x69, 0x19, /* Physical Maximum (6505), */
60+
0x27, 0x8C, 0x40, 0x00, 0x00, /* Logical Maximum (16524), */
61+
0x81, 0x02, /* Input (Variable), */
62+
0xB4, /* Pop, */
63+
0x09, 0x30, /* Usage (Tip Pressure), */
64+
0x45, 0x00, /* Physical Maximum (0), */
65+
0x26, 0xFF, 0x1F, /* Logical Maximum (8191), */
66+
0x81, 0x02, /* Input (Variable), */
67+
0xC0, /* End Collection, */
68+
0xC0, /* End Collection, */
69+
0x09, 0x0E, /* Usage (Configuration), */
70+
0xA1, 0x01, /* Collection (Application), */
71+
0x85, 0x05, /* Report ID (5), */
72+
0x09, 0x23, /* Usage (Device Settings), */
73+
0xA1, 0x02, /* Collection (Logical), */
74+
0x09, 0x52, /* Usage (Device Mode), */
75+
0x09, 0x53, /* Usage (Device Identifier), */
76+
0x25, 0x0A, /* Logical Maximum (10), */
77+
0x75, 0x08, /* Report Size (8), */
78+
0x95, 0x02, /* Report Count (2), */
79+
0xB1, 0x02, /* Feature (Variable), */
80+
0xC0, /* End Collection, */
81+
0xC0, /* End Collection, */
82+
0x05, 0x0C, /* Usage Page (Consumer), */
83+
0x09, 0x36, /* Usage (Function Buttons), */
84+
0xA1, 0x00, /* Collection (Physical), */
85+
0x85, 0x06, /* Report ID (6), */
86+
0x05, 0x09, /* Usage Page (Button), */
87+
0x19, 0x01, /* Usage Minimum (01h), */
88+
0x29, 0x20, /* Usage Maximum (20h), */
89+
0x15, 0x00, /* Logical Minimum (0), */
90+
0x25, 0x01, /* Logical Maximum (1), */
91+
0x95, 0x20, /* Report Count (32), */
92+
0x75, 0x01, /* Report Size (1), */
93+
0x81, 0x02, /* Input (Variable), */
94+
0xC0 /* End Collection */
95+
};
96+
97+
static __u8 *artist133_report_fixup(struct hid_device *hdev, __u8 *rdesc,
98+
unsigned int *rsize)
99+
{
100+
struct usb_interface *iface = to_usb_interface(hdev->dev.parent);
101+
__u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber;
102+
103+
switch (hdev->product) {
104+
case USB_DEVICE_ID_UGEE_XPPEN_ARTIST_133:
105+
if (iface_num == 1 && *rsize == ARTIST133_RDESC_ORIG_SIZE) {
106+
rdesc = artist133_rdesc_fixed;
107+
*rsize = sizeof(artist133_rdesc_fixed);
108+
}
109+
break;
110+
}
111+
112+
return rdesc;
113+
}
114+
115+
static int artist133_probe(struct hid_device *hdev,
116+
const struct hid_device_id *id)
117+
{
118+
struct usb_interface *iface = to_usb_interface(hdev->dev.parent);
119+
__u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber;
120+
int rc;
121+
122+
if (hdev->product == USB_DEVICE_ID_UGEE_XPPEN_ARTIST_133 &&
123+
iface_num == 2)
124+
return -ENODEV;
125+
126+
hdev->quirks |= id->driver_data;
127+
128+
rc = hid_parse(hdev);
129+
if (rc) {
130+
hid_err(hdev, "parse failed\n");
131+
return rc;
132+
}
133+
134+
rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
135+
if (rc) {
136+
hid_err(hdev, "hw start failed\n");
137+
return rc;
138+
}
139+
140+
return 0;
141+
}
142+
143+
static const struct hid_device_id artist133_devices[] = {
144+
{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
145+
USB_DEVICE_ID_UGEE_XPPEN_ARTIST_133),
146+
.driver_data = HID_QUIRK_MULTI_INPUT },
147+
{ }
148+
};
149+
MODULE_DEVICE_TABLE(hid, artist133_devices);
150+
151+
static struct hid_driver xppen_driver = {
152+
.name = "xppen",
153+
.id_table = artist133_devices,
154+
.probe = artist133_probe,
155+
.report_fixup = artist133_report_fixup,
156+
};
157+
module_hid_driver(xppen_driver);
158+
159+
MODULE_LICENSE("GPL");
160+
MODULE_VERSION("10");

xorg.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ EndSection
1313

1414
Section "InputClass"
1515
Identifier "Ugee/XP-Pen tablets with Wacom driver"
16-
MatchUSBID "28bd:007[145]|28bd:0094|28bd:0042|5543:004[57]|5543:0081|5543:0004|5543:3031"
16+
MatchUSBID "28bd:007[145]|28bd:0094|28bd:0042|28bd:000b|5543:004[57]|5543:0081|5543:0004|5543:3031"
1717
MatchDevicePath "/dev/input/event*"
1818
Driver "wacom"
1919
EndSection

0 commit comments

Comments
 (0)