* [PATCH] HID: logitech-dj: Re-announce connected devices on reset-resume
@ 2026-10-18 22:46 Mark Pariente
2026-10-18 23:26 ` [PATCH v2 0/2] HID: logitech-dj: Restore device configuration after reset-resume Mark Pariente
0 siblings, 1 reply; 4+ messages in thread
From: Mark Pariente @ 2026-10-18 22:46 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: Filipe Laíns, linux-input, linux-kernel, Mark Pariente, stable
If a receiver is reset on resume, for example because a USB KVM switch
moved it to another host while the system was suspended, its paired
devices may have reconnected to it while the host was not listening.
The connection notification the receiver queued for the host is lost
in the USB reset, so hid-logitech-hidpp never re-runs its connect
handling for the device.
Devices drop host-configured state when they reconnect, so whatever
hidpp configured on connect is silently lost. The most visible case is
HID++ 2.0 hi-res scrolling: the mouse reverts to low-resolution wheel
reports while hidpp keeps scaling them by the hi-res multiplier, so
scrolling becomes extremely slow (1/15 of the normal speed on an MX
Master 3) until the receiver is replugged or the mouse power cycled.
logi_dj_reset_resume() only switches the receiver back to DJ mode. Also
ask the receiver to re-announce its connected devices with the HID++
"fake device arrival" request, which is already used to query paired
devices on non-DJ receivers, and which Solaar sends to all receivers on
startup. The resulting connect notifications are forwarded to the
existing child devices, whose drivers then reconfigure them.
Reproduced with an MX Master 3 on a Unifying receiver (046d:c52b)
behind a USB KVM switch: suspend, switch the KVM away and back, move
the mouse while the host is still suspended, then resume. Without this
change the wheel stays in low-res mode with the hi-res multiplier
applied; with it, hidpp re-enables hi-res scrolling after resume.
Fixes: 534a7b8e10ec ("HID: Add full support for Logitech Unifying receivers")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=203421
Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/528
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Mark Pariente <markpariente@gmail.com>
---
Tested on Fedora's 7.2.11 kernel, with this change applied to the v7.2
driver and loaded as an out-of-tree module. Only tested with a Unifying
receiver (046d:c52b) and an MX Master 3; Lightspeed, Nano and 27 MHz
receivers were not tested. Investigation, patch and changelog were
drafted with an LLM coding assistant, then reviewed and tested by me.
drivers/hid/hid-logitech-dj.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 6e8db01d27ec..cdb20fdc7b21 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -2010,6 +2010,16 @@ static int logi_dj_reset_resume(struct hid_device *hdev)
return 0;
logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0);
+
+ /*
+ * Paired devices may have reconnected and lost their configuration
+ * (e.g. hi-res scrolling) while the receiver was unpowered or switched
+ * away by a KVM. Have the receiver re-announce connected devices so
+ * the child drivers run their connect handling again.
+ */
+ if (djrcv_dev->dj_mode && logi_dj_recv_query_hidpp_devices(djrcv_dev))
+ hid_err(hdev, "%s: failed to query connected devices\n", __func__);
+
return 0;
}
base-commit: ae6927c533a4454570950125ca8ba909c45f20f9
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 0/2] HID: logitech-dj: Restore device configuration after reset-resume
2026-10-18 22:46 [PATCH] HID: logitech-dj: Re-announce connected devices on reset-resume Mark Pariente
@ 2026-10-18 23:26 ` Mark Pariente
2026-10-18 23:26 ` [PATCH v2 1/2] HID: logitech-dj: Don't add Unifying devices from HID++ notifications Mark Pariente
2026-10-18 23:26 ` [PATCH v2 2/2] HID: logitech-dj: Re-announce connected devices on reset-resume Mark Pariente
0 siblings, 2 replies; 4+ messages in thread
From: Mark Pariente @ 2026-10-18 23:26 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: Filipe Laíns, linux-input, linux-kernel, stable, Mark Pariente
When a Unifying receiver is reset on resume, for example because a USB
KVM switch moved it to another host while the system was suspended,
devices that reconnected in the meantime lose their configuration. The
most visible case is HID++ hi-res scrolling, which leaves the wheel
about 15x slower. Patch 2 has the receiver re-announce its connected
devices on reset-resume so that hidpp reconfigures them.
Sashiko pointed out that on Unifying receivers the re-announce can also
hit slots without a known device, and that HID++ connect notifications
then add those devices with an incomplete report descriptor. That can
already happen today, e.g. when Solaar sends the same request on
startup, so patch 1 fixes it separately: on Unifying receivers, unknown
slots are enumerated through DJ notifications instead.
Changes in v2:
- New patch 1/2: don't add devices from HID++ connect notifications on
Unifying receivers (reported by Sashiko).
- Patch 2/2: code unchanged; the commit message notes the dependency
on 1/2.
- v1: https://lore.kernel.org/linux-input/20261018224627.60328-1-markpariente@gmail.com/
Testing:
- Both patches applied to the v7.2 driver and loaded as an out-of-tree
module on Fedora's 7.2.11 kernel, with an MX Master 3 on a Unifying
receiver (046d:c52b) behind a USB KVM switch. Devices enumerate
normally, and hi-res scrolling is restored after the reset-resume
reproducer described in patch 2.
- The unknown-slot case fixed by patch 1 could not be reproduced here,
because this KVM switch fully disconnects the receiver, so it was
verified by code inspection only.
- Lightspeed, Nano and 27 MHz receivers were not tested; patch 1 does
not change their behaviour, and patch 2 sends them the request
logi_dj_recv_query_paired_devices() already uses for them.
- The investigation, patches and changelogs were drafted with an LLM
coding assistant, then reviewed and tested by me.
Mark Pariente (2):
HID: logitech-dj: Don't add Unifying devices from HID++ notifications
HID: logitech-dj: Re-announce connected devices on reset-resume
drivers/hid/hid-logitech-dj.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
base-commit: ae6927c533a4454570950125ca8ba909c45f20f9
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] HID: logitech-dj: Don't add Unifying devices from HID++ notifications
2026-10-18 23:26 ` [PATCH v2 0/2] HID: logitech-dj: Restore device configuration after reset-resume Mark Pariente
@ 2026-10-18 23:26 ` Mark Pariente
2026-10-18 23:26 ` [PATCH v2 2/2] HID: logitech-dj: Re-announce connected devices on reset-resume Mark Pariente
1 sibling, 0 replies; 4+ messages in thread
From: Mark Pariente @ 2026-10-18 23:26 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: Filipe Laíns, linux-input, linux-kernel, stable, Mark Pariente
Unifying receivers (recvr_type_dj) announce paired devices through DJ
"device paired" notifications, which carry the full bitmask of reports
the device supports. Before commit 74808f9115ce ("HID: logitech-dj: add
support for non unifying receivers"), HID++ reports for a slot without
a known device were dropped. That commit made HID++ 0x41 "device
connected" notifications for such slots create the device instead, so
that non-DJ receivers, which do not send DJ pairing notifications, can
be supported. This also applies to Unifying receivers.
For Unifying receivers this produces a broken device. The HID++
notification only identifies the device type, and
logi_hidpp_dev_conn_notif_equad() only sets reports for keyboards and
mice. Unifying trackballs, touchpads, numpads and presenters get an
empty report descriptor, so no driver can bind to them, and keyboards
with a built-in touchpad such as the K400 lose their mouse reports.
Since the slot is then populated, the correct DJ pairing notification
for it is ignored until the receiver is unplugged.
This happens whenever such a notification arrives for a slot the driver
does not know about yet, for example after the receiver was probed
while a KVM switch had focus on another host, or after a device was
paired while the receiver was switched away. HID++ connect
notifications are sent when a device reconnects, and when userspace
(e.g. Solaar on startup) asks the receiver to re-announce its devices.
On Unifying receivers, queue the unknown-device work instead, which
enumerates the paired devices through DJ notifications.
Fixes: 74808f9115ce ("HID: logitech-dj: add support for non unifying receivers")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Mark Pariente <markpariente@gmail.com>
---
drivers/hid/hid-logitech-dj.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 6e8db01d27ec..383c762c503f 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -1766,7 +1766,13 @@ static int logi_dj_hidpp_event(struct hid_device *hdev,
if (dj_dev) {
logi_dj_recv_forward_report(dj_dev, data, size);
} else {
- if (hidpp_report->sub_id == REPORT_TYPE_NOTIF_DEVICE_CONNECTED)
+ /*
+ * DJ receivers announce devices through DJ pairing
+ * notifications, which carry the full list of supported
+ * reports, so query those instead.
+ */
+ if (djrcv_dev->type != recvr_type_dj &&
+ hidpp_report->sub_id == REPORT_TYPE_NOTIF_DEVICE_CONNECTED)
logi_hidpp_recv_queue_notif(hdev, hidpp_report);
else
logi_dj_recv_queue_unknown_work(djrcv_dev);
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] HID: logitech-dj: Re-announce connected devices on reset-resume
2026-10-18 23:26 ` [PATCH v2 0/2] HID: logitech-dj: Restore device configuration after reset-resume Mark Pariente
2026-10-18 23:26 ` [PATCH v2 1/2] HID: logitech-dj: Don't add Unifying devices from HID++ notifications Mark Pariente
@ 2026-10-18 23:26 ` Mark Pariente
1 sibling, 0 replies; 4+ messages in thread
From: Mark Pariente @ 2026-10-18 23:26 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires
Cc: Filipe Laíns, linux-input, linux-kernel, stable, Mark Pariente
If a receiver is reset on resume, for example because a USB KVM switch
moved it to another host while the system was suspended, its paired
devices may have reconnected to it while the host was not listening.
The connection notification the receiver queued for the host is lost
in the USB reset, so hid-logitech-hidpp never re-runs its connect
handling for the device.
Devices drop host-configured state when they reconnect, so whatever
hidpp configured on connect is silently lost. The most visible case is
HID++ 2.0 hi-res scrolling: the mouse reverts to low-resolution wheel
reports while hidpp keeps scaling them by the hi-res multiplier, so
scrolling becomes extremely slow (1/15 of the normal speed on an MX
Master 3) until the receiver is replugged or the mouse power cycled.
logi_dj_reset_resume() only switches the receiver back to DJ mode. Also
ask the receiver to re-announce its connected devices with the HID++
"fake device arrival" request, which is already used to query paired
devices on non-DJ receivers, and which Solaar sends to all receivers on
startup. The resulting connect notifications are forwarded to the
existing child devices, whose drivers then reconfigure them.
On Unifying receivers, slots without a known device are then
enumerated through DJ notifications; this depends on the previous
patch, which stops HID++ connect notifications from adding them.
Reproduced with an MX Master 3 on a Unifying receiver (046d:c52b)
behind a USB KVM switch: suspend, switch the KVM away and back, move
the mouse while the host is still suspended, then resume. Without this
change the wheel stays in low-res mode with the hi-res multiplier
applied; with it, hidpp re-enables hi-res scrolling after resume.
Fixes: 534a7b8e10ec ("HID: Add full support for Logitech Unifying receivers")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=203421
Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/528
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Mark Pariente <markpariente@gmail.com>
---
drivers/hid/hid-logitech-dj.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 383c762c503f..4230c47713ee 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -2016,6 +2016,16 @@ static int logi_dj_reset_resume(struct hid_device *hdev)
return 0;
logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0);
+
+ /*
+ * Paired devices may have reconnected and lost their configuration
+ * (e.g. hi-res scrolling) while the receiver was unpowered or switched
+ * away by a KVM. Have the receiver re-announce connected devices so
+ * the child drivers run their connect handling again.
+ */
+ if (djrcv_dev->dj_mode && logi_dj_recv_query_hidpp_devices(djrcv_dev))
+ hid_err(hdev, "%s: failed to query connected devices\n", __func__);
+
return 0;
}
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-18 23:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18 22:46 [PATCH] HID: logitech-dj: Re-announce connected devices on reset-resume Mark Pariente
2026-10-18 23:26 ` [PATCH v2 0/2] HID: logitech-dj: Restore device configuration after reset-resume Mark Pariente
2026-10-18 23:26 ` [PATCH v2 1/2] HID: logitech-dj: Don't add Unifying devices from HID++ notifications Mark Pariente
2026-10-18 23:26 ` [PATCH v2 2/2] HID: logitech-dj: Re-announce connected devices on reset-resume Mark Pariente
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®