]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
HID: logitech-hidpp: retrieve the HID++ device name when available
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Mon, 27 Mar 2017 14:59:27 +0000 (16:59 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 6 Apr 2017 12:36:37 +0000 (14:36 +0200)
hidpp->name can't be null.
Only HID++ 2.0 and above device supports the query.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Tested-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-logitech-hidpp.c

index db15cfc622c49dca1b2e2d300dee6a0badb4d42f..b0d2fea7ec56df2fedf109105c9cee3f5f8bb5ba 100644 (file)
@@ -2443,13 +2443,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
                         hidpp->protocol_major, hidpp->protocol_minor);
        }
 
-       hidpp_initialize_battery(hidpp);
-
-       if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT))
-               /* if HID created the input nodes for us, we can stop now */
-               return;
-
-       if (!hidpp->name || hidpp->name == hdev->name) {
+       if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) {
                name = hidpp_get_device_name(hidpp);
                if (!name) {
                        hid_err(hdev,
@@ -2465,6 +2459,12 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
                hidpp->name = devm_name;
        }
 
+       hidpp_initialize_battery(hidpp);
+
+       if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT))
+               /* if HID created the input nodes for us, we can stop now */
+               return;
+
        input = hidpp_allocate_input(hdev);
        if (!input) {
                hid_err(hdev, "cannot allocate new input device: %d\n", ret);