duncanthrax / roccat-vulcan

Linux RGB LED effect support for the Roccat Vulcan 100/120 Keyboard
GNU General Public License v3.0
79 stars 20 forks source link

FN key + soft helper #3

Closed Catvert closed 5 years ago

Catvert commented 5 years ago

Hello, First of all, thanks for your amazing work ! I never thought I'd be able to customize my roccat keyboard on Linux since the only linux developer left the Roccat box.

That's it, everything seems to work correctly, the only problem I have is the inability to change the color of my FN key. No evdev ID is displayed in verbose mode when I press this key.

I'm making a little software (in order to practice the Rust language) to easily configure its roccat keyboard using your software in backend. For the moment, it allows to store the color assigned to each key (in a configuration file), the effect mode (wave/impact), make key groups to assign a specific color to this group(like change all colors for letters in one command)... I plan to add profile support later on, maybe a graphical interface and of course code enhancement. If you are interested, here is the link to the repo: https://github.com/Catvert/roccat-vulcan-helper

Thank you for your help, Arno.

duncanthrax commented 5 years ago

Hi Arno, the FN key does not seem to produce a standard HID USB report - I don't see activity on the USB HID device when this button is pressed. The swarm software on windows can query it - maybe it needs to be polled.

If you want to write effects in a higher-level language, it may be practical to expose the key color map as a memory-mapped file (like SHM) from a daemon written in C. The daemon can push the color map to the keyboard periodically, and the higher-level software can just write color information to the memmap. I had such a model working previously, but then settled to do everything in C instead.

Catvert commented 5 years ago

Ok ! Thank you for the information.

SpiritCroc commented 5 years ago

I'm currently playing around with this project, I added support for at least setting static color to the FN key with https://github.com/SpiritCroc/roccat-vulcan/commit/08b34eac3304d5a5a4bda96a2f351ccd2cf6f6a5

Apart from that, I added the functionality to read commands to set static colors from a named pipe so I can control my keyboard from other scripts.

Btw, as soon as I start roccat-vulcan, my volume and media control buttons stop sending keycodes it seems, is this known/is there a known workaround?

Thanks for your work!

duncanthrax commented 5 years ago

@SpiritCroc: Please send a PR when you're done. I didn't notice the media keys being inactive since I never used them. It looks like the media/volume keys register as a separate HID device which simply disappears after I send the init sequence. It might also be due to the fact that I only open two of the four (five?) exposed HID interfaces. Maybe then the HW shuts down the others. I'll experiment a bit to see if I can make the keys work again.

SpiritCroc commented 5 years ago

@duncanthrax will do; thanks for looking into it!

duncanthrax commented 5 years ago

FYI, I found the reason for the disappearing media key device. It's the same device that is used to send the init sequence. I open it with hidapi-libusb, which disconnects it from the kernel driver. Hence, it disappears. Unfortunately, hidapi-libusb does not reconnect the kernel driver even when you close the device. A PR to fix this has been open for a year (https://github.com/signal11/hidapi/pull/393). My alternative is to use native hidraw for the control/media device and use hidapi-libusb only for the LED device. I'll probably do that.

SpiritCroc commented 5 years ago

@duncanthrax interestingly, using the patch you linked and closing the ctrl device after the init sequence, I indeed get back working volume control (which is great), but the play/pause etc. keys that you access with the FN key still stopped working for me as soon as roccat-vulcan is started...