Varmilo keyboard Fn-keys under Linux

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,266
428
83
Bit of an oddball problem that doesn't 100% belong here but I'm posting the solution here as I know Varmilo's are fairly popular amongst keyboard snobs like me, I found a fair few posts of linux desktop users who'd run in to a similar issue but hadn't found any solution.

I've just added a new VA88M KB (ISO model of the VA87M) to my home office setup but the function keys resolutely refused to work properly; for instance F1 and F2 changed brightness of all things. Colour me horribly confused and all that that I had to press Fn+F5 to get an F5 result.

Plugged this in to a mate's windows machine and the keys worked as expected - Fkeys worked as normal, Fn+Fkeys accessed the multimedia controls on F7 upwards.

So clearly some sort of incompatibility between the way windows handles these versus linux (debian in my case). Digging about with xev showed that, yes, it wasn't any weird keymapping on my part that was doing this, keyboard was sending those commands. However I was rather surprised to see that lsusb showed the Varmilo up as an Apple keyboard ("AONE Varmilo Keyboard", 05ac:024f) and was using hid_apple to handle the input events. I'm not sure why this is, but perfectly possible that apple keyboards are using the same keyboard controller as the varmilo ones or something like that.

A little bit of digging around later and it seems that linux defaults to expecting apple users to press a Fn key before being able to access the functions. News to me, but I'm not a mac user. Thankfully it seems the hid_apple module takes a parameter called fnmode to control behaviour of the function keys; the default value of 1 is what's causing the unexpected behaviour.

As such I added some module options for hid_apple to force "F-keys first" behaviour:
Code:
options hid_apple fnmode=2
On reloading the module, Fkeys worked as expected. My other varmilo keyboard, a VA69M, doesn't seem to suffer from this problem but shows up as a Holtek instead.
 

EffrafaxOfWug

Radioactive Member
Feb 12, 2015
1,266
428
83
Thanks, I'm glad someone found it useful!

FWIW I opened a bug report but it's essentially a WONTFIX since the Varmilo seems to be intentionally mis-representing itself under *nix for some reason. I suspect it has a firmware function that assumes anything it detects to that isn't windows must be OSX.