Add proper support for Ugee EX07(S) frame controls to hid-uclogic. Signed-off-by: Nikolai Kondrashov <spbnick@xxxxxxxxx> --- drivers/hid/hid-uclogic-params.c | 32 ++++++++++++++++++++++++++++++-- drivers/hid/hid-uclogic-rdesc.c | 27 +++++++++++++++++++++++++++ drivers/hid/hid-uclogic-rdesc.h | 4 ++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 72a073ae454c..b22815cec06d 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -997,8 +997,6 @@ int uclogic_params_init(struct uclogic_params *params, break; case VID_PID(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610): - case VID_PID(USB_VENDOR_ID_UGEE, - USB_DEVICE_ID_UGEE_TABLET_EX07S): /* If this is the pen interface */ if (bInterfaceNumber == 1) { /* Probe v1 pen parameters */ @@ -1015,6 +1013,36 @@ int uclogic_params_init(struct uclogic_params *params, /* TODO: Consider marking the interface invalid */ uclogic_params_init_with_pen_unused(&p); } + break; + case VID_PID(USB_VENDOR_ID_UGEE, + USB_DEVICE_ID_UGEE_TABLET_EX07S): + /* Ignore non-pen interfaces */ + if (bInterfaceNumber != 1) { + uclogic_params_init_invalid(&p); + break; + } + + rc = uclogic_params_pen_init_v1(&p.pen, &found, hdev); + if (rc != 0) { + hid_err(hdev, "pen probing failed: %d\n", rc); + goto cleanup; + } else if (found) { + rc = uclogic_params_frame_init_with_desc( + &p.frame, + uclogic_rdesc_ugee_ex07_buttonpad_arr, + uclogic_rdesc_ugee_ex07_buttonpad_size, + 0); + if (rc != 0) { + hid_err(hdev, + "failed creating buttonpad parameters: %d\n", + rc); + goto cleanup; + } + } else { + hid_warn(hdev, "pen parameters not found"); + uclogic_params_init_invalid(&p); + } + break; } diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c index ef1d3cf918a4..2ab8747e87b7 100644 --- a/drivers/hid/hid-uclogic-rdesc.c +++ b/drivers/hid/hid-uclogic-rdesc.c @@ -701,6 +701,33 @@ const __u8 uclogic_rdesc_buttonpad_v2_arr[] = { const size_t uclogic_rdesc_buttonpad_v2_size = sizeof(uclogic_rdesc_buttonpad_v2_arr); +/* Fixed report descriptor for Ugee EX07 buttonpad */ +const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = { + 0x05, 0x01, /* Usage Page (Desktop), */ + 0x09, 0x07, /* Usage (Keypad), */ + 0xA1, 0x01, /* Collection (Application), */ + 0x85, 0x06, /* Report ID (6), */ + 0x05, 0x0D, /* Usage Page (Digitizer), */ + 0x09, 0x39, /* Usage (Tablet Function Keys), */ + 0xA0, /* Collection (Physical), */ + 0x05, 0x09, /* Usage Page (Button), */ + 0x75, 0x01, /* Report Size (1), */ + 0x19, 0x03, /* Usage Minimum (03h), */ + 0x29, 0x06, /* Usage Maximum (06h), */ + 0x95, 0x04, /* Report Count (4), */ + 0x81, 0x02, /* Input (Variable), */ + 0x95, 0x1A, /* Report Count (26), */ + 0x81, 0x03, /* Input (Constant, Variable), */ + 0x19, 0x01, /* Usage Minimum (01h), */ + 0x29, 0x02, /* Usage Maximum (02h), */ + 0x95, 0x02, /* Report Count (2), */ + 0x81, 0x02, /* Input (Variable), */ + 0xC0, /* End Collection, */ + 0xC0 /* End Collection */ +}; +const size_t uclogic_rdesc_ugee_ex07_buttonpad_size = + sizeof(uclogic_rdesc_ugee_ex07_buttonpad_arr); + /** * uclogic_rdesc_template_apply() - apply report descriptor parameters to a * report descriptor template, creating a report descriptor. Copies the diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h index cc5f3dd3804a..3cb6e1725f43 100644 --- a/drivers/hid/hid-uclogic-rdesc.h +++ b/drivers/hid/hid-uclogic-rdesc.h @@ -131,4 +131,8 @@ extern const size_t uclogic_rdesc_buttonpad_v2_size; /* Report ID for tweaked v2 buttonpad reports */ #define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7 +/* Fixed report descriptor for Ugee EX07 buttonpad */ +extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[]; +extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size; + #endif /* _HID_UCLOGIC_RDESC_H */ -- 2.20.1