The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v3 00/14] HID: logitech-hidpp: G920 force-feedback and battery fixes
@ 2026-11-20  8:40 Dmitry Torokhov
  2026-11-20  8:40 ` [PATCH v3 01/14] HID: logitech-hidpp: fix G920 force-feedback initialization timeout Dmitry Torokhov
                   ` (14 more replies)
  0 siblings, 15 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2026-11-20  8:40 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Gideon Heinz
  Cc: Filipe Laíns, Bastien Nocera, Hans de Goede, Edwin Velds,
	Stuart Hayhurst, Andrey Smirnov, linux-input, linux-kernel,
	stable

Per Jiri Kosina's request, the v2 series has been split into this
14-patch bug-fix series targeting v7.4 and a separate 18-patch rework
and cleanup series targeting v7.5. The open-evdev-across-unbind
force-feedback teardown use-after-free (v2 patch 22/33) is now handled
in input core ("Input: destroy force-feedback device on input
unregistration") and has been dropped.

This series starts from Gideon Heinz's report of Logitech G920
force-feedback initialization timing out in v7.3 and addresses several
pre-existing bugs and lifetime races in hid-logitech-hidpp.

The force-feedback and teardown fixes temporarily enable device I/O
around g920_get_config() in hidpp_input_configured(), switch
hidpp_ff_queue_work() to GFP_ATOMIC since callbacks run under the input
event spinlock, drain the G920 FF workqueue before closing the HID
transport on input close, synchronously disable driver work items and
disconnect input devices with device I/O enabled before stopping the
transport on removal and probe failure, avoid storing an ERR_PTR in
battery->ps on registration failure, avoid NULL pointer subtraction in
the HID++ 1.0 consumer keys report fixup, and fix an off-by-one in G920
slot tracking that made the 63rd user effect in slot 64 unusable and
leaked it across reopen.

The transport and battery fixes update hidpp_send_message_sync() to stop
retrying timeouts and transport errors, initialize response buffers
before publishing send_receive_buf to eliminate races with concurrent or
spurious packets, fix HID++ 1.0 battery mileage event parsing and state
updates, properly propagate negative errors in ADC measurement (0x1f20)
queries, mark devices online on unified battery (0x1004) events while
gating 0x1000/0x1004 dispatch, fix K750 solar battery feature lookup and
reconnect handling, and expose and correctly map the charge_type
property for the battery voltage (0x1001) feature.

Note that device removal teardown still has limitations due to how HID
core's hid_device_io_start() and hid_device_io_stop() (via
driver_input_lock) gate both driver raw command/response I/O and
subdriver event forwarding, disabling I/O before .remove() and
hid_disconnect(). For instance, HIDPP_QUIRK_DELAYED_INIT devm-managed
input devices are still unregistered after hid_hw_stop(), and
hidpp_connect_event() publishes hidpp->input before input registration
completes. Resolving these teardown edge cases cleanly will require
follow-up work in HID core and driver input registration.

Thanks.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Changes in v3:
- Split out the 14 bug fixes into this series for v7.4 per Jiri Kosina,
  moving the 18 rework and cleanup patches into a separate series for
  v7.5 and dropping v2 patch 22/33 in favor of input core teardown.
- Collected Tested-by tags from Gideon Heinz on all unchanged patches in
  this series (omitted from patches 12 and 14 which were updated after
  v2 testing).
- Gated event dispatch in hidpp_raw_hidpp_event() on
  HIDPP_CAPABILITY_UNIFIED_BATTERY so 0x1000 and 0x1004 events are
  routed to their respective handlers instead of cross-corrupting
  battery state.
- In hidpp20_battery_map_status_voltage(), set charge_type to unknown
  when status is unknown, to none when discharging, full, or not
  charging, and to standard, fast, or trickle only when charging.
- Reset charge_type to unknown on wireless disconnect in
  hidpp_connect_event().
- Link to v2: https://patch.msgid.link/20261110-hid-logitech-hidpp-v2-0-30743e91d83b@gmail.com

Changes in v2:
- Rebased the series on top of linux-next.
- Collected Tested-by tags from Gideon Heinz for 17 v1 patches (omitted
  from patch 4 where hidpp_remove() was significantly altered).
- Reorganized the series to place all 14 stable bug fixes upfront,
  followed by next refactorings and modernizations.
- Updated hidpp_remove() to enable device I/O while draining work
  items and disconnecting hidinput so in-flight transfers and
  force-feedback teardown can receive device replies (noting that
  complete resolution of delayed-init and transport teardown ordering
  requires follow-up work in HID core).
