diff mbox series

HID: logitech-hidpp: Silence intermittent get_battery_capacity errors

Message ID 20191114143046.238711-1-hdegoede@redhat.com (mailing list archive)
State Mainlined
Commit 61005d65b6c7dcf61c19516e6ebe5acc02d2cdda
Delegated to: Jiri Kosina
Headers show
Series HID: logitech-hidpp: Silence intermittent get_battery_capacity errors | expand

Commit Message

Hans de Goede Nov. 14, 2019, 2:30 p.m. UTC
My Logitech M185 (PID:4038) 2.4 GHz wireless HID++ mouse is causing
intermittent errors like these in the log:

[11091.034857] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
[12388.031260] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
[16613.718543] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
[23529.938728] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09

We are already silencing error-code 0x09 (HIDPP_ERROR_RESOURCE_ERROR)
errors in other places, lets do the same in
hidpp20_batterylevel_get_battery_capacity to remove these harmless,
but scary looking errors from the dmesg output.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/hid-logitech-hidpp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jiri Kosina Nov. 15, 2019, 12:19 p.m. UTC | #1
On Thu, 14 Nov 2019, Hans de Goede wrote:

> My Logitech M185 (PID:4038) 2.4 GHz wireless HID++ mouse is causing
> intermittent errors like these in the log:
> 
> [11091.034857] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
> [12388.031260] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
> [16613.718543] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
> [23529.938728] logitech-hidpp-device 0003:046D:4038.0006: hidpp20_batterylevel_get_battery_capacity: received protocol error 0x09
> 
> We are already silencing error-code 0x09 (HIDPP_ERROR_RESOURCE_ERROR)
> errors in other places, lets do the same in
> hidpp20_batterylevel_get_battery_capacity to remove these harmless,
> but scary looking errors from the dmesg output.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/hid/hid-logitech-hidpp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 8e91e2f06cb4..cd9193078525 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -1102,6 +1102,9 @@ static int hidpp20_batterylevel_get_battery_capacity(struct hidpp_device *hidpp,
>  	ret = hidpp_send_fap_command_sync(hidpp, feature_index,
>  					  CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_LEVEL_STATUS,
>  					  NULL, 0, &response);
> +	/* Ignore these intermittent errors */
> +	if (ret == HIDPP_ERROR_RESOURCE_ERROR)
> +		return -EIO;
>  	if (ret > 0) {
>  		hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
>  			__func__, ret);

Applied, thanks Hans.
diff mbox series

Patch

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 8e91e2f06cb4..cd9193078525 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -1102,6 +1102,9 @@  static int hidpp20_batterylevel_get_battery_capacity(struct hidpp_device *hidpp,
 	ret = hidpp_send_fap_command_sync(hidpp, feature_index,
 					  CMD_BATTERY_LEVEL_STATUS_GET_BATTERY_LEVEL_STATUS,
 					  NULL, 0, &response);
+	/* Ignore these intermittent errors */
+	if (ret == HIDPP_ERROR_RESOURCE_ERROR)
+		return -EIO;
 	if (ret > 0) {
 		hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
 			__func__, ret);