diff options
author | José Expósito <jose.exposito89@gmail.com> | 2022-08-15 16:29:54 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2022-08-25 10:26:31 +0200 |
commit | 387dcab73f10bdc8a1e9b59626d2ccadcfb93f91 (patch) | |
tree | 13a5c33998d23ef590bbb3eba2910700231fef2a /drivers/hid/hid-uclogic-params.c | |
parent | HID: uclogic: Add support for UGEE v2 dial frames (diff) | |
download | linux-387dcab73f10bdc8a1e9b59626d2ccadcfb93f91.tar.xz linux-387dcab73f10bdc8a1e9b59626d2ccadcfb93f91.zip |
HID: uclogic: Add support for UGEE v2 mouse frames
Add the required HID descriptors and the initialization function for
UGEE v2 frames with a mouse in the frame.
Tested-by: Jouke Witteveen <j.witteveen@gmail.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-uclogic-params.c')
-rw-r--r-- | drivers/hid/hid-uclogic-params.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c index 950615f95abc..648abda13a73 100644 --- a/drivers/hid/hid-uclogic-params.c +++ b/drivers/hid/hid-uclogic-params.c @@ -1190,6 +1190,28 @@ static int uclogic_params_ugee_v2_init_frame_dial(struct uclogic_params *p, } /** + * uclogic_params_ugee_v2_init_frame_mouse() - initialize a UGEE v2 frame with a + * mouse. + * @p: Parameters to fill in, cannot be NULL. + * + * Returns: + * Zero, if successful. A negative errno code on error. + */ +static int uclogic_params_ugee_v2_init_frame_mouse(struct uclogic_params *p) +{ + int rc = 0; + + if (!p) + return -EINVAL; + + rc = uclogic_params_frame_init_with_desc(&p->frame_list[1], + uclogic_rdesc_ugee_v2_frame_mouse_template_arr, + uclogic_rdesc_ugee_v2_frame_mouse_template_size, + UCLOGIC_RDESC_V1_FRAME_ID); + return rc; +} + +/** * uclogic_params_ugee_v2_init() - initialize a UGEE graphics tablets by * discovering their parameters. * @@ -1232,6 +1254,15 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params, iface = to_usb_interface(hdev->dev.parent); bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; + + if (bInterfaceNumber == 0) { + rc = uclogic_params_ugee_v2_init_frame_mouse(&p); + if (rc) + goto cleanup; + + goto output; + } + if (bInterfaceNumber != 2) { uclogic_params_init_invalid(&p); goto output; |