Skip to content

Commit

Permalink
HID: logitech-hidpp: retrieve the HID++ device name when available
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bentiss authored and Jiri Kosina committed Apr 6, 2017
1 parent 843c624 commit 187f2bb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/hid/hid-logitech-hidpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 187f2bb

Please sign in to comment.