HID: hp: Add support for HyperX headset devices
PATCH v6 1/1 HID: hp: Add support for HyperX headset devices
Introduce a HID driver for HyperX Cloud III Wireless headsets, supporting battery reporting and connection status.
Tested with a HyperX Cloud III Wireless only, for lack of other testable devices.
---
v5 -> v6:
- Initialize USB wireless_status to disconnected in hp_probe() so the sysfs attribute is exposed when the headset is off at boot.
- Call power_supply_changed() after registering the battery in hp_headset_battery_work() in case battery events arrived during registration.
- Document that the headset firmware automatically sends unsolicited battery and charging reports upon connection.
v4 -> v5:
- Rebase onto current hid/for-next to resolve merge conflicts in MAINTAINERS, Kconfig, and Makefile.
- Call hid_hw_open() in probe() and hid_hw_close() in remove() to ensure raw events are received.
- Cancel poll_work before stopping hardware in remove().
- Read drvdata->battery under spinlock in hp_headset_battery_work().
- Explicitly include all required headers.
- Minor style fixes.
v3 -> v4:
- Rename driver to hid-hp.
v2 -> v3:
- Unregister power supply on hid_hw_start() failure in probe() to prevent UAF/resource leak.
v1 -> v2:
- Call hid_hw_stop() before cancelling work queues in remove() to prevent UAF.
- Safe unregistration of power supply using the spinlock in remove() to prevent race conditions.
- Cancel battery_work in the hid_hw_start() error path in probe() to prevent UAF.
- Dynamically allocate power supply names to avoid sysfs naming collisions.
v1: https://lore.kernel.org/linux-input/[email protected]/T/
v2: https://lore.kernel.org/linux-input/[email protected]/T/
v3: https://lore.kernel.org/linux-input/[email protected]/T/
v4: https://lore.kernel.org/linux-input/[email protected]/
v5: https://lore.kernel.org/linux-input/[email protected]/
MAINTAINERS | 6 + drivers/hid/Kconfig | 11 ++ drivers/hid/Makefile | 1 + drivers/hid/hid-hp.c | 407 ++++++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 1 + 5 files changed, 426 insertions(+) create mode 100644 drivers/hid/hid-hp.c
MAINTAINERS +6 -0
@@ -11610,6 +11610,12 @@ F: include/uapi/linux/hid* F: samples/hid/ F: tools/testing/selftests/hid/ +HID HP DRIVER +M: Sofia Schneider <[email protected]> +L: [email protected] +S: Maintained +F: drivers/hid/hid-hp.c + HID HYPERX DRIVER M: Benjamin Blume <[email protected]> L: [email protected]
drivers/hid/Kconfig +11 -0
@@ -1252,6 +1252,17 @@ config GREENASIA_FF (like MANTA Warrior MM816 and SpeedLink Strike2 SL-6635) or adapter and want to enable force feedback support for it. +config HID_HP + tristate "HP HID devices" + depends on USB_HID + select POWER_SUPPLY + help + Support for HP HID devices, including HyperX headsets. + + Say Y here if you would like to enable support for HP HID devices. + To compile this driver as a module, choose M here: the module will be called + hid-hp. + config HID_HYPERV_MOUSE tristate "Microsoft Hyper-V mouse driver" depends on HYPERV_VMBUS
drivers/hid/Makefile +1 -0
@@ -66,6 +66,7 @@ obj-$(CONFIG_HID_GYRATION) += hid-gyration.o obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o obj-$(CONFIG_HID_HOLTEK) += hid-holtek-mouse.o obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o +obj-$(CONFIG_HID_HP) += hid-hp.o obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o obj-$(CONFIG_HID_HYPERX) += hid-hyperx.o obj-$(CONFIG_HID_ICADE) += hid-icade.o
drivers/hid/hid-hp.c new file +407 -0
407 lines not on this page · raw message
drivers/hid/hid-ids.h +1 -0
@@ -710,6 +710,7 @@#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0941 0x0941#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_0641 0x0641#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_1f4a 0x1f4a +#define USB_DEVICE_ID_HP_HYPERX_CLOUD_III_WIRELESS 0x05b7#define USB_VENDOR_ID_HUION 0x256c#define USB_DEVICE_ID_HUION_TABLET 0x006e
Signature · 1 line
2.56.0