Commit f5927973 authored by Nikolai Kondrashov's avatar Nikolai Kondrashov Committed by Jiri Kosina

HID: uclogic: Support disabling pen usage

Restore the ability to disable pen usage in hid-uclogic to support e.g.
keyboard interfaces which also have pen usages for some reason, but
which we don't want to rewrite report descriptors for.
Signed-off-by: default avatarNikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent d64a6e44
...@@ -81,6 +81,24 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, ...@@ -81,6 +81,24 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
return rdesc; return rdesc;
} }
static int uclogic_input_mapping(struct hid_device *hdev,
struct hid_input *hi,
struct hid_field *field,
struct hid_usage *usage,
unsigned long **bit,
int *max)
{
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
struct uclogic_params *params = &drvdata->params;
/* Discard invalid pen usages */
if (params->pen.usage_invalid && (field->application == HID_DG_PEN))
return -1;
/* Let hid-core decide what to do */
return 0;
}
static int uclogic_input_configured(struct hid_device *hdev, static int uclogic_input_configured(struct hid_device *hdev,
struct hid_input *hi) struct hid_input *hi)
{ {
...@@ -515,6 +533,7 @@ static struct hid_driver uclogic_driver = { ...@@ -515,6 +533,7 @@ static struct hid_driver uclogic_driver = {
.remove = uclogic_remove, .remove = uclogic_remove,
.report_fixup = uclogic_report_fixup, .report_fixup = uclogic_report_fixup,
.raw_event = uclogic_raw_event, .raw_event = uclogic_raw_event,
.input_mapping = uclogic_input_mapping,
.input_configured = uclogic_input_configured, .input_configured = uclogic_input_configured,
#ifdef CONFIG_PM #ifdef CONFIG_PM
.resume = uclogic_resume, .resume = uclogic_resume,
......
...@@ -61,6 +61,11 @@ struct uclogic_params_pen_subreport { ...@@ -61,6 +61,11 @@ struct uclogic_params_pen_subreport {
* Noop (preserving functionality) when filled with zeroes. * Noop (preserving functionality) when filled with zeroes.
*/ */
struct uclogic_params_pen { struct uclogic_params_pen {
/*
* True if pen usage is invalid for this interface and should be
* ignored, false otherwise.
*/
bool usage_invalid;
/* /*
* Pointer to report descriptor part describing the pen inputs. * Pointer to report descriptor part describing the pen inputs.
* Allocated with kmalloc. NULL if the part is not specified. * Allocated with kmalloc. NULL if the part is not specified.
...@@ -214,6 +219,7 @@ extern int uclogic_params_init(struct uclogic_params *params, ...@@ -214,6 +219,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
".desc_ptr = %p\n" \ ".desc_ptr = %p\n" \
".desc_size = %u\n" \ ".desc_size = %u\n" \
".pen = {\n" \ ".pen = {\n" \
"\t.usage_invalid = %s\n" \
"\t.desc_ptr = %p\n" \ "\t.desc_ptr = %p\n" \
"\t.desc_size = %u\n" \ "\t.desc_size = %u\n" \
"\t.id = %u\n" \ "\t.id = %u\n" \
...@@ -270,6 +276,7 @@ extern int uclogic_params_init(struct uclogic_params *params, ...@@ -270,6 +276,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
((_params)->invalid ? "true" : "false"), \ ((_params)->invalid ? "true" : "false"), \
(_params)->desc_ptr, \ (_params)->desc_ptr, \
(_params)->desc_size, \ (_params)->desc_size, \
((_params)->pen.usage_invalid ? "true" : "false"), \
(_params)->pen.desc_ptr, \ (_params)->pen.desc_ptr, \
(_params)->pen.desc_size, \ (_params)->pen.desc_size, \
(_params)->pen.id, \ (_params)->pen.id, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment