Skip to contentSkip to conversation

Corsair Vengeance K90 driver

PATCH Superseded Clément Vuchener 1 participant 3 messages Sep 7, 2015 – Sep 9, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Corsair Vengeance K90 driver

I removed the k90_profile class completely. I cannot write a good enough ABI with what I know of the keyboard so I am leaving that part out of the kernel. If I change my mind in the future, it will be done in another patch.

I also fixed a bug I had when unregistering the led device. Work was being scheduled after the led device was unregistered.

On the name change, I kept a lot of K90 references. As far as I know, the only similar keyboard is the K60 that shares the same firmware but does not have all the special keys and backlight, and for which the hid-generic driver should be enough. The more recent RGB keyboard series uses a different protocol from what I have seen from the unofficial userspace driver (CKB from MSC).

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                          | 555 +++++++++++++++++++++
 drivers/hid/hid-ids.h                              |   3 +
 6 files changed, 585 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-corsair
 create mode 100644 drivers/hid/hid-corsair.c
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
#1 lore raw

PATCH v2 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                          | 555 +++++++++++++++++++++
 drivers/hid/hid-ids.h                              |   3 +
 6 files changed, 585 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
new file mode 100644
index 0000000..b8827f0
@@ -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
index 6ab51ae..3fe9678 100644
@@ -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
index e6441bc..edaa0f2 100644
@@ -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
index bcd914a..d5fc4d1 100644
@@ -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 +555 -0

555 lines not on this page · raw message

drivers/hid/hid-ids.h +3 -0
index f769208..45a61e6 100644
@@ -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
#2 lore raw
In reply to Clément Vuchener
Quoted 5 lines · Clément Vuchener

I removed the k90_profile class completely. I cannot write a good enough ABI with what I know of the keyboard so I am leaving that part out of the kernel. If I change my mind in the future, it will be done in another patch.

I also fixed a bug I had when unregistering the led device. Work was being scheduled after the led device was unregistered.

On the name change, I kept a lot of K90 references. As far as I know, the only similar keyboard is the K60 that shares the same firmware but does not have all the special keys and backlight, and for which the hid-generic driver should be enough. The more recent RGB keyboard series uses a different protocol from what I have seen from the unofficial userspace driver (CKB from MSC).

Actually, I may have been wrong, other keyboard may share at least the incorrect HID usage code part. I will investigate more and send a new patch. I am still interested in comments on this one, especially on the choice of key codes for the programmable keys.

Quoted 23 lines

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                          | 555 +++++++++++++++++++++
 drivers/hid/hid-ids.h                              |   3 +
 6 files changed, 585 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