Skip to content

Commit 552f12e

Browse files
bentissJiri Kosina
authored andcommitted
HID: logitech-hidpp: 2 fixes in hidpp_root_get_protocol_version()
- remove the constant '1' - when the device is not connected, the protocol error HIDPP_ERROR_RESOURCE_ERROR is raised. We should not warn the user about it because it is somewhat expected as an answer when we check if the device is connected. Signed-off-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 8c9952b commit 552f12e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,16 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)
361361
CMD_ROOT_GET_PROTOCOL_VERSION,
362362
NULL, 0, &response);
363363

364-
if (ret == 1) {
364+
if (ret == HIDPP_ERROR_INVALID_SUBID) {
365365
hidpp->protocol_major = 1;
366366
hidpp->protocol_minor = 0;
367367
return 0;
368368
}
369369

370+
/* the device might not be connected */
371+
if (ret == HIDPP_ERROR_RESOURCE_ERROR)
372+
return -EIO;
373+
370374
if (ret > 0) {
371375
hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
372376
__func__, ret);

0 commit comments

Comments
 (0)