Skip to contentSkip to conversation

HID: uclogic: Add XP-Pen Artist 12 (2nd Gen) support

PATCH Applied Bartosz Barc 2 participants 4 messages Oct 6 – Nov 19 HID

lore
Share & tools
lore
#0 lore raw

cover HID: uclogic: Add XP-Pen Artist 12 (2nd Gen) support

From: Bartosz Paweł Barc <[email protected]>

This series adds support for the XP-Pen Artist 12 (2nd Gen) (28bd:094a) graphics tablet, which is currently not recognized by hid-uclogic and handled by the generic driver.

It utilises the existing UGEE v2 initialization that is also used by other similar tablets. The second patch also adds support for the previously missing stylus invert detection. This affects the shared UGEE v2 pen report template array; while it only reclaims a previously ignored padding bit and should not affect devices without this feature, I don't have access to other UGEE v2 hardware and additional testing would be appreciated.

The tablet & pen have been verified to be fully working with libinput and libwacom, and the relevant .tablet file will be submitted to the libwacom project.

Bartosz Paweł Barc (2):
HID: uclogic: Add support for XP-Pen Artist 12 (2nd Gen)
HID: uclogic: Report stylus invert state for UGEE v2 devices

 drivers/hid/hid-ids.h            | 1 +
 drivers/hid/hid-uclogic-core.c   | 2 ++
 drivers/hid/hid-uclogic-params.c | 2 ++
 drivers/hid/hid-uclogic-rdesc.c  | 7 ++++---
 4 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.56.0
#1 lore raw

PATCH 1/2 HID: uclogic: Add support for XP-Pen Artist 12 (2nd Gen)

From: Bartosz Paweł Barc <[email protected]>

The XP-Pen Artist 12 (2nd Gen) (28bd:094a) uses the same probe protocol used by other supported UGEE tablets, but is currently handled by the generic driver. Add the device's USB ID and make it use the existing uclogic_params_ugee_v2_init() instead to enable the correct recognition of the device and its capabilities.

Tested on the actual hardware; pen X/Y, pressure, tilt and pad buttons all report correctly.

---
 drivers/hid/hid-ids.h            | 1 +
 drivers/hid/hid-uclogic-core.c   | 2 ++
 drivers/hid/hid-uclogic-params.c | 2 ++
 3 files changed, 5 insertions(+)
drivers/hid/hid-ids.h +1 -0
index a9537b7bb03d..2166d4ed6e14 100644
@@ -1555,6 +1555,7 @@
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S	0x0909
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_SW	0x0933
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06	0x0078
+#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_ARTIST12_GEN2	0x094a
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_22R_PRO	0x091b
 #define USB_DEVICE_ID_UGEE_XPPEN_TABLET_24_PRO	0x092d
 #define USB_DEVICE_ID_UGEE_TABLET_G5		0x0074
drivers/hid/hid-uclogic-core.c +2 -0
index 0b8a83fa6c5b..5c43647a299d 100644
@@ -629,6 +629,8 @@ static const struct hid_device_id uclogic_devices[] = {
 		.driver_data = UCLOGIC_MOUSE_FRAME_QUIRK | UCLOGIC_BATTERY_QUIRK },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
+				USB_DEVICE_ID_UGEE_XPPEN_TABLET_ARTIST12_GEN2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
 				USB_DEVICE_ID_UGEE_XPPEN_TABLET_22R_PRO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_UGEE,
drivers/hid/hid-uclogic-params.c +2 -0
index ed16f50f21ed..7176b2950512 100644
@@ -1903,6 +1903,8 @@ int uclogic_params_init(struct uclogic_params *params,
 		     USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_MW):
 	case VID_PID(USB_VENDOR_ID_UGEE,
 		     USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_S):
+	case VID_PID(USB_VENDOR_ID_UGEE,
+		     USB_DEVICE_ID_UGEE_XPPEN_TABLET_ARTIST12_GEN2):
 	case VID_PID(USB_VENDOR_ID_UGEE,
 		     USB_DEVICE_ID_UGEE_XPPEN_TABLET_DECO_PRO_SW):
 		rc = uclogic_params_ugee_v2_init(&p, hdev);
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/2 HID: uclogic: Report stylus invert state for UGEE v2 devices

In reply to Bartosz Barc

From: Bartosz Paweł Barc <[email protected]>

Captured raw reports from the XP-Pen Artist 12 (2nd Gen) show that the first of the two bits immediately after Tip Switch, Barrel Switch, Tablet Pick (one that is currently declared as padding) is set whenever the stylus is flipped to the eraser end, and otherwise is set to zero:

hovering, nib: 1010 0000
pressing, nib: 1010 0001
hovering, eraser: 1010 1000
pressing, eraser: 1010 1001

Declare that bit as Usage (Invert) from the Digitizer page, which already gets mapped to BTN_TOOL_RUBBER.

This field is part of the shared uclogic_rdesc_ugee_v2_pen_template_arr template used by multiple devices. As this change only reclaims a padding bit, it should not affect devices that do not support this feature, assuming their hardware leaves that bit as a zero. I have only tested this with the XP-Pen Artist 12 (2nd Gen), so further testing with other UGEE v2 devices would be appreciated.

---
 drivers/hid/hid-uclogic-rdesc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/hid/hid-uclogic-rdesc.c +4 -3
index a1b31511b625..186beca6a26a 100644
@@ -878,13 +878,14 @@ const __u8 uclogic_rdesc_ugee_v2_pen_template_arr[] = {
 	0x09, 0x42,         /*          Usage (Tip Switch),             */
 	0x09, 0x44,         /*          Usage (Barrel Switch),          */
 	0x09, 0x46,         /*          Usage (Tablet Pick),            */
+	0x09, 0x3c,         /*          Usage (Invert),                 */
 	0x75, 0x01,         /*          Report Size (1),                */
-	0x95, 0x03,         /*          Report Count (3),               */
+	0x95, 0x04,         /*          Report Count (4),               */
 	0x14,               /*          Logical Minimum (0),            */
 	0x25, 0x01,         /*          Logical Maximum (1),            */
 	0x81, 0x02,         /*          Input (Variable),               */
-	0x95, 0x02,         /*          Report Count (2),               */
-	0x81, 0x03,         /*          Input (Constant, Variable),     */
+	0x95, 0x01,         /*          Report Count (1),               */
+	0x81, 0x03,         /*          Input (Constant),               */
 	0x09, 0x32,         /*          Usage (In Range),               */
 	0x95, 0x01,         /*          Report Count (1),               */
 	0x81, 0x02,         /*          Input (Variable),               */
Signature · 1 line
2.56.0
maintainer Applied
#3 lore raw
In reply to Bartosz Barc
Quoted 14 lines · Bartosz Barc

From: Bartosz Pawe=C5=82 Barc <[email protected]>

This series adds support for the XP-Pen Artist 12 (2nd Gen) (28bd:094a) graphics tablet, which is currently not recognized by hid-uclogic and handled by the generic driver.

It utilises the existing UGEE v2 initialization that is also used by other similar tablets. The second patch also adds support for the previously missing stylus invert detection. This affects the shared UGEE v2 pen report template array; while it only reclaims a previously ignored padding bit and should not affect devices without this feature, I don't have access to other UGEE v2 hardware and additional testing would be appreciated.

Quoted 3 lines

The tablet & pen have been verified to be fully working with libinput and libwacom, and the relevant .tablet file will be submitted to the libwacom project.

Applied to hid.git#for-7.5/uclogic.

Signature · 2 lines
Jiri Kosina
SUSE Labs