HID: uclogic: Add support for the XP-PEN Artist 24 Pro
PATCH 1/1 HID: uclogic: Add support for the XP-PEN Artist 24 Pro
The tablet is similar to the 22R Pro, but with a few annoying differences. Its descriptors are bigger because of the tablet's split coordinate system, I guess it's just that large. Thankfully, this is easy enough to support as all we have to do is shift bytes around.
To help code re-use, I changed the signature of uclogic_params_init_ugee_xppen_pro to accept a pen descriptor so we didn't create yet-another initialization function.
I have been testing this locally for a month or so and it works great, and also corroborated this with a few other testers. Since this touches my 22R Pro code, I have tested and checked that it didn't regress that device.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-uclogic-core.c | 19 +++++ drivers/hid/hid-uclogic-params.c | 47 +++++++++--- drivers/hid/hid-uclogic-params.h | 5 ++ drivers/hid/hid-uclogic-rdesc.c | 125 +++++++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.h | 8 ++ 6 files changed, 194 insertions(+), 11 deletions(-)
drivers/hid/hid-ids.h +1 -0
@@ -1414,6 +1414,7 @@#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_22R_PRO 0x091b +#define USB_DEVICE_ID_UGEE_XPPEN_TABLET_24_PRO 0x092d#define USB_DEVICE_ID_UGEE_TABLET_G5 0x0074#define USB_DEVICE_ID_UGEE_TABLET_EX07S 0x0071#define USB_DEVICE_ID_UGEE_TABLET_RAINBOW_CV720 0x0055
drivers/hid/hid-uclogic-core.c +19 -0
@@ -362,6 +362,23 @@ static int uclogic_raw_event_pen(struct uclogic_drvdata *drvdata, data[8 ] = pressure_low_byte; data[9 ] = pressure_high_byte; } +if (size ==12 && pen->fragmented_hires2) { +// 00 00 when on the left side, 01 00 in the right +// we move these to the end of the x coord (u16) to create a correct x coord (u32) +u8 lsb_low_byte = data[10 ]; +u8 lsb_high_byte = data[11 ]; + +// shift everything right by 2 bytes, to make space for the moved lsb + data[11 ] = data[9 ]; + data[10 ] = data[8 ]; + data[9 ] = data[7 ]; + data[8 ] = data[6 ]; + data[7 ] = data[5 ]; + data[6 ] = data[4 ]; + + data[4 ] = lsb_low_byte; + data[5 ] = lsb_high_byte; + }/* If we need to emulate in-range detection */ if (pen->inrange ==UCLOGIC_PARAMS_PEN_INRANGE_NONE ) {/* Set in-range bit */
@@ -604,6 +621,8 @@ static const struct hid_device_id uclogic_devices[] = { USB_DEVICE_ID_UGEE_XPPEN_TABLET_STAR06) }, { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_XPPEN_TABLET_22R_PRO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_XPPEN_TABLET_24_PRO) }, { } }; MODULE_DEVICE_TABLE(hid, uclogic_devices);
drivers/hid/hid-uclogic-params.c +36 -11
89 lines not on this page · raw message
drivers/hid/hid-uclogic-params.h +5 -0
@@ -103,6 +103,11 @@ struct uclogic_params_pen {* Only valid if "id" is not zero. */ bool tilt_y_flipped; +/* +* True, if reports include fragmented high resolution X coords. +* This moves bytes 10-11 to the LSB of the X coordinate. +*/ +bool fragmented_hires2; };/*
drivers/hid/hid-uclogic-rdesc.c +125 -0
131 lines not on this page · raw message
drivers/hid/hid-uclogic-rdesc.h +8 -0
@@ -214,4 +214,12 @@ extern const size_t uclogic_rdesc_ugee_g5_frame_size;extern const __u8 uclogic_rdesc_xppen_artist_22r_pro_frame_arr[];extern const size_t uclogic_rdesc_xppen_artist_22r_pro_frame_size; +/* Fixed report descriptor for XP-Pen Arist 24 Pro frame */ +extern const __u8 uclogic_rdesc_xppen_artist_24_pro_pen_template_arr[]; +extern const size_t uclogic_rdesc_xppen_artist_24_pro_pen_template_size; + +/* Fixed report descriptor for XP-Pen Arist 24 Pro frame */ +extern const __u8 uclogic_rdesc_xppen_artist_24_pro_frame_arr[]; +extern const size_t uclogic_rdesc_xppen_artist_24_pro_frame_size; +#endif /* _HID_UCLOGIC_RDESC_H */
Signature · 1 line
2.51.0
Quoted 5 lines · Joshua Goins
The tablet is similar to the 22R Pro, but with a few annoying differences. Its descriptors are bigger because of the tablet's split coordinate system, I guess it's just that large. Thankfully, this is easy enough to support as all we have to do is shift bytes around.
Quoted 8 lines
To help code re-use, I changed the signature of
uclogic_params_init_ugee_xppen_proto accept a pen descriptor so we didn't create yet-another initialization function.I have been testing this locally for a month or so and it works great, and also corroborated this with a few other testers. Since this touches my 22R Pro code, I have tested and checked that it didn't regress that device.
Applied to hid.git#for-6.19/uclogic, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs