diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2017-03-27 17:59:27 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-04-06 15:36:37 +0300 |
commit | 187f2bba93816a300018ad7fb0d79175af0643d3 (patch) | |
tree | 302eb22eb3fa4a36222667e72dbb124aaf5bf84a | |
parent | 843c624eef0c198d7052bd527613a5e7350593e4 (diff) | |
download | linux-187f2bba93816a300018ad7fb0d79175af0643d3.tar.xz |
HID: logitech-hidpp: retrieve the HID++ device name when available
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>
-rw-r--r-- | drivers/hid/hid-logitech-hidpp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index db15cfc622c4..b0d2fea7ec56 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -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); |