aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-uclogic.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2015-03-03 12:44:02 -0500
committerJiri Kosina <jkosina@suse.cz>2015-03-03 15:31:55 -0500
commitcce2dbdf258e6b27b2b100f511531edabb77f427 (patch)
tree7084431de64d9e389e06f2c097682c4b3a066032 /drivers/hid/hid-uclogic.c
parent08177f40bd00cd5232c0508e92a62f69cad9467f (diff)
HID: uclogic: name the input nodes based on their tool
We append "Pen", "Pad", "Mouse", "Keyboard", "Consumer Control" or "System Control" suffix to the appropriate input node to match what the Wacom driver does and be more convenient for the user to know which one is which. Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-uclogic.c')
-rw-r--r--drivers/hid/hid-uclogic.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
index 397f1df05d8b..90e261218e66 100644
--- a/drivers/hid/hid-uclogic.c
+++ b/drivers/hid/hid-uclogic.c
@@ -713,6 +713,51 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
713 return rdesc; 713 return rdesc;
714} 714}
715 715
716static void uclogic_input_configured(struct hid_device *hdev,
717 struct hid_input *hi)
718{
719 char *name;
720 const char *suffix = NULL;
721 struct hid_field *field;
722 size_t len;
723
724 /* no report associated (HID_QUIRK_MULTI_INPUT not set) */
725 if (!hi->report)
726 return;
727
728 field = hi->report->field[0];
729
730 switch (field->application) {
731 case HID_GD_KEYBOARD:
732 suffix = "Keyboard";
733 break;
734 case HID_GD_MOUSE:
735 suffix = "Mouse";
736 break;
737 case HID_GD_KEYPAD:
738 suffix = "Pad";
739 break;
740 case HID_DG_PEN:
741 suffix = "Pen";
742 break;
743 case HID_CP_CONSUMER_CONTROL:
744 suffix = "Consumer Control";
745 break;
746 case HID_GD_SYSTEM_CONTROL:
747 suffix = "System Control";
748 break;
749 }
750
751 if (suffix) {
752 len = strlen(hdev->name) + 2 + strlen(suffix);
753 name = devm_kzalloc(&hi->input->dev, len, GFP_KERNEL);
754 if (name) {
755 snprintf(name, len, "%s %s", hdev->name, suffix);
756 hi->input->name = name;
757 }
758 }
759}
760
716/** 761/**
717 * Enable fully-functional tablet mode and determine device parameters. 762 * Enable fully-functional tablet mode and determine device parameters.
718 * 763 *
@@ -901,6 +946,7 @@ static struct hid_driver uclogic_driver = {
901 .probe = uclogic_probe, 946 .probe = uclogic_probe,
902 .report_fixup = uclogic_report_fixup, 947 .report_fixup = uclogic_report_fixup,
903 .raw_event = uclogic_raw_event, 948 .raw_event = uclogic_raw_event,
949 .input_configured = uclogic_input_configured,
904}; 950};
905module_hid_driver(uclogic_driver); 951module_hid_driver(uclogic_driver);
906 952