Skip to content

Commit e6be956

Browse files
spbnickJiri Kosina
authored andcommitted
HID: uclogic: Switch to matching subreport bytes
Switch from matching UC-Logic subreport with a mask to a full value to support detecting Huion HS610 touch dial reports. Those would match the button mask otherwise. Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 8b01309 commit e6be956

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

drivers/hid/hid-uclogic-core.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,12 @@ static int uclogic_raw_event(struct hid_device *hdev,
365365
ARRAY_SIZE(params->pen.subreport_list);
366366
/* Try to match a subreport */
367367
for (subreport = params->pen.subreport_list;
368-
subreport < subreport_list_end &&
369-
(data[1] & subreport->mask) != subreport->mask;
370-
subreport++);
368+
subreport < subreport_list_end; subreport++) {
369+
if (subreport->value != 0 &&
370+
subreport->value == data[1]) {
371+
break;
372+
}
373+
}
371374
/* If a subreport matched */
372375
if (subreport < subreport_list_end) {
373376
/* Change to subreport ID, and restart */

drivers/hid/hid-uclogic-params.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
763763
goto cleanup;
764764
}
765765
/* Link frame button subreports from pen reports */
766-
p.pen.subreport_list[0].mask = 0x20;
766+
p.pen.subreport_list[0].value = 0xe0;
767767
p.pen.subreport_list[0].id =
768768
UCLOGIC_RDESC_BUTTONPAD_V2_ID;
769769
goto output;
@@ -791,7 +791,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
791791
(found ? "" : " not"));
792792
if (found) {
793793
/* Link frame button subreports from pen reports */
794-
p.pen.subreport_list[0].mask = 0x20;
794+
p.pen.subreport_list[0].value = 0xe0;
795795
p.pen.subreport_list[0].id =
796796
UCLOGIC_RDESC_BUTTONPAD_V1_ID;
797797
}

drivers/hid/hid-uclogic-params.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ extern const char *uclogic_params_pen_inrange_to_str(
3939
*/
4040
struct uclogic_params_pen_subreport {
4141
/*
42-
* The subreport's bitmask matching the second byte of the pen report.
43-
* If zero, the subreport is considered invalid, and won't match.
42+
* The value of the second byte of the pen report indicating this
43+
* subreport. If zero, the subreport should be considered invalid and
44+
* not matched.
4445
*/
45-
__u8 mask;
46+
__u8 value;
4647

4748
/*
48-
* The ID to be assigned to the report, if the "mask" matches.
49-
* Only valid if "mask" is not zero.
49+
* The ID to be assigned to the report, if the second byte of the pen
50+
* report is equal to "value". Only valid if "value" is not zero.
5051
*/
5152
__u8 id;
5253
};
@@ -200,7 +201,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
200201
(_params)->pen.desc_ptr, \
201202
(_params)->pen.desc_size, \
202203
(_params)->pen.id, \
203-
(_params)->pen.subreport_list[0].mask, \
204+
(_params)->pen.subreport_list[0].value, \
204205
(_params)->pen.subreport_list[0].id, \
205206
uclogic_params_pen_inrange_to_str((_params)->pen.inrange), \
206207
((_params)->pen.fragmented_hires ? "true" : "false"), \

0 commit comments

Comments
 (0)