- Stopped retrying non-busy errors (timeouts and negative transport
  failures) in hidpp_send_message_sync().
- Initialized response buffers before publishing send_receive_buf to
  prevent stale response reads on concurrent or spurious events.
- Fixed HID++ 1.0 battery mileage event parsing to read capacity from
  the correct report byte and update battery state.
- Handled negative transport and timeout errors properly in ADC
  measurement (0x1f20) queries.
- Marked devices online when receiving unified battery (0x1004) events.
- Fixed K750 solar battery feature lookup and reconnect handling.
- Exposed charge_type property for battery voltage (0x1001) feature.
- Link to v1: https://patch.msgid.link/20261109061103.2887636-1-dmitry.torokhov@gmail.com

---
Dmitry Torokhov (14):
      HID: logitech-hidpp: fix G920 force-feedback initialization timeout
      HID: logitech-hidpp: use GFP_ATOMIC in hidpp_ff_queue_work()
      HID: logitech-hidpp: drain G920 FF workqueue before closing transport
      HID: logitech-hidpp: disable works before stopping transport
      HID: logitech-hidpp: do not store ERR_PTR in battery->ps
      HID: logitech-hidpp: avoid NULL subtraction in consumer key report fixup
      HID: logitech-hidpp: fix off-by-one in G920 force-feedback slot tracking
      HID: logitech-hidpp: do not retry timeouts and transport errors in hidpp_send_message_sync()
      HID: logitech-hidpp: initialize response buffer before publishing send_receive_buf
      HID: logitech-hidpp: fix HID++ 1.0 battery mileage event parsing
      HID: logitech-hidpp: handle negative errors in hidpp20_get_adc_measurement_1f20()
      HID: logitech-hidpp: mark device online on unified battery 0x1004 events
      HID: logitech-hidpp: fix K750 solar battery feature lookup and reconnect
      HID: logitech-hidpp: expose charge_type property for battery voltage feature

 drivers/hid/hid-logitech-hidpp.c | 150 ++++++++++++++++++++++++++++-----------
 1 file changed, 107 insertions(+), 43 deletions(-)
---
base-commit: 84abb955b1015477aa11a96e2f3ac1b938b77f48
change-id: 20261110-hid-logitech-hidpp-6884bfb6a348

Thanks.

-- 
Dmitry


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

end of thread, other threads:[~2026-11-20 18:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20  8:40 [PATCH v3 00/14] HID: logitech-hidpp: G920 force-feedback and battery fixes Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 01/14] HID: logitech-hidpp: fix G920 force-feedback initialization timeout Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 02/14] HID: logitech-hidpp: use GFP_ATOMIC in hidpp_ff_queue_work() Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 03/14] HID: logitech-hidpp: drain G920 FF workqueue before closing transport Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 04/14] HID: logitech-hidpp: disable works before stopping transport Dmitry Torokhov
2026-11-20 13:51   ` Jiri Kosina
2026-11-20 18:08     ` Dmitry Torokhov
2026-11-20 18:12       ` Jiri Kosina
2026-11-20  8:40 ` [PATCH v3 05/14] HID: logitech-hidpp: do not store ERR_PTR in battery->ps Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 06/14] HID: logitech-hidpp: avoid NULL subtraction in consumer key report fixup Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 07/14] HID: logitech-hidpp: fix off-by-one in G920 force-feedback slot tracking Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 08/14] HID: logitech-hidpp: do not retry timeouts and transport errors in hidpp_send_message_sync() Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 09/14] HID: logitech-hidpp: initialize response buffer before publishing send_receive_buf Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 10/14] HID: logitech-hidpp: fix HID++ 1.0 battery mileage event parsing Dmitry Torokhov
2026-11-20  8:40 ` [PATCH v3 11/14] HID: logitech-hidpp: handle negative errors in hidpp20_get_adc_measurement_1f20() Dmitry Torokhov
2026-11-20  8:41 ` [PATCH v3 12/14] HID: logitech-hidpp: mark device online on unified battery 0x1004 events Dmitry Torokhov
2026-11-20  8:41 ` [PATCH v3 13/14] HID: logitech-hidpp: fix K750 solar battery feature lookup and reconnect Dmitry Torokhov
2026-11-20  8:41 ` [PATCH v3 14/14] HID: logitech-hidpp: expose charge_type property for battery voltage feature Dmitry Torokhov
2026-11-20 12:14 ` [PATCH v3 00/14] HID: logitech-hidpp: G920 force-feedback and battery fixes Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox