Clément Posted September 11, 2015 Share Posted September 11, 2015 I started to write a linux kernel driver for the K90 but I think it can be interesting for other devices as well, especially the one with special keys using incorrect key codes. In order to do that I need to know more about them and some testers with these devices. Testing and feedback for the K90 is welcome as well. The purpose of this driver is to remap problematic keys and maybe expose some basic settings through sysfs attributes. Current features are: Remapping G keys so they send proper key codes.Remapping profile, brightness and lock keys so they do not send anything.Adding sysfs attributes for the K90: current profile and macro playback mode.Adding LED devices for the backlight and record macro LED (K90 only). I am open to suggestions about these but keep in mind that the ABI should be kept simple. I don't think that writing profile to the on-board memory in the kernel is a good idea, it best done with a user space program. How to install: Download the code from https://github.com/cvuchener/k90-linux-driver/.Check hid-ids.h for your device product id, modify or add it if necessary.Add your device in the "corsair_devices" array (near the end of hid-corsair.c) before the "{}" line, the added line should look something like:{ HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_<your device>) },Compile and install (you need to have your kernel headers and basic compilation tools installed) withmake && sudo make installAdd a udev rule in /etc/udev/rules.d/90-corsair.rulesATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="<your device product id>", GOTO="corsair" GOTO="corsair_end" LABEL="corsair" ACTION=="add", SUBSYSTEM=="hid", ATTRS{bInterfaceNumber}=="00", RUN+="/bin/sh -c 'echo $kernel > /sys/bus/hid/drivers/hid-generic/unbind; echo $kernel > /sys/bus/hid/drivers/corsair/bind'" LABEL="corsair_end"(unplug and) plug the keyboard. As I cannot study myself devices I don't own, I need some informations: Your device vendor id/product id (use lsusb)HID report descriptor from each device, post the output of the following command:for f in /sys/bus/hid/devices/0003\:1B1C\:*/report_descriptor; do echo $f; xxd -g 1 "$f"; doneWhat are the special keys on your device? How do they behave?USB traffic dump when pressing theses keys (use usbmon or wireshark).USB traffic dump from using Corsair software on Windows (use USBPcap). Link to comment Share on other sites More sharing options...
Clément Posted September 15, 2015 Author Share Posted September 15, 2015 I added "rgb" branch in the repo adding the quirk recommended by MSC. I also added the K70 RGB and K95 RGB in the device list for this branch, so you don't need to. Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 OK-installed the K90 driver & am using it now...seems to be normal so far. lsusb reports: Bus 003 Device 008: ID 1b1c:1b0e Corsair for f in /sys/bus/hid/devices/0003\:1B1C\:*/report_descriptor; do echo $f; xxd -g 1 "$f"; done /sys/bus/hid/devices/0003:1B1C:1B0E.001B/report_descriptor 00000000: 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 ..........)...%. 00000010: 75 01 95 08 81 02 75 08 95 01 81 01 05 07 19 00 u.....u......... 00000020: 2a ff 00 15 00 26 ff 00 75 08 95 06 81 00 05 08 *....&..u....... 00000030: 19 01 29 03 25 01 75 01 95 03 91 02 95 05 91 01 ..).%.u......... 00000040: c0 . /sys/bus/hid/devices/0003:1B1C:1B0E.001C/report_descriptor 00000000: 05 0c 09 01 a1 01 05 0c 19 00 2a ff 0f 15 00 26 ..........*....& 00000010: ff 0f 75 10 95 02 81 00 c0 ..u...... /sys/bus/hid/devices/0003:1B1C:1B0E.001D/report_descriptor 00000000: 05 01 09 06 a1 01 05 07 19 e0 29 e7 15 00 25 01 ..........)...%. 00000010: 75 01 95 08 81 02 19 00 29 6f 15 00 25 01 75 01 u.......)o..%.u. 00000020: 95 70 81 02 c0 Opened a GIT ticket & will fire up the XP machine to run the captures with better information today. Edit: First "interesting" key usage--Macro1 (M1) key will take me back to first page of thread & change the backlight color at the same time.....M2 & M3 work as per normal--color change only. Looked at the information for usbmon--looks like Wireshark needs usbmon 1.0 or newer--my system (Debian) is using .8--alternatives or do I need to build the newer version for that capture? It looks like M1 generate a "previous" key, so it needs to be remapped. I will need the HID usage for each special key. You can get the HID reports with usbmon (directly, wireshark is not needed) or "sudo xxd -g 1 -c 8 /dev/hidraw0" (it may be another hidraw device, try others if there is no output with this one). Try every special key (macro profile/record, led button, G keys, ...) and match them with the reports. I add examples to make it clearer. The output of xxd when pressing M1 on the K90: $ sudo xxd -g 1 -c 8 /dev/hidraw0 00000000: 00 00 f1 00 00 00 00 00 ........ 00000008: 00 00 00 00 00 00 00 00 ........ 00000010: 00 00 00 00 00 00 00 00 ........ Or with usbmon: $ sudo usbmon 3331e180 0.700318 C Ii:3:007:1 0:1 8 = 0000f100 00000000 3331e180 0.700373 S Ii:3:007:1 -:1 8 < 3331e180 0.780282 C Ii:3:007:1 0:1 8 = 00000000 00000000 3331e180 0.780316 S Ii:3:007:1 -:1 8 < 1dbb19c0 0.828281 C Ii:3:007:3 0:1 15 = 00000000 00000000 00000000 000000 1dbb19c0 0.828302 S Ii:3:007:3 -:1 15 < 3331e180 0.828306 C Ii:3:007:1 0:1 8 = 00000000 00000000 3331e180 0.828311 S Ii:3:007:1 -:1 8 < The interesting part is the "f1", it is the HID usage code for the M1 key on the K90. Some keys (record, led, meta lock on the K90) may have multiple usage codes depending on the state of the keyboard (record led active, current brightness, ...). Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 OK--I'll get those & Interesting enough--It looks like the G5 key opens Looking Glass mode in Gnome Shell 3.14... Edit: must have been a key combo--not duplicated with only the G5 Key press Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 First capture set: sudo xxd -g 1 -c 8 /dev/hidraw0 [sudo] password for dean: (Key G6) 00000000: 00 00 d5 00 00 00 00 00 ........ 00000008: 00 00 00 00 00 00 00 00 ........ (Key G5) 00000010: 00 00 d4 00 00 00 00 00 ........ 00000018: 00 00 00 00 00 00 00 00 ........ (Key G4) 00000020: 00 00 d3 00 00 00 00 00 ........ 00000028: 00 00 00 00 00 00 00 00 ........ (Key G3) 00000030: 00 00 d2 00 00 00 00 00 ........ 00000038: 00 00 00 00 00 00 00 00 ........ (Key G2) 00000040: 00 00 d1 00 00 00 00 00 ........ 00000048: 00 00 00 00 00 00 00 00 ........ (Key G1) 00000050: 00 00 d0 00 00 00 00 00 ........ 00000058: 00 00 00 00 00 00 00 00 ........ (Key MR on) 00000000: 00 00 f6 00 00 00 00 00 ........ 00000008: 00 00 00 00 00 00 00 00 ........ (Key MR off) 00000010: 00 00 f7 00 00 00 00 00 ........ 00000018: 00 00 00 00 00 00 00 00 ........ (Key M1) 00000020: 00 00 f1 00 00 00 00 00 ........ 00000028: 00 00 00 00 00 00 00 00 ........ 00000030: 00 00 00 00 00 00 00 00 ........ (Key M2) 00000038: 00 00 f2 00 00 00 00 00 ........ 00000040: 00 00 00 00 00 00 00 00 ........ 00000048: 00 00 00 00 00 00 00 00 ........ (Key M3) 00000050: 00 00 f3 00 00 00 00 00 ........ 00000058: 00 00 00 00 00 00 00 00 ........ 00000060: 00 00 00 00 00 00 00 00 ........ (Windows Key Remap on) 00000000: 00 00 f4 00 00 00 00 00 ........ 00000008: 00 00 00 00 00 00 00 00 ........ (Windows Key Remap off) 00000010: 00 00 f5 00 00 00 00 00 ........ 00000018: 00 00 00 00 00 00 00 00 ........ What other keys do you need? Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 Thanks, it is same usage codes that for the K90. You should have a button to change the backlight brightness, I expect the codes will be 0xfa to 0xfd. Can you test the sysfs attributes? Get the current profile: cat /sys/bus/hid/devices/0003\:1B1C\:*/current_profile Switch current profile (2 here): sudo tee /sys/bus/hid/devices/0003\:1B1C\:*/current_profile <<< 2 Values are 1, 2 or 3. Read current backlight brightness: cat /sys/class/leds/0003\:1B1C\:*\:backlight/brightness Change it (switch off with 0 here): sudo tee /sys/class/leds/0003\:1B1C\:*\:backlight/brightness <<< 0 Values are 0 (off) to 3 (brightest). No need to post the output except for error messages. Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 dean@linux:~$ cat /sys/bus/hid/devices/0003\:1B1C\:*/current_profile cat: /sys/bus/hid/devices/0003:1B1C:*/current_profile: No such file or directory dean@linux:~$ sudo tee /sys/bus/hid/devices/0003\:1B1C\:*/current_profile <<< 2 tee: /sys/bus/hid/devices/0003:1B1C:*/current_profile: No such file or directory 2 dean@linux:~$ cat /sys/class/leds/0003\:1B1C\:*\:backlight/brightness cat: /sys/class/leds/0003:1B1C:*:backlight/brightness: No such file or directory dean@linux:~$ sudo tee /sys/class/leds/0003\:1B1C\:*\:backlight/brightness <<< 0 tee: /sys/class/leds/0003:1B1C:*:backlight/brightness: No such file or directory 0 I can goto /sys/bus/hid/devices/0003:1B1C:1B0E.000D & see everything but current_profile Also, /sys/class/leds only has input30::caplock, numlock & scrolllock--no brightness info. I do believe that the K90 driver is installed --where/what do you want me to check next? Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 Either the driver is not loaded or it does not activate the features. Check (with ls -l or readlink), the driver link in the device directory (/sys/bus/hid/devices/0003:1B1C:1B0E.000D or whatever), it should be "corsair". If it is "hid-generic" instead, the driver is not used. Check the installation, check the udev rules (did you write the id correctly?), try reloading udev rules with "sudo udevadm control --reload" (maybe I should add this step in the first post), and replug the keyboard. If the driver is correctly loaded, but the attributes are still not here. Check "dmesg" or "journalctl -k" for warnings/errors about the "corsair" driver (or just use grep: "dmesg | grep corsair"). Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 Brightness button is "interesting...." sudo xxd -g 1 -c 8 /dev/hidraw0 (Dim to Brightness 2) 00000000: 00 00 fc 00 00 00 00 00 ........ 00000008: 00 00 00 00 00 00 00 00 ........ (Brightness 2 to Max) 00000010: 00 00 fd 00 00 00 00 00 ........ 00000018: 00 00 00 00 00 00 00 00 ........ (Max to Brightness off AND shortcut for Gnome Calc??) 00000020: 00 00 fa 00 00 00 00 00 ........ 00000028: 00 00 00 00 00 00 00 00 ........ (Brightness off to Dim) 00000030: 00 00 fb 00 00 00 00 00 ........ 00000038: 00 00 00 00 00 00 00 00 ........ Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 OK--I've not done it right---ID is not correct...What format does the ID need to be? I am loaded as the HID-Generic... lsusb shows Bus 003 Device 007: ID 1b1c:1b0e Corsair Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 ATTRS{idProduct}=="1b0e" In fact, there may be some risk by rebinding all interfaces (if the driver is not loaded because of bad compilation or installation, there won't be any driver for the keyboard). Use this rule instead (I will edit the first post): ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="1b0e", GOTO="corsair" GOTO="corsair_end" LABEL="corsair" ACTION=="add", SUBSYSTEM=="hid", ATTRS{bInterfaceNumber}=="00", RUN+="/bin/sh -c 'echo $kernel > /sys/bus/hid/drivers/hid-generic/unbind; echo $kernel > /sys/bus/hid/drivers/corsair/bind'" LABEL="corsair_end" It only rebinds the first interface (special keys only, and the one where I add the attributes) and not the one with the normal keys. Thus if something goes wrong, the keyboard will still be usable to go back. Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 You were more than correct about binding all--I lost the keyboard when I finally got the correct ID for the device..grabbed the backup keyboard & had just started to backtrace the problem when your post came up :) Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 I have the keyboard back now--the first file for the 0003:1B1C:1B0E.000B has a uevent that now looks like this: HID_ID=0003:00001B1C:00001B0E HID_NAME=Corsair Corsair K40A Gaming Keyboard HID_PHYS=usb-0000:09:00.0-2/input0 HID_UNIQ= MODALIAS=hid:b0003g0001v00001B1Cp00001B0E 000C uevent looks like: DRIVER=hid-generic HID_ID=0003:00001B1C:00001B0E HID_NAME=Corsair Corsair K40A Gaming Keyboard HID_PHYS=usb-0000:09:00.0-2/input1 HID_UNIQ= MODALIAS=hid:b0003g0001v00001B1Cp00001B0E 000D uevent looks like: DRIVER=hid-generic HID_ID=0003:00001B1C:00001B0E HID_NAME=Corsair Corsair K40A Gaming Keyboard HID_PHYS=usb-0000:09:00.0-2/input2 HID_UNIQ= MODALIAS=hid:b0003g0001v00001B1Cp00001B0E The 3 entries for the keyboard look like: dean@linux:~$ ls -l '/sys/bus/hid/devices/0003:1B1C:1B0E.000D/driver' lrwxrwxrwx 1 root root 0 Sep 27 13:53 /sys/bus/hid/devices/0003:1B1C:1B0E.000D/driver -> ../../../../../../../../bus/hid/drivers/hid-generic dean@linux:~$ ls -l '/sys/bus/hid/devices/0003:1B1C:1B0E.000C/driver' lrwxrwxrwx 1 root root 0 Sep 27 13:57 /sys/bus/hid/devices/0003:1B1C:1B0E.000C/driver -> ../../../../../../../../bus/hid/drivers/hid-generic dean@linux:~$ ls -l '/sys/bus/hid/devices/0003:1B1C:1B0E.000B/driver' ls: cannot access /sys/bus/hid/devices/0003:1B1C:1B0E.000B/driver: No such file or directory Interesting that the K90 driver is not showing in the area that I would expect it to be..... Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 Going to reboot now & see what info the xorg log has to say. Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 xorg log for last reboot: [ 9.548] (II) config/udev: Adding input device Corsair Corsair K40A Gaming Keyboard (/dev/input/event1) [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: Applying InputClass "evdev keyboard catchall" [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: Applying InputClass "keyboard defaults" [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: Applying InputClass "keyboard defaults" [ 9.548] (II) Using input driver 'evdev' for 'Corsair Corsair K40A Gaming Keyboard' [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: always reports core events [ 9.548] (**) evdev: Corsair Corsair K40A Gaming Keyboard: Device: "/dev/input/event1" [ 9.548] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Vendor 0x1b1c Product 0x1b0e [ 9.548] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Found 1 mouse buttons [ 9.548] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Found scroll wheel(s) [ 9.548] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Found relative axes [ 9.548] (II) evdev: Corsair Corsair K40A Gaming Keyboard: Forcing relative x/y axes to exist. [ 9.548] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Found absolute axes [ 9.548] (II) evdev: Corsair Corsair K40A Gaming Keyboard: Forcing absolute x/y axes to exist. [ 9.548] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Found keys [ 9.548] (II) evdev: Corsair Corsair K40A Gaming Keyboard: Configuring as mouse [ 9.548] (II) evdev: Corsair Corsair K40A Gaming Keyboard: Configuring as keyboard [ 9.548] (II) evdev: Corsair Corsair K40A Gaming Keyboard: Adding scrollwheel support [ 9.548] (**) evdev: Corsair Corsair K40A Gaming Keyboard: YAxisMapping: buttons 4 and 5 [ 9.548] (**) evdev: Corsair Corsair K40A Gaming Keyboard: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200 [ 9.548] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1c.6/0000:09:00.0/usb3/3-2/3-2:1.1/0003:1B1C:1B0E.0002/input/input3/event1" [ 9.548] (II) XINPUT: Adding extended input device "Corsair Corsair K40A Gaming Keyboard" (type: KEYBOARD, id 8) [ 9.548] (**) Option "xkb_rules" "evdev" [ 9.548] (**) Option "xkb_model" "pc105" [ 9.548] (**) Option "xkb_layout" "us" [ 9.548] (**) Option "xkb_options" "terminate:ctrl_alt_bksp" [ 9.548] (II) evdev: Corsair Corsair K40A Gaming Keyboard: initialized for relative axes. [ 9.548] (WW) evdev: Corsair Corsair K40A Gaming Keyboard: ignoring absolute axes. [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: (accel) keeping acceleration scheme 1 [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: (accel) acceleration profile 0 [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: (accel) acceleration factor: 2.000 [ 9.548] (**) Corsair Corsair K40A Gaming Keyboard: (accel) acceleration threshold: 4 [ 9.549] (II) config/udev: Adding input device Corsair Corsair K40A Gaming Keyboard (/dev/input/event2) [ 9.549] (**) Corsair Corsair K40A Gaming Keyboard: Applying InputClass "evdev keyboard catchall" [ 9.549] (**) Corsair Corsair K40A Gaming Keyboard: Applying InputClass "keyboard defaults" [ 9.549] (**) Corsair Corsair K40A Gaming Keyboard: Applying InputClass "keyboard defaults" [ 9.549] (II) Using input driver 'evdev' for 'Corsair Corsair K40A Gaming Keyboard' [ 9.549] (**) Corsair Corsair K40A Gaming Keyboard: always reports core events [ 9.549] (**) evdev: Corsair Corsair K40A Gaming Keyboard: Device: "/dev/input/event2" [ 9.549] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Vendor 0x1b1c Product 0x1b0e [ 9.549] (--) evdev: Corsair Corsair K40A Gaming Keyboard: Found keys [ 9.549] (II) evdev: Corsair Corsair K40A Gaming Keyboard: Configuring as keyboard [ 9.549] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1c.6/0000:09:00.0/usb3/3-2/3-2:1.2/0003:1B1C:1B0E.0003/input/input4/event2" [ 9.549] (II) XINPUT: Adding extended input device "Corsair Corsair K40A Gaming Keyboard" (type: KEYBOARD, id 9) [ 9.549] (**) Option "xkb_rules" "evdev" [ 9.549] (**) Option "xkb_model" "pc105" [ 9.549] (**) Option "xkb_layout" "us" [ 9.549] (**) Option "xkb_options" "terminate:ctrl_alt_bksp" Systemd logs: Sep 27 14:11:13 linux kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Sep 27 14:11:13 linux kernel: usb 3-2: Product: Corsair K40A Gaming Keyboard Sep 27 14:11:13 linux kernel: usb 3-2: Manufacturer: Corsair Sep 27 14:11:13 linux kernel: hidraw: raw HID events driver © Jiri Kosina Sep 27 14:11:13 linux kernel: usbcore: registered new interface driver usbhid Sep 27 14:11:13 linux kernel: usbhid: USB HID core driver Sep 27 14:11:13 linux kernel: input: Corsair Corsair K40A Gaming Keyboard as /devices/pci0000:00/0000:00:1c.6/0000:09:00.0/usb3/3-2/3-2:1.0/0003:1B1C:1B0E.0001/input/input2 Sep 27 14:11:13 linux kernel: hid-generic 0003:1B1C:1B0E.0001: input,hidraw0: USB HID v1.11 Keyboard [Corsair Corsair K40A Gaming Keyboard] on usb-0000:09:00.0-2/input0 Sep 27 14:11:13 linux kernel: input: Corsair Corsair K40A Gaming Keyboard as /devices/pci0000:00/0000:00:1c.6/0000:09:00.0/usb3/3-2/3-2:1.1/0003:1B1C:1B0E.0002/input/input3 Sep 27 14:11:13 linux kernel: usb 6-1: new high-speed USB device number 2 using ehci-pci Sep 27 14:11:13 linux kernel: usb 5-1: New USB device found, idVendor=8087, idProduct=0024 Sep 27 14:11:13 linux kernel: usb 5-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 Sep 27 14:11:13 linux kernel: hub 5-1:1.0: USB hub found Sep 27 14:11:13 linux kernel: hub 5-1:1.0: 6 ports detected Sep 27 14:11:13 linux kernel: hid-generic 0003:1B1C:1B0E.0002: input,hidraw1: USB HID v1.11 Device [Corsair Corsair K40A Gaming Keyboard] on usb-0000:09:00.0-2/input1 Sep 27 14:11:13 linux kernel: input: Corsair Corsair K40A Gaming Keyboard as /devices/pci0000:00/0000:00:1c.6/0000:09:00.0/usb3/3-2/3-2:1.2/0003:1B1C:1B0E.0003/input/input4 {SNIP} Sep 27 14:11:13 linux kernel: hid-generic 0003:1B1C:1B0E.0003: input,hidraw2: USB HID v1.11 Keyboard [Corsair Corsair K40A Gaming Keyboard] on usb-0000:09:00.0-2/input2 Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 Check if /lib/modules/$(uname -r)/extra/hid-corsair.ko exists. What is the output of "grep corsair /lib/modules/$(uname -r)/modules.alias"? X.org log are useless for kernel driver. Only kernel log may have a use. Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 I just had an interesting thought--I looked in /sys/bus/hid/drivers & do not have a "Corsair" driver--have hid-generic, logitech-djreceiver & logitech-hidpp-device. I'm running the 4.2 kernel tree--more information on where/how the driver is built would be interesting.... I'm going to build the driver again & see if anything changes..... Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 The installation should copy the module hid-corsair.ko in the modules directory for the current kernel (the one given by "uname -r") and run depmod to update the modules.alias file (and other modules database file). Link to comment Share on other sites More sharing options...
debianmainused Posted September 27, 2015 Share Posted September 27, 2015 Not sure where the Corsair.ko driver is suppose to install--I'm not seeing it anywhere. The driver section /sys/bus/hid/drivers only has hid-generic & the drivers for my Logitech mouse (logitech-djreceiver & hidpp-device). The last time I have seen a "mixed implicit and normal rules: deprecated syntax" error--was with some of the nvidia drivers when they would not install. dean@linux:~/Desktop/k90-linux-driver-master$ make && sudo make install make -C /lib/modules/4.2.0-1-amd64/build M=/home/dean/Desktop/k90-linux-driver-master modules make[1]: Entering directory '/usr/src/linux-headers-4.2.0-1-amd64' Makefile:10: *** mixed implicit and normal rules: deprecated syntax Building modules, stage 2. MODPOST 1 modules make[1]: Leaving directory '/usr/src/linux-headers-4.2.0-1-amd64' [sudo] password for dean: make -C /lib/modules/4.2.0-1-amd64/build M=/home/dean/Desktop/k90-linux-driver-master modules_install make[1]: Entering directory '/usr/src/linux-headers-4.2.0-1-amd64' Makefile:10: *** mixed implicit and normal rules: deprecated syntax INSTALL /home/dean/Desktop/k90-linux-driver-master/hid-corsair.ko DEPMOD 4.2.0-1-amd64 make[1]: Leaving directory '/usr/src/linux-headers-4.2.0-1-amd64' Thoughts? Link to comment Share on other sites More sharing options...
Clément Posted September 27, 2015 Author Share Posted September 27, 2015 You may have missed my post just before. Look into /lib/modules/$(uname -r)/extra/ or try "sudo updatedb; locate hid-corsair.ko". It is likely you did something wrong with the id table. modules.alias should contains this line (look for the 1B0E): alias hid:b0003g*v00001B1Cp00001B0E hid_corsair You should have modified hid-corsair.c, so corsair_devices is: static const struct hid_device_id corsair_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90), .driver_data = CORSAIR_USE_K90_MACRO | CORSAIR_USE_K90_BACKLIGHT }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K40), .driver_data = CORSAIR_USE_K90_MACRO | CORSAIR_USE_K90_BACKLIGHT }, {} }; Link to comment Share on other sites More sharing options...
debianmainused Posted September 28, 2015 Share Posted September 28, 2015 You may have missed my post just before. Look into /lib/modules/$(uname -r)/extra/ or try "sudo updatedb; locate hid-corsair.ko". It is likely you did something wrong with the id table. modules.alias should contains this line (look for the 1B0E): alias hid:b0003g*v00001B1Cp00001B0E hid_corsair You should have modified hid-corsair.c, so corsair_devices is: static const struct hid_device_id corsair_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90), .driver_data = CORSAIR_USE_K90_MACRO | CORSAIR_USE_K90_BACKLIGHT }, { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K40), .driver_data = CORSAIR_USE_K90_MACRO | CORSAIR_USE_K90_BACKLIGHT }, {} }; I must admit to be at a loss right now--I now find the hid-corsair.ko in the right place /extra...It is not showing up in the modules.alias file (grep corsair /lib/modules/$(uname -r)/modules.alias) & the driver is not showing up in /sys/bus/hid/drivers. sudo modprobe hid_corsair modprobe: FATAL: Module hid_corsair not found. sudo modprobe hid-corsair modprobe: FATAL: Module hid-corsair not found. sudo corsair /lib/modules/$(uname -r)/modules.alias sudo: corsair: command not found Followed the information above in a copy/paste fashion so there would not be a spelling error. Rebuilt the driver & no change to the above information....not sure what is going on. Link to comment Share on other sites More sharing options...
debianmainused Posted September 28, 2015 Share Posted September 28, 2015 Did a sudo ln -s '/lib/modules/4.2.0-1-amd64/extra/hid-corsair.ko' /lib/modules/`uname -r` & rebooted. There is now a corsair driver in /hid/drivers. Will report more about how it works soon--time for food...... Link to comment Share on other sites More sharing options...
debianmainused Posted September 28, 2015 Share Posted September 28, 2015 uevent info: DRIVER=corsair HID_ID=0003:00001B1C:00001B0E HID_NAME=Corsair Corsair K40A Gaming Keyboard HID_PHYS=usb-0000:09:00.0-2/input0 HID_UNIQ= MODALIAS=hid:b0003g0001v00001B1Cp00001B0E grep corsair /lib/modules/$(uname -r)/modules.alias alias hid:b0003g*v00001B1Cp00001B0E hid_corsair alias hid:b0003g*v00001B1Cp00001B02 hid_corsair cat /sys/bus/hid/devices/0003\:1B1C\:*/current_profile 1 And sudo tee /sys/bus/hid/devices/0003\:1B1C\:*/current_profile <<< 1 or 2 or 3 works as expected. Only thing not working as expected now is brightness: cat /sys/class/leds/0003\:1B1C\:*\:backlight/brightness 0 Is the report regardless of real brightness and: sudo tee /sys/class/leds/0003\:1B1C\:*\:backlight/brightness <<< 1 1 really does nothing.... sudo xxd -g 1 -c 8 /dev/hidraw0 max to off 00000000: 00 00 fd 00 00 00 00 00 ........ 00000008: 00 00 00 00 00 00 00 00 ........ off to dim 00000010: 00 00 fa 00 00 00 00 00 ........ 00000018: 00 00 00 00 00 00 00 00 ........ dim to #2 00000020: 00 00 fb 00 00 00 00 00 ........ 00000028: 00 00 00 00 00 00 00 00 ........ #2 to max 00000030: 00 00 fc 00 00 00 00 00 ........ 00000038: 00 00 00 00 00 00 00 00 ........ is reported from brightness key press---at least I don't get Gnome-calc on the press from off to dim anymore.... Link to comment Share on other sites More sharing options...
Clément Posted September 28, 2015 Author Share Posted September 28, 2015 hidraw ouput won't change since it's the data before the driver parses it. The brightness does not work like the K90. Could you capture USB traffic while changing the brightness with corsair software? Also capture on linux (with usbmon), what happens when reading the backlight brightness with different actual levels (by pressing the key). Or check for error messages in kernel logs. There should be a "record_led" led device next to the "backlight" one. Does this one work correctly? Link to comment Share on other sites More sharing options...
debianmainused Posted September 28, 2015 Share Posted September 28, 2015 hidraw ouput won't change since it's the data before the driver parses it. The brightness does not work like the K90. Could you capture USB traffic while changing the brightness with corsair software? Also capture on linux (with usbmon), what happens when reading the backlight brightness with different actual levels (by pressing the key). Or check for error messages in kernel logs. There should be a "record_led" led device next to the "backlight" one. Does this one work correctly? Here is a quick usbmon output from the brightness...have to goto work, will do more this evening1.mon.out.txt Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.