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>
This commit is contained in:
Benjamin Tissoires 2017-03-27 16:59:27 +02:00 committed by Jiri Kosina
parent 843c624eef
commit 187f2bba93
1 changed files with 7 additions and 7 deletions

View File

@ -2443,13 +2443,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
hidpp->protocol_major, hidpp->protocol_minor); hidpp->protocol_major, hidpp->protocol_minor);
} }
hidpp_initialize_battery(hidpp); if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) {
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) {
name = hidpp_get_device_name(hidpp); name = hidpp_get_device_name(hidpp);
if (!name) { if (!name) {
hid_err(hdev, hid_err(hdev,
@ -2465,6 +2459,12 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
hidpp->name = devm_name; 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); input = hidpp_allocate_input(hdev);
if (!input) { if (!input) {
hid_err(hdev, "cannot allocate new input device: %d\n", ret); hid_err(hdev, "cannot allocate new input device: %d\n", ret);