Skip to content

Commit 606dadc

Browse files
spbnickJiri Kosina
authored andcommitted
HID: uclogic: Remove pen usage masking
Remove support for pen usage masking from hid-uclogic. Disable whole interfaces instead. Most of those interfaces are useless, and if there is one which has an unused pen usage, but also has useful reports, its report descriptor should be rewritten instead. This simplifies the code and the data structures. 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 044fa81 commit 606dadc

3 files changed

Lines changed: 7 additions & 54 deletions

File tree

drivers/hid/hid-uclogic-core.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,6 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
8181
return rdesc;
8282
}
8383

84-
static int uclogic_input_mapping(struct hid_device *hdev,
85-
struct hid_input *hi,
86-
struct hid_field *field,
87-
struct hid_usage *usage,
88-
unsigned long **bit,
89-
int *max)
90-
{
91-
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
92-
struct uclogic_params *params = &drvdata->params;
93-
94-
/* discard the unused pen interface */
95-
if (params->pen_unused && (field->application == HID_DG_PEN))
96-
return -1;
97-
98-
/* let hid-core decide what to do */
99-
return 0;
100-
}
101-
10284
static int uclogic_input_configured(struct hid_device *hdev,
10385
struct hid_input *hi)
10486
{
@@ -374,9 +356,7 @@ static int uclogic_raw_event(struct hid_device *hdev,
374356
return 0;
375357

376358
/* Tweak pen reports, if necessary */
377-
if (!params->pen_unused &&
378-
(report_id == params->pen.id) &&
379-
(size >= 2)) {
359+
if ((report_id == params->pen.id) && (size >= 2)) {
380360
/* If it's the "virtual" frame controls report */
381361
if (params->frame.id != 0 &&
382362
data[1] & params->pen_frame_flag) {
@@ -464,7 +444,6 @@ static struct hid_driver uclogic_driver = {
464444
.remove = uclogic_remove,
465445
.report_fixup = uclogic_report_fixup,
466446
.raw_event = uclogic_raw_event,
467-
.input_mapping = uclogic_input_mapping,
468447
.input_configured = uclogic_input_configured,
469448
#ifdef CONFIG_PM
470449
.resume = uclogic_resume,

drivers/hid/hid-uclogic-params.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ void uclogic_params_cleanup(struct uclogic_params *params)
514514
{
515515
if (!params->invalid) {
516516
kfree(params->desc_ptr);
517-
if (!params->pen_unused)
518-
uclogic_params_pen_cleanup(&params->pen);
517+
uclogic_params_pen_cleanup(&params->pen);
519518
uclogic_params_frame_cleanup(&params->frame);
520519
memset(params, 0, sizeof(*params));
521520
}
@@ -557,7 +556,7 @@ int uclogic_params_get_desc(const struct uclogic_params *params,
557556
size = 0;
558557

559558
common_present = (params->desc_ptr != NULL);
560-
pen_present = (!params->pen_unused && params->pen.desc_ptr != NULL);
559+
pen_present = (params->pen.desc_ptr != NULL);
561560
frame_present = (params->frame.desc_ptr != NULL);
562561

563562
if (common_present)
@@ -680,21 +679,6 @@ static int uclogic_params_init_with_opt_desc(struct uclogic_params *params,
680679
return rc;
681680
}
682681

683-
/**
684-
* uclogic_params_init_with_pen_unused() - initialize tablet interface
685-
* parameters preserving original reports and generic HID processing, but
686-
* disabling pen usage.
687-
*
688-
* @params: Parameters to initialize (to be cleaned with
689-
* uclogic_params_cleanup()). Not modified in case of
690-
* error. Cannot be NULL.
691-
*/
692-
static void uclogic_params_init_with_pen_unused(struct uclogic_params *params)
693-
{
694-
memset(params, 0, sizeof(*params));
695-
params->pen_unused = true;
696-
}
697-
698682
/**
699683
* uclogic_params_huion_init() - initialize a Huion tablet interface and discover
700684
* its parameters.
@@ -734,8 +718,7 @@ static int uclogic_params_huion_init(struct uclogic_params *params,
734718

735719
/* If it's not a pen interface */
736720
if (bInterfaceNumber != 0) {
737-
/* TODO: Consider marking the interface invalid */
738-
uclogic_params_init_with_pen_unused(&p);
721+
uclogic_params_init_invalid(&p);
739722
goto output;
740723
}
741724

@@ -1033,8 +1016,7 @@ int uclogic_params_init(struct uclogic_params *params,
10331016
uclogic_params_init_invalid(&p);
10341017
}
10351018
} else {
1036-
/* TODO: Consider marking the interface invalid */
1037-
uclogic_params_init_with_pen_unused(&p);
1019+
uclogic_params_init_invalid(&p);
10381020
}
10391021
break;
10401022
case VID_PID(USB_VENDOR_ID_UGEE,
@@ -1056,8 +1038,7 @@ int uclogic_params_init(struct uclogic_params *params,
10561038
if (rc != 0)
10571039
goto cleanup;
10581040
} else {
1059-
/* TODO: Consider marking the interface invalid */
1060-
uclogic_params_init_with_pen_unused(&p);
1041+
uclogic_params_init_invalid(&p);
10611042
}
10621043
break;
10631044
case VID_PID(USB_VENDOR_ID_TRUST,

drivers/hid/hid-uclogic-params.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,9 @@ struct uclogic_params {
138138
* Only valid, if "desc_ptr" is not NULL.
139139
*/
140140
unsigned int desc_size;
141-
/*
142-
* True, if pen usage in report descriptor is invalid, when present.
143-
* Only valid, if "invalid" is false.
144-
*/
145-
bool pen_unused;
146141
/*
147142
* Pen parameters and optional report descriptor part.
148-
* Only valid if "pen_unused" is valid and false.
143+
* Only valid, if "invalid" is false.
149144
*/
150145
struct uclogic_params_pen pen;
151146
/*
@@ -171,7 +166,6 @@ extern int uclogic_params_init(struct uclogic_params *params,
171166
".invalid = %s\n" \
172167
".desc_ptr = %p\n" \
173168
".desc_size = %u\n" \
174-
".pen_unused = %s\n" \
175169
".pen.desc_ptr = %p\n" \
176170
".pen.desc_size = %u\n" \
177171
".pen.id = %u\n" \
@@ -190,7 +184,6 @@ extern int uclogic_params_init(struct uclogic_params *params,
190184
((_params)->invalid ? "true" : "false"), \
191185
(_params)->desc_ptr, \
192186
(_params)->desc_size, \
193-
((_params)->pen_unused ? "true" : "false"), \
194187
(_params)->pen.desc_ptr, \
195188
(_params)->pen.desc_size, \
196189
(_params)->pen.id, \

0 commit comments

Comments
 (0)