HID: corsair-void: Add Corsair Void headset family driver
PATCH RESEND v4 1/1 HID: corsair-void: Add Corsair Void headset family driver
Introduce a driver for the Corsair Void family of headsets, supporting:
- Battery reporting (power_supply)
- Sidetone setting support
- Physical microphone location reporting
- Headset and receiver firmware version reporting
- Built-in alert triggering
- USB wireless_status
Tested with a Void Pro Wireless, Void Elite Wireless and a Void Elite Wired
---
Just a couple questions about the sysfs attributes:
- Should the sysfs documentation use the implementation date (current), or the date it was submitted?
- Are the attribute names correct? I guessed reasonable names, but if there's a convention I'll correct them
- For cases where the wireless headset is disconnected, microphone_up returns -ENODEV
- Should it be left like that, or deregister the attributes when the headset disconnects?
v3 -> v4:
- Added missing <linux/device.h> include
- Added missing newline, fix indent
- Use hid_hw_raw_request return code directly for wireless sidetone
- Use battery status enum for remaining values
- Use of devm_kasprintf() to create battery string
- Moved corsair_void_request_status error reporting to callers
- Simplified corsair_void_request_status
- Removed battery_struct_size, use sizeof(*battery_data) instead
- Removed unnecessary curly brackets in send_alert_store
v2 -> v3:
- Use __free(kfree) helper to free allocations
- Combined similar condition checks
- Check power_supply was created successfully before saving it
- Removed explicit initialisation of return value in corsair_void_probe
- Use preferred syntax for drvdata's struct allocation size
- Removed named success exit point from driver probe
- Removed unused driver probe exit point
v1 -> v2:
- Added a module author email address
- Removed unused variable (psy_cfg)
- Corrected status request buffer size from 12 bytes to 2 bytes
- Use enums for battery status
- Use kmalloc instead of kzalloc where applicable
- Use __le16 type for cpu_to_le16
- Use DEVICE_ATTR_RO and DEVICE_ATTR_WO to create attributes
- Simplified corsair_void_set_sidetone_wired
- Cleaned up patch description
.../ABI/testing/sysfs-driver-hid-corsair-void | 38 + drivers/hid/Kconfig | 10 + drivers/hid/Makefile | 1 + drivers/hid/hid-corsair-void.c | 829 ++++++++++++++++++ 4 files changed, 878 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-corsair-void create mode 100644 drivers/hid/hid-corsair-void.c
Documentation/ABI/testing/sysfs-driver-hid-corsair-void new file +38 -0
@@ -0,0 +1,38 @@ +What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/fw_version_headset +Date: January 2024 +KernelVersion: 6.12 +Contact: Stuart Hayhurst <[email protected]> +Description: (R) The firmware version of the headset + * Returns -ENODATA if no version was reported + +What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/fw_version_receiver +Date: January 2024 +KernelVersion: 6.12 +Contact: Stuart Hayhurst <[email protected]> +Description: (R) The firmware version of the receiver + +What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/microphone_up +Date: July 2023 +KernelVersion: 6.12 +Contact: Stuart Hayhurst <[email protected]> +Description: (R) Get the physical position of the microphone + * 1 -> Microphone up + * 0 -> Microphone down + +What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/send_alert +Date: July 2023 +KernelVersion: 6.12 +Contact: Stuart Hayhurst <[email protected]> +Description: (W) Play a built-in notification from the headset (0 / 1) + +What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/set_sidetone +Date: December 2023 +KernelVersion: 6.12 +Contact: Stuart Hayhurst <[email protected]> +Description: (W) Set the sidetone volume (0 - sidetone_max) + +What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/sidetone_max +Date: July 2024 +KernelVersion: 6.12 +Contact: Stuart Hayhurst <[email protected]> +Description: (R) Report the maximum sidetone volume
drivers/hid/Kconfig +10 -0
@@ -221,6 +221,16 @@ config HID_CORSAIR - Vengeance K90 - Scimitar PRO RGB +config HID_CORSAIR_VOID + tristate "Corsair Void headsets" + depends on USB_HID + select POWER_SUPPLY + help + Support for Corsair Void headsets. + + Supported devices: + - Corsair Void headsets + config HID_COUGAR tristate "Cougar devices" help
drivers/hid/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o obj-$(CONFIG_HID_CHICONY) += hid-chicony.o obj-$(CONFIG_HID_CMEDIA) += hid-cmedia.o obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o +obj-$(CONFIG_HID_CORSAIR_VOID) += hid-corsair-void.o obj-$(CONFIG_HID_COUGAR) += hid-cougar.o obj-$(CONFIG_HID_CP2112) += hid-cp2112.o obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
drivers/hid/hid-corsair-void.c new file +829 -0
829 lines not on this page · raw message
Signature · 1 line
2.45.2
Jiri Kosina
maintainerQuoted 11 lines · Stuart Hayhurst
Introduce a driver for the Corsair Void family of headsets, supporting:
- Battery reporting (power_supply)
- Sidetone setting support
- Physical microphone location reporting
- Headset and receiver firmware version reporting
- Built-in alert triggering
- USBwireless_statusTested with a Void Pro Wireless, Void Elite Wireless and a Void Elite Wired
Signed-off-by Stuart Hayhurst <[email protected]>
Thanks a lot for working on this! I have one small nit:
[ ... snip ... ]
drivers/hid/Kconfig config HID_CORSAIR · line 233
Quoted 10 lines
drivers/hid/Kconfig +10
-0+config HID_CORSAIR_VOID + tristate "Corsair Void headsets" + depends on USB_HID + select POWER_SUPPLY + help + Support for Corsair Void headsets. + + Supported devices: + - Corsair Void headsets +
As we alreay have general CONFIG_HID_CORSAIR, I think it'd make sense for this driver to be encapsulated under this config option as well (it'd also follow the general practice of HID subsystem, that the drivers are divided per vendor) -- i.e. link hid-corsair-void into the final hid-corsair.ko whenever CONFIG_HID_CORSAIR is selected.
Would you be willing to make that small change, and resubmit for final merge?
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 8 lines
As we alreay have general
CONFIG_HID_CORSAIR, I think it'd make sense for this driver to be encapsulated under this config option as well (it'd also follow the general practice of HID subsystem, that the drivers are divided per vendor) -- i.e. link hid-corsair-void into the final hid-corsair.ko wheneverCONFIG_HID_CORSAIRis selected.Would you be willing to make that small change, and resubmit for final merge?
Sure that makes sense, but I'm not sure how to do that exactly. Is there an example anywhere?
Thanks,
Stuart
Jiri Kosina
maintainerQuoted 11 lines · Stuart
Quoted 8 lines
As we alreay have general
CONFIG_HID_CORSAIR, I think it'd make sense for this driver to be encapsulated under this config option as well (it'd also follow the general practice of HID subsystem, that the drivers are divided per vendor) -- i.e. link hid-corsair-void into the final hid-corsair.ko wheneverCONFIG_HID_CORSAIRis selected.Would you be willing to make that small change, and resubmit for final merge?
Sure that makes sense, but I'm not sure how to do that exactly. Is there an example anywhere?
Just do something like
obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o hid-corsair-void.o
in the Makefile. There are a few HID drivers there doing exactly that. hid-roccat is probably the biggest user of this :)
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs