Skip to contentSkip to conversation

HID: hyperx-headset: Add support for HyperX headset devices

PATCH Superseded Sofia Schneider 2 participants 2 messages Jun 27 – Aug 3 HID

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 HID: hyperx-headset: 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.

---
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/

 MAINTAINERS                      |   6 +
 drivers/hid/Kconfig              |  11 +
 drivers/hid/Makefile             |   1 +
 drivers/hid/hid-hyperx-headset.c | 399 +++++++++++++++++++++++++++++++
 drivers/hid/hid-ids.h            |   1 +
 5 files changed, 418 insertions(+)
 create mode 100644 drivers/hid/hid-hyperx-headset.c
MAINTAINERS +6 -0
index d8252026bbd4..fa49655255f6 100644
@@ -11419,6 +11419,12 @@ F:	include/uapi/linux/hid*
 F:	samples/hid/
 F:	tools/testing/selftests/hid/
 
+HID HYPERX HEADSET DRIVER
+M:	Sofia Schneider <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hid/hid-hyperx-headset.c
+
 HID LOGITECH DRIVERS
 R:	Filipe Laíns <[email protected]>
 L:	[email protected]
drivers/hid/Kconfig +11 -0
index f9bcaeb66385..e9f5f1f982c9 100644
@@ -1215,6 +1215,17 @@ config HID_HYPERV_MOUSE
 	help
 	Select this option to enable the Hyper-V mouse driver.
 
+config HID_HYPERX_HEADSET
+	tristate "HyperX headset devices"
+	depends on USB_HID
+	select POWER_SUPPLY
+	help
+	Support for HyperX headset devices.
+
+	Say Y here if you would like to enable support for HyperX headset devices.
+	To compile this driver as a module, choose M here: the module will be called
+	hid-hyperx-headset.
+
 config HID_SMARTJOYPLUS
 	tristate "SmartJoy PLUS PS2/USB adapter support"
 	help
drivers/hid/Makefile +1 -0
index 23e6e3dd0c56..9f3fd2c21837 100644
@@ -67,6 +67,7 @@ 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_HYPERV_MOUSE)	+= hid-hyperv.o
+obj-$(CONFIG_HID_HYPERX_HEADSET)	+= hid-hyperx-headset.o
 obj-$(CONFIG_HID_ICADE)		+= hid-icade.o
 obj-$(CONFIG_HID_ITE)		+= hid-ite.o
 obj-$(CONFIG_HID_JABRA)		+= hid-jabra.o
drivers/hid/hid-hyperx-headset.c new file +399 -0

399 lines not on this page · raw message

drivers/hid/hid-ids.h +1 -0
index 1059922baaac..aa2c3a71315b 100644
@@ -696,6 +696,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.54.0
maintainer
#1 lore raw
Quoted 7 lines · Sofia Schneider

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.

Sofia,

thanks for the patch. We've traditionally been naming HID driver by the vendor (and not per device ... and yes, I am aware of all the exceptions that violate this :) ), i.e. in this case that would probably be just hid-hp, as far as I understand? Could you please adjust that and resubmit?

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs