linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: logitech-hidpp: Do not assume FAP in hidpp_send_message_sync()
@ 2025-10-02 19:30 Mavroudis Chatzilazaridis
  2025-10-02 23:14 ` Stuart
  2025-10-14  9:55 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Mavroudis Chatzilazaridis @ 2025-10-02 19:30 UTC (permalink / raw)
  To: jikos; +Cc: stuart.a.hayhurst, linux-input, bentiss, hadess, lains, mavchatz

Currently, hidpp_send_message_sync() retries sending the message when the
device returns a busy error code, specifically HIDPP20_ERROR_BUSY, which
has a different meaning under RAP. This ends up being a problem because
this function is used for both FAP and RAP messages.

This issue is not noticeable on older receivers with unreachable devices
since they return HIDPP_ERROR_RESOURCE_ERROR (0x09), which is not equal to
HIDPP20_ERROR_BUSY (0x08).

However, newer receivers return HIDPP_ERROR_UNKNOWN_DEVICE (0x08) which
happens to equal to HIDPP20_ERROR_BUSY, causing unnecessary retries when
the device is not actually busy.

This is resolved by checking if the error response is FAP or RAP and
picking the respective ERROR_BUSY code.

Fixes: 60165ab774cb ("HID: logitech-hidpp: rework one more time the retries attempts")
Signed-off-by: Mavroudis Chatzilazaridis <mavchatz@protonmail.com>
---
 drivers/hid/hid-logitech-hidpp.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index aaef405a717e..524afc797917 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -350,10 +350,15 @@ static int hidpp_send_message_sync(struct hidpp_device *hidpp,
 
 	do {
 		ret = __do_hidpp_send_message_sync(hidpp, message, response);
-		if (ret != HIDPP20_ERROR_BUSY)
+		if (response->report_id == REPORT_ID_HIDPP_SHORT &&
+		    ret != HIDPP_ERROR_BUSY)
+			break;
+		if ((response->report_id == REPORT_ID_HIDPP_LONG ||
+		     response->report_id == REPORT_ID_HIDPP_VERY_LONG) &&
+		    ret != HIDPP20_ERROR_BUSY)
 			break;
 
-		dbg_hid("%s:got busy hidpp 2.0 error %02X, retrying\n", __func__, ret);
+		dbg_hid("%s:got busy hidpp error %02X, retrying\n", __func__, ret);
 	} while (--max_retries);
 
 	mutex_unlock(&hidpp->send_mutex);
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: logitech-hidpp: Do not assume FAP in hidpp_send_message_sync()
  2025-10-02 19:30 [PATCH] HID: logitech-hidpp: Do not assume FAP in hidpp_send_message_sync() Mavroudis Chatzilazaridis
@ 2025-10-02 23:14 ` Stuart
  2025-10-14  9:55 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Stuart @ 2025-10-02 23:14 UTC (permalink / raw)
  To: Mavroudis Chatzilazaridis; +Cc: jikos, linux-input, bentiss, hadess, lains

Tested on 6.17.0 with a handful of other patches:
 - https://lore.kernel.org/all/20250927234834.2635483-1-mavchatz@protonmail.com/
 - https://lore.kernel.org/all/20251002192324.1991349-1-mavchatz@protonmail.com/

No regressions on my Logitech G915 TKL keyboard
No regressions on my Logitech G502 Lightspeed Wireless mouse

Tested-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com>

Thanks,
Stuart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: logitech-hidpp: Do not assume FAP in hidpp_send_message_sync()
  2025-10-02 19:30 [PATCH] HID: logitech-hidpp: Do not assume FAP in hidpp_send_message_sync() Mavroudis Chatzilazaridis
  2025-10-02 23:14 ` Stuart
@ 2025-10-14  9:55 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2025-10-14  9:55 UTC (permalink / raw)
  To: Mavroudis Chatzilazaridis
  Cc: stuart.a.hayhurst, linux-input, bentiss, hadess, lains

On Thu, 2 Oct 2025, Mavroudis Chatzilazaridis wrote:

> Currently, hidpp_send_message_sync() retries sending the message when the
> device returns a busy error code, specifically HIDPP20_ERROR_BUSY, which
> has a different meaning under RAP. This ends up being a problem because
> this function is used for both FAP and RAP messages.
> 
> This issue is not noticeable on older receivers with unreachable devices
> since they return HIDPP_ERROR_RESOURCE_ERROR (0x09), which is not equal to
> HIDPP20_ERROR_BUSY (0x08).
> 
> However, newer receivers return HIDPP_ERROR_UNKNOWN_DEVICE (0x08) which
> happens to equal to HIDPP20_ERROR_BUSY, causing unnecessary retries when
> the device is not actually busy.
> 
> This is resolved by checking if the error response is FAP or RAP and
> picking the respective ERROR_BUSY code.
> 
> Fixes: 60165ab774cb ("HID: logitech-hidpp: rework one more time the retries attempts")
> Signed-off-by: Mavroudis Chatzilazaridis <mavchatz@protonmail.com>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-14  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 19:30 [PATCH] HID: logitech-hidpp: Do not assume FAP in hidpp_send_message_sync() Mavroudis Chatzilazaridis
2025-10-02 23:14 ` Stuart
2025-10-14  9:55 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).