Corsair Vengeance K90 driver
v3 cover Corsair Vengeance K90 driver
I have split the special functions between backlight and macro functions. This should make it easier to test new devices. I think the macro functions will only be reused with the K95. While backlight is more common feature, though I have no idea it is done with other Corsair hardware.
I have changed most sysfs attributes and LEDs so that the current value is queried from the hardware instead of tracking events. I started this way when I did not know how to read the value, but I think it is better done this way when I can. I don't know how to read the state of the record LED, so this one still use events to update the state.
I removed the color from the LEDs name. I understand it is only necessary when having LEDs with several colors. This way the names will stay the same across different hardware with different backlight color. I don't think it is an useful information here.
I also added event for the MR (macro record) button and profile switch buttons. I think that userspace program may want to know about these events. For example for using profile keys to start some configuration program.
changes in v3:
- query the hardware instead of tracking the value with events when possible (except record_led)
- added quirks for activating special functions (macro functions and backlight)
- allocation of led name use kzalloc instead of devm_kzalloc (free mem when initialization failed)
- renamed led devices (without colors)
- added key codes for record and profile keys
changes in v2:
- Removed the k90_profile class and devices
- Renamed driver for a more generic name ("corsair" driver in hid-corsair.c)
- Fixed led devices clean up (hang when unplugging and led state reset)
- Added dependency on USB and LEDS_CLASS in Kconfig
Clément Vuchener (1):
Add Corsair Vengeance K90 driver
Documentation/ABI/testing/sysfs-driver-hid-corsair | 15 + drivers/hid/Kconfig | 10 + drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-corsair.c | 673 +++++++++++++++++++++ drivers/hid/hid-ids.h | 3 + 6 files changed, 703 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-corsair create mode 100644 drivers/hid/hid-corsair.c
Signature · 1 line
2.4.3
PATCH RESEND v3 1/1 Add Corsair Vengeance K90 driver
This patch implements a HID driver for the Corsair Vengeance K90 keyboard.
It fixes the behaviour of the keys using incorrect HID usage codes and exposes the macro playback mode and current profile to the user space through sysfs attributes. It also adds two LED class devices controlling the "record" LED and the backlight.
--- Documentation/ABI/testing/sysfs-driver-hid-corsair | 15 + drivers/hid/Kconfig | 10 + drivers/hid/Makefile | 1 + drivers/hid/hid-core.c | 1 + drivers/hid/hid-corsair.c | 673 +++++++++++++++++++++ drivers/hid/hid-ids.h | 3 + 6 files changed, 703 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-corsair create mode 100644 drivers/hid/hid-corsair.c
Documentation/ABI/testing/sysfs-driver-hid-corsair new file +15 -0
@@ -0,0 +1,15 @@ +What: /sys/bus/drivers/corsair/<dev>/macro_mode +Date: August 2015 +KernelVersion: 4.2 +Contact: Clement Vuchener <[email protected]> +Description: Get/set the current playback mode. "SW" for software mode + where G-keys triggers their regular key codes. "HW" for + hardware playback mode where the G-keys play their macro + from the on-board memory. + + +What: /sys/bus/drivers/corsair/<dev>/current_profile +Date: August 2015 +KernelVersion: 4.2 +Contact: Clement Vuchener <[email protected]> +Description: Get/set the current selected profile. Values are from 1 to 3.
drivers/hid/Kconfig +10 -0
@@ -171,6 +171,16 @@ config HID_CHICONY ---help--- Support for Chicony Tactical pad. +config HID_CORSAIR + tristate "Corsair devices" + depends on HID && USB && LEDS_CLASS + ---help--- + Support for Corsair devices that are not fully compliant with the + HID standard. + + Supported devices: + - Vengeance K90 + config HID_PRODIKEYS tristate "Prodikeys PC-MIDI Keyboard support" depends on HID && SND
drivers/hid/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_HID_BELKIN) += hid-belkin.o obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o obj-$(CONFIG_HID_CHERRY) += hid-cherry.o obj-$(CONFIG_HID_CHICONY) += hid-chicony.o +obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o obj-$(CONFIG_HID_CP2112) += hid-cp2112.o obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o obj-$(CONFIG_HID_DRAGONRISE) += hid-dr.o
drivers/hid/hid-core.c +1 -0
@@ -1828,6 +1828,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) }, { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
drivers/hid/hid-corsair.c new file +673 -0
673 lines not on this page · raw message
drivers/hid/hid-ids.h +3 -0
@@ -251,6 +251,9 @@#define USB_DEVICE_ID_CODEMERCS_IOW_FIRST 0x1500#define USB_DEVICE_ID_CODEMERCS_IOW_LAST 0x15ff +#define USB_VENDOR_ID_CORSAIR 0x1b1c +#define USB_DEVICE_ID_CORSAIR_K90 0x1b02 +#define USB_VENDOR_ID_CREATIVELABS 0x041e#define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801
Signature · 6 lines
2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Jiri Kosina
maintainerRe: [RESEND PATCH v3 1/1] Add Corsair Vengeance K90 driver
Quoted 8 lines · Clément Vuchener
This patch implements a HID driver for the Corsair Vengeance K90 keyboard.
It fixes the behaviour of the keys using incorrect HID usage codes and exposes the macro playback mode and current profile to the user space through sysfs attributes. It also adds two LED class devices controlling the "record" LED and the backlight.
Signed-off-by Clément Vuchener <[email protected]>
[ ... snip ... ]
drivers/hid/hid-corsair.c line 31
Quoted 5 lines
drivers/hid/hid-corsair.c new file +5
-0+struct k90_led { +struct led_classdev cdev; +int brightness; +struct work_struct work; +int removed;
This could be made bool.
Also the patch subject doesn't really follow the usual format we're using in hid.git.
Otherwise I like the code, thanks a lot for working on the driver. I have fixed the nits above and it's now queued in hid.git#for-4.4/corsair.
Signature · 7 lines
Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html