提交 e6be956f 编写于 作者: N Nikolai Kondrashov 提交者: Jiri Kosina

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: NNikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: NJosé Expósito <jose.exposito89@gmail.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 8b013098
...@@ -365,9 +365,12 @@ static int uclogic_raw_event(struct hid_device *hdev, ...@@ -365,9 +365,12 @@ static int uclogic_raw_event(struct hid_device *hdev,
ARRAY_SIZE(params->pen.subreport_list); ARRAY_SIZE(params->pen.subreport_list);
/* Try to match a subreport */ /* Try to match a subreport */
for (subreport = params->pen.subreport_list; for (subreport = params->pen.subreport_list;
subreport < subreport_list_end && subreport < subreport_list_end; subreport++) {
(data[1] & subreport->mask) != subreport->mask; if (subreport->value != 0 &&
subreport++); subreport->value == data[1]) {
break;
}
}
/* If a subreport matched */ /* If a subreport matched */
if (subreport < subreport_list_end) { if (subreport < subreport_list_end) {
/* Change to subreport ID, and restart */ /* Change to subreport ID, and restart */
......
...@@ -763,7 +763,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, ...@@ -763,7 +763,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
goto cleanup; goto cleanup;
} }
/* Link frame button subreports from pen reports */ /* Link frame button subreports from pen reports */
p.pen.subreport_list[0].mask = 0x20; p.pen.subreport_list[0].value = 0xe0;
p.pen.subreport_list[0].id = p.pen.subreport_list[0].id =
UCLOGIC_RDESC_BUTTONPAD_V2_ID; UCLOGIC_RDESC_BUTTONPAD_V2_ID;
goto output; goto output;
...@@ -791,7 +791,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params, ...@@ -791,7 +791,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
(found ? "" : " not")); (found ? "" : " not"));
if (found) { if (found) {
/* Link frame button subreports from pen reports */ /* Link frame button subreports from pen reports */
p.pen.subreport_list[0].mask = 0x20; p.pen.subreport_list[0].value = 0xe0;
p.pen.subreport_list[0].id = p.pen.subreport_list[0].id =
UCLOGIC_RDESC_BUTTONPAD_V1_ID; UCLOGIC_RDESC_BUTTONPAD_V1_ID;
} }
......
...@@ -39,14 +39,15 @@ extern const char *uclogic_params_pen_inrange_to_str( ...@@ -39,14 +39,15 @@ extern const char *uclogic_params_pen_inrange_to_str(
*/ */
struct uclogic_params_pen_subreport { struct uclogic_params_pen_subreport {
/* /*
* The subreport's bitmask matching the second byte of the pen report. * The value of the second byte of the pen report indicating this
* If zero, the subreport is considered invalid, and won't match. * subreport. If zero, the subreport should be considered invalid and
* not matched.
*/ */
__u8 mask; __u8 value;
/* /*
* The ID to be assigned to the report, if the "mask" matches. * The ID to be assigned to the report, if the second byte of the pen
* Only valid if "mask" is not zero. * report is equal to "value". Only valid if "value" is not zero.
*/ */
__u8 id; __u8 id;
}; };
...@@ -200,7 +201,7 @@ extern int uclogic_params_init(struct uclogic_params *params, ...@@ -200,7 +201,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
(_params)->pen.desc_ptr, \ (_params)->pen.desc_ptr, \
(_params)->pen.desc_size, \ (_params)->pen.desc_size, \
(_params)->pen.id, \ (_params)->pen.id, \
(_params)->pen.subreport_list[0].mask, \ (_params)->pen.subreport_list[0].value, \
(_params)->pen.subreport_list[0].id, \ (_params)->pen.subreport_list[0].id, \
uclogic_params_pen_inrange_to_str((_params)->pen.inrange), \ uclogic_params_pen_inrange_to_str((_params)->pen.inrange), \
((_params)->pen.fragmented_hires ? "true" : "false"), \ ((_params)->pen.fragmented_hires ? "true" : "false"), \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册