Bug 233884 - Corsair CORSAIR K70 RGB MK.2 / K63 / K63 Wireless not working
Summary: Corsair CORSAIR K70 RGB MK.2 / K63 / K63 Wireless not working
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-usb mailing list
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2018-12-09 12:43 UTC by Tobias C. Berner
Modified: 2019-08-11 19:34 UTC (History)
3 users (show)

See Also:
koobs: mfc-stable12?
koobs: mfc-stable11?


Attachments
K63 corrected usbconfig dump (555 bytes, text/plain)
2019-03-25 13:21 UTC, David Harrison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias C. Berner freebsd_committer 2018-12-09 12:43:10 UTC
Hi there

I got two Corsair Keyboards with the same behaviour:

* Corsair CORSAIR K70 RGB MK.2 
* Corsair CORSAIR K64 Wireless

I get key events, that but they are completely "wrong" -- for example 'a' will put an 'm'.


> usbconfig -u 1 -a 4 dump_device_desc
ugen1.4: <Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x1b1c
  idProduct = 0x1b49
  bcdDevice = 0x0312
  iManufacturer = 0x0001  <Corsair>
  iProduct = 0x0002  <CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard>
  iSerialNumber = 0x0003  <1200D032AF15842759616ABFF5001BC2>
  bNumConfigurations = 0x0001

> usbconfig -u 0 -a 5 dump_device_desc
ugen0.5: <CORSAIR CORSAIR K63 Wireless Mechanical Gaming Keyboard> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x1b1c
  idProduct = 0x1b45
  bcdDevice = 0x0101
  iManufacturer = 0x0001  <CORSAIR>
  iProduct = 0x0002  <CORSAIR K63 Wireless Mechanical Gaming Keyboard>
  iSerialNumber = 0x0003  <12031026AF15842759616DB0F5001BC2>
  bNumConfigurations = 0x0001



Any hint on how to get them working?

mfg Tobias
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-03-25 13:08:34 UTC
IRC user reports "corsair k63 wired" not working, this issue came up in search.

Suggested user add their comment here, with usbconfig output, and look at enabling usb.*.debug sysctl's to potentially identify more relevant information.

@Tobias Could you do the same (enable usb debug) and include anything relevant as an attachment too please.
Comment 2 Hans Petter Selasky freebsd_committer 2019-03-25 13:11:37 UTC
You might have luck attaching your keyboard through webcamd from ports.

--HPS
Comment 3 David Harrison 2019-03-25 13:14:42 UTC
Further to Kubilay's comment, here is my output from usbconfig for the K63 (wired):

ugen0.1: <Intel EHCI root HUB> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen1.1: <Intel EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: <vendor 0x8087 product 0x0024> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen1.2: <vendor 0x8087 product 0x0024> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.3: <Corsair Corsair Gaming K63 Keyboard> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)
ugen1.3: <Generic Mass Storage Device> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)
[david@thallo ~]$ sudo  usbconfig -u 0 -a 1 dump_device_desc
ugen0.1: <Intel EHCI root HUB> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
 
  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <Intel>
  iProduct = 0x0002  <EHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001
Comment 4 Hans Petter Selasky freebsd_committer 2019-03-25 13:18:26 UTC
You need to type the following:
usbconfig -u 0 -a 3 dump_device_desc

--HPS
Comment 5 David Harrison 2019-03-25 13:21:06 UTC
Created attachment 203127 [details]
K63 corrected usbconfig dump

Sorry for not adding the previous (wrong) dump as an attachment. The corrected version is attached.
Comment 6 Hans Petter Selasky freebsd_committer 2019-03-25 13:31:20 UTC
Try:

kldload usb_quirk

usbconfig -d 0.3 add_quirk UQ_KBD_BOOTPROTO

Then re-plug your device. 

Does it work?

If it works, make a patch like shown here:
https://svnweb.freebsd.org/base?view=revision&revision=329195

--HPS
Comment 7 David Harrison 2019-03-25 14:32:01 UTC
(In reply to Hans Petter Selasky from comment #6)

My /boot/loader.conf now contains:

cuse_load="YES"
hw.usb.quirk.0="0x1b1c 0x1b40 0 0xffff UQ_KBD_BOOTPROTO"

I also loaded the usb_quirk module before rebooting.

Now it works, except for the blinking scroll-lock LED as mentioned in 224592.
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2019-03-25 14:34:47 UTC
(In reply to David Harrison from comment #7)

Adding detail: using usbconfig to apply the quirk didn't work (with device reattach) at run-time, but the addition to loader.conf and the subsequent reboot did
Comment 9 Hans Petter Selasky freebsd_committer 2019-03-25 14:47:02 UTC
If you want this change permanent make a patch for sys/dev/usb 's quirk subsystem.

--HPS
Comment 10 Tobias C. Berner freebsd_committer 2019-03-31 13:58:12 UTC
(In reply to Hans Petter Selasky from comment #6)
Adding the quirk did nothing for the K70 RGB Mk.2 

How can I attach webcamd to try?

mfg Tobias
Comment 11 Hans Petter Selasky freebsd_committer 2019-03-31 15:02:02 UTC
As root, run "webcamd -l" .

Then run the line which corresponds to your device.

--HPS
Comment 12 ali@mashtizadeh.com 2019-08-10 20:00:09 UTC
With regards to the K70 RGB MK.2.  The keyboard works fine inside of the BIOS/EFI and FreeBSD bootloader.  Something during initialization seems wrong.  I have the boot proto quirk set.

Corsair K70 RGB MK.2

Aug 10 15:51:44 market kernel: ugen0.10: <Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard> at usbus0
Aug 10 15:51:44 market kernel: ukbd2 on uhub1
Aug 10 15:51:44 market kernel: ukbd2: <Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard, class 0/0, rev 2.00/3.24, addr 15> on usbus0
Aug 10 15:51:44 market kernel: ukbd_attach: Parsing HID descriptor of 192 bytes
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left control
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right control
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left shift
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right shift
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left alt
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right alt
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left GUI
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right GUI
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Ignoring keyboard event control
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard numlock
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard capslock
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard scrolllock
Aug 10 15:51:44 market kernel: ukbd_attach: Forcing boot protocol
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left control
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right control
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left shift
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right shift
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left alt
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right alt
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found left GUI
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found right GUI
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard event array
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard numlock
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard capslock
Aug 10 15:51:44 market kernel: ukbd_parse_hid: Found keyboard scrolllock
Aug 10 15:51:44 market kernel: ukbd_set_leds: leds=0x00
Aug 10 15:51:44 market syslogd: last message repeated 1 times
Aug 10 15:51:44 market kernel: kbd4 at ukbd2
Aug 10 15:51:44 market kernel: ukbd_set_leds_callback: len=1, id=0
Aug 10 15:51:44 market kernel: uhid3 on uhub1
Aug 10 15:51:44 market kernel: uhid3: <Corsair CORSAIR K70 RGB MK.2 Mechanical Gaming Keyboard, class 0/0, rev 2.00/3.24, addr 15> on usbus0

USBDUMP: Pressing 'a' on both

Corsair:

m15:42:05.751977 usbus0.10 SUBM-INTR-EP=00000081,SPD=FULL,NFR=1,SLEN=0,IVAL=1
 frame[0] READ 64 bytes
15:42:05.751979 usbus0.10 DONE-INTR-EP=00000081,SPD=FULL,NFR=1,SLEN=24,IVAL=1,ERR=0
 frame[0] READ 21 bytes
 0000  01 00 10 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 0010  00 00 00 00 00 -- -- --  -- -- -- -- -- -- -- --  |.....           |
15:42:05.818975 usbus0.10 SUBM-INTR-EP=00000081,SPD=FULL,NFR=1,SLEN=0,IVAL=1
 frame[0] READ 64 bytes
15:42:05.818976 usbus0.10 DONE-INTR-EP=00000081,SPD=FULL,NFR=1,SLEN=24,IVAL=1,ERR=0
 frame[0] READ 21 bytes
 0000  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 0010  00 00 00 00 00 -- -- --  -- -- -- -- -- -- -- --  |.....           |

Another Keyboard:

a15:42:28.670668 usbus0.5 SUBM-INTR-EP=00000081,SPD=LOW,NFR=1,SLEN=0,IVAL=10
 frame[0] READ 8 bytes
15:42:28.670669 usbus0.5 DONE-INTR-EP=00000081,SPD=LOW,NFR=1,SLEN=8,IVAL=10,ERR=0
 frame[0] READ 8 bytes
 0000  00 00 04 00 00 00 00 00  -- -- -- -- -- -- -- --  |........        |
15:42:28.766665 usbus0.5 SUBM-INTR-EP=00000081,SPD=LOW,NFR=1,SLEN=0,IVAL=10
 frame[0] READ 8 bytes
15:42:28.766666 usbus0.5 DONE-INTR-EP=00000081,SPD=LOW,NFR=1,SLEN=8,IVAL=10,ERR=0
 frame[0] READ 8 bytes
 0000  00 00 00 00 00 00 00 00  -- -- -- -- -- -- -- --  |........   

Reading the bug reports from the ckb-next it seems they have added quirks to linux, which add sleeps to some part of the keyboard initialization.
Comment 13 Hans Petter Selasky freebsd_committer 2019-08-10 20:07:20 UTC
Does this keyboard have any firmware that you can upgrade?

Does the keyboard work with webcamd?

--HPS
Comment 14 ali@mashtizadeh.com 2019-08-11 00:02:05 UTC
(In reply to Hans Petter Selasky from comment #13)

Keyboard has the latest firmware

# webcamd -d ugen0.10
Attached to ugen0.10[0]
webcamd: Cannot find USB device

Linux handles this keyboard with the default USB keyboard driver, and not the corsair driver.
Comment 15 Hans Petter Selasky freebsd_committer 2019-08-11 14:56:53 UTC
The BOOT protocol should only use 8-BYTE messages. The other format basically resembles a keyboard bitmap with all possible keys. Eventually we could add support for this format to the FreeBSD UKBD driver. Is this something which you are willing to do?

--HPS
Comment 16 ali@mashtizadeh.com 2019-08-11 19:34:09 UTC
I can look at this after this week.

Yes, it seems to only send in the bit vector format.  I think I understand the decoding.  The bit set is the usage ID in the keyboard page description in the specification.  The modifier key bits are the same then the subsequent bytes are the keys pressed.

The media keys and volume wheel are report id 2 which is a consumer control device and appears to follow spec.  The LED control keys are 3.

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x06,        // Usage (Keyboard)
0xA1, 0x01,        // Collection (Application)
0x85, 0x01,        //   Report ID (1)
0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
0x19, 0xE0,        //   Usage Minimum (0xE0)
0x29, 0xE7,        //   Usage Maximum (0xE7)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x08,        //   Report Count (8)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x19, 0x00,        //   Usage Minimum (0x00)
0x29, 0x97,        //   Usage Maximum (0x97)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x98,        //   Report Count (-104)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x08,        //   Usage Page (LEDs)
0x19, 0x01,        //   Usage Minimum (Num Lock)
0x29, 0x03,        //   Usage Maximum (Scroll Lock)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x03,        //   Report Count (3)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x75, 0x05,        //   Report Size (5)
0x95, 0x01,        //   Report Count (1)
0x91, 0x01,        //   Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection
0x05, 0x0C,        // Usage Page (Consumer)
0x09, 0x01,        // Usage (Consumer Control)
0xA1, 0x01,        // Collection (Application)
0x85, 0x02,        //   Report ID (2)
0x05, 0x0C,        //   Usage Page (Consumer)
0x19, 0x00,        //   Usage Minimum (Unassigned)
0x2A, 0xFF, 0x0F,  //   Usage Maximum (0x0FFF)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x0F,  //   Logical Maximum (4095)
0x75, 0x10,        //   Report Size (16)
0x95, 0x02,        //   Report Count (2)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection
0x06, 0xC0, 0xFF,  // Usage Page (Vendor Defined 0xFFC0)
0x09, 0x02,        // Usage (0x02)
0xA1, 0x01,        // Collection (Application)
0x85, 0x03,        //   Report ID (3)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x95, 0x3F,        //   Report Count (63)
0x75, 0x08,        //   Report Size (8)
0x09, 0x02,        //   Usage (0x02)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection
0x06, 0xC2, 0xFF,  // Usage Page (Vendor Defined 0xFFC2)
0x09, 0x03,        // Usage (0x03)
0xA1, 0x01,        // Collection (Application)
0x85, 0x0E,        //   Report ID (14)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x95, 0x3F,        //   Report Count (63)
0x75, 0x08,        //   Report Size (8)
0x09, 0x03,        //   Usage (0x03)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection
0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x02,        // Usage (Mouse)
0xA1, 0x01,        // Collection (Application)
0x85, 0x05,        //   Report ID (5)
0x09, 0x01,        //   Usage (Pointer)
0xA1, 0x00,        //   Collection (Physical)
0x05, 0x09,        //     Usage Page (Button)
0x19, 0x01,        //     Usage Minimum (0x01)
0x29, 0x20,        //     Usage Maximum (0x20)
0x15, 0x00,        //     Logical Minimum (0)
0x25, 0x01,        //     Logical Maximum (1)
0x95, 0x20,        //     Report Count (32)
0x75, 0x01,        //     Report Size (1)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)
0x09, 0x30,        //     Usage (X)
0x09, 0x31,        //     Usage (Y)
0x16, 0x01, 0x00,  //     Logical Minimum (1)
0x26, 0xFF, 0x7F,  //     Logical Maximum (32767)
0x75, 0x10,        //     Report Size (16)
0x95, 0x02,        //     Report Count (2)
0x81, 0x06,        //     Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x38,        //     Usage (Wheel)
0x15, 0x81,        //     Logical Minimum (-127)
0x25, 0x7F,        //     Logical Maximum (127)
0x75, 0x08,        //     Report Size (8)
0x95, 0x01,        //     Report Count (1)
0x81, 0x06,        //     Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //   End Collection
0xC0,              // End Collection

// 192 bytes