summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-uclogic-core.c
diff options
context:
space:
mode:
authorNikolai Kondrashov <spbnick@gmail.com>2022-04-21 19:50:51 +0200
committerJiri Kosina <jkosina@suse.cz>2022-05-06 08:34:31 +0200
commitf5927973f8d667eb93b81f796039c0ef94449866 (patch)
tree685aa35749ca499111453f0f4383c8b0f1ec0e52 /drivers/hid/hid-uclogic-core.c
parentd64a6e4460d6415df37590ecb76fad6bd5f2c8a6 (diff)
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: Nikolai Kondrashov <spbnick@gmail.com> Signed-off-by: José Expósito <jose.exposito89@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-uclogic-core.c')
-rw-r--r--drivers/hid/hid-uclogic-core.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index 627f1d0c52f2..8ef3d1830052 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -81,6 +81,24 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *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,
struct hid_input *hi)
{
@@ -515,6 +533,7 @@ static struct hid_driver uclogic_driver = {
.remove = uclogic_remove,
.report_fixup = uclogic_report_fixup,
.raw_event = uclogic_raw_event,
+ .input_mapping = uclogic_input_mapping,
.input_configured = uclogic_input_configured,
#ifdef CONFIG_PM
.resume = uclogic_resume,