Skip to content

Commit 14b71e6

Browse files
JoseExpositoJiri Kosina
authored andcommitted
HID: uclogic: Add frame type quirk
The report descriptor used to get information about UGEE v2 devices is incorrect in the XP-PEN Deco Pro SW. It indicates that the device frame is of type UCLOGIC_PARAMS_FRAME_BUTTONS but the device has a frame of type UCLOGIC_PARAMS_FRAME_MOUSE. Here is the original report descriptor: 0x0e 0x03 0xc8 0xb3 0x34 0x65 0x08 0x00 0xff 0x1f 0xd8 0x13 0x00 0x00 ^ This byte should be 2 Add a quirk to be able to fix the reported frame type. Tested-by: Mia Kanashi <[email protected]> Tested-by: Andreas Grosse <[email protected]> Signed-off-by: José Expósito <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent d264dd3 commit 14b71e6

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

drivers/hid/hid-uclogic-core.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,6 @@
2222

2323
#include "hid-ids.h"
2424

25-
/* Driver data */
26-
struct uclogic_drvdata {
27-
/* Interface parameters */
28-
struct uclogic_params params;
29-
/* Pointer to the replacement report descriptor. NULL if none. */
30-
__u8 *desc_ptr;
31-
/*
32-
* Size of the replacement report descriptor.
33-
* Only valid if desc_ptr is not NULL
34-
*/
35-
unsigned int desc_size;
36-
/* Pen input device */
37-
struct input_dev *pen_input;
38-
/* In-range timer */
39-
struct timer_list inrange_timer;
40-
/* Last rotary encoder state, or U8_MAX for none */
41-
u8 re_state;
42-
};
43-
4425
/**
4526
* uclogic_inrange_timeout - handle pen in-range state timeout.
4627
* Emulate input events normally generated when pen goes out of range for
@@ -202,6 +183,7 @@ static int uclogic_probe(struct hid_device *hdev,
202183
}
203184
timer_setup(&drvdata->inrange_timer, uclogic_inrange_timeout, 0);
204185
drvdata->re_state = U8_MAX;
186+
drvdata->quirks = id->driver_data;
205187
hid_set_drvdata(hdev, drvdata);
206188

207189
/* Initialize the device and retrieve interface parameters */

drivers/hid/hid-uclogic-params.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params,
12981298
struct hid_device *hdev)
12991299
{
13001300
int rc = 0;
1301+
struct uclogic_drvdata *drvdata;
13011302
struct usb_interface *iface;
13021303
__u8 bInterfaceNumber;
13031304
const int str_desc_len = 12;
@@ -1316,6 +1317,7 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params,
13161317
goto cleanup;
13171318
}
13181319

1320+
drvdata = hid_get_drvdata(hdev);
13191321
iface = to_usb_interface(hdev->dev.parent);
13201322
bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber;
13211323

@@ -1382,6 +1384,9 @@ static int uclogic_params_ugee_v2_init(struct uclogic_params *params,
13821384
p.pen.subreport_list[0].id = UCLOGIC_RDESC_V1_FRAME_ID;
13831385

13841386
/* Initialize the frame interface */
1387+
if (drvdata->quirks & UCLOGIC_MOUSE_FRAME_QUIRK)
1388+
frame_type = UCLOGIC_PARAMS_FRAME_MOUSE;
1389+
13851390
switch (frame_type) {
13861391
case UCLOGIC_PARAMS_FRAME_DIAL:
13871392
case UCLOGIC_PARAMS_FRAME_MOUSE:

drivers/hid/hid-uclogic-params.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <linux/usb.h>
2020
#include <linux/hid.h>
2121

22+
#define UCLOGIC_MOUSE_FRAME_QUIRK BIT(0)
23+
2224
/* Types of pen in-range reporting */
2325
enum uclogic_params_pen_inrange {
2426
/* Normal reports: zero - out of proximity, one - in proximity */
@@ -215,6 +217,27 @@ struct uclogic_params {
215217
struct uclogic_params_frame frame_list[3];
216218
};
217219

220+
/* Driver data */
221+
struct uclogic_drvdata {
222+
/* Interface parameters */
223+
struct uclogic_params params;
224+
/* Pointer to the replacement report descriptor. NULL if none. */
225+
__u8 *desc_ptr;
226+
/*
227+
* Size of the replacement report descriptor.
228+
* Only valid if desc_ptr is not NULL
229+
*/
230+
unsigned int desc_size;
231+
/* Pen input device */
232+
struct input_dev *pen_input;
233+
/* In-range timer */
234+
struct timer_list inrange_timer;
235+
/* Last rotary encoder state, or U8_MAX for none */
236+
u8 re_state;
237+
/* Device quirks */
238+
unsigned long quirks;
239+
};
240+
218241
/* Initialize a tablet interface and discover its parameters */
219242
extern int uclogic_params_init(struct uclogic_params *params,
220243
struct hid_device *hdev);

0 commit comments

Comments
 (0)