6

I recently bought a Varmilo VA109M mechanical keyboard. It works fine on Windows, but seems to confuse my Ubuntu install in that the F1-F12 function keys appear always to activate media shortcuts, regardless of whether I've held the dedicated Fn modifier key or not. For instance, F12 will increase my system volume if I press it on its own, and will do the same if I press Fn+F12; there is no way to get it to act like a normal F12 key. This is causing me issues because I do a lot of programming, and many IDE shortcuts rely on the standard function keys.

I have tried resetting the keyboard's internal settings by holding Fn+Esc, but this didn't help. My Windows install on the same machine functions perfectly fine with this keyboard. Is there anything I can do to try and diagnose exactly what Ubuntu is getting confused about?

EDIT: lsusb outputs the following:

Bus 001 Device 003: ID 05ac:024f Apple, Inc. Varmilo Keyboard
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x05ac Apple, Inc.
  idProduct          0x024f 
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x005b
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              350mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      75
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      85
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      33
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               4
5
  • Are you sure you don't have a driver installed for this keyboard in Windows? This might explain everything. If it's the case I've no idea what to do. Aug 16, 2020 at 15:43
  • I didn't manually install one, but it's possible that Windows picked up one automatically that was appropriate. Aug 16, 2020 at 15:50
  • Hint: Tell potential answerers what Apple keyboard your Varmilo keyboard is incorrectly identifying itself as, with the output of lsusb put into the question. (-:
    – JdeBP
    Aug 16, 2020 at 17:33
  • Hmm. Interesting that it comes up as Apple, I'd not considered that. Aug 17, 2020 at 18:48
  • 2
    Varmilo has now released a firmware which changes the vendor ID and Product ID to 04d9:a0d1. This solves the issue and is the right fix as described in the answer by @JdeBP.
    – banskt
    Nov 27, 2020 at 0:46

5 Answers 5

6

This is solvable!

So I did some research into this myself recently and while Jd3eBP is right about the keyboard pretending to be an Apple keyboard, it's actually probably an issue with Varmilo's flashing at the factory.

They sell a Mac version of the keyboard that I think differs only in firmware and labeling, by default I think it supports the Mac layout, it's also supposed to be able to switch to "windows mode" which probably swaps the order of the keys to what you'd expect, it identifies itself as an Apple keyboard to get Macs to treat it properly.

However it seems like maybe they accidentally flashed that firmware onto every keyboard instead of just the Mac only ones, which isn't noticeable on Windows since it ignores the id, but on linux will activate the hid_apple driver.

Solution:

On to the answer part. There's two big options for solving this, I tested both and ended up finding the second much better.

  1. Change hid_apple into a mode where it treats the function keys normally, afaik this will basically solve the issue. You can find instructions here for how to do that, it will work on Ubuntu as well. https://wiki.archlinux.org/index.php/Apple_Keyboard#Function_keys_do_not_work.

  2. Reflash the keyboard with the product and vendor ID such that it will not be detected. This is arguably the right answer but a little more risky. You can get the firmware files from the manufacturer site here, https://en.varmilo.com/keyboardproscenium/Driverdownload, using the VA87M download. The updater itself didn't work (I think I needed Chinese localization installed), so you can use the updater that was supplied to someone here https://www.reddit.com/r/Varmilo/comments/g4sabk/fn_lock_on_va87m/, using the official firmware file from the for good measure. If you don't trust that, I hear that if you email Varmilo about the issue they will provide the required files.

That updater worked under wine for me after installing wine from the official site. This just reflashes the vendor and product ID to not come up as an Apple keyboard, it also removes the "switch to windows/mac mode" functionality that was unused on the Windows only version. You could probably flash the Mac firmware to revert to the old behavior if you want I didn't test that however.

3
  • 1
    Wow, that's quite the workaround! Thanks for digging that up. Personally I would simply return that keyboard. Plenty of other competitors that work with any OS out of the box and don't require any "drivers" for something as mundane as a keyboard. I still don't understand why the manufacturer couldn't stick to simple HID standards that work across any platform. Jan 15, 2021 at 21:59
  • 1
    It's not really a driver. It does use standard HID descriptors (with an additional standard hack used by many USB devices to achieve N-key rollover via USB), the issue is that on OS X, there's benefits to the OS thinking you're an Apple keyboard (I think this let's the keyboard control brightness and such), the only way to do so is for the keyboard to "pretend" by using Apple's identifiers. Linux has a driver to support the same thing, but Windows just ignores it. The firmware change stops the keyboard from identifying as an Apple keyboard, which the Windows version was accidentally doing.
    – Lunaphied
    Jan 16, 2021 at 22:09
  • For what it's worth it's been a pretty good keyboard for me and the simpler fix of changing the settings for hid_apple works just as well to my knowledge. If neither solution had been an option Linux could have looked for the name (which is separate from the usb Vendor/Product ID) and added a quirk to not load hid_apple for this device, which is what I was looking into before I found the better solutions.
    – Lunaphied
    Jan 16, 2021 at 22:15
6

Varmilo does not do USB right. Avoid.

Around the WWW it can be seen that its keyboards variously falsely report their manufacturers as Apple (vendor ID 05ac as claimed by the Varmilo VS109M and by the Varmilo VA88M), Cypress (vendor ID 04b4 as claimed by the Varmilo Z104M), ROF Electronics (vendor ID ffff, as claimed by a Varmilo VA87M), Nordic Semiconductor (vendor ID 1915 as claimed by a Varmilo VB87M), Holtek, and more.

This is clearly erroneous, and highly problematic.

If one's hardware device identifies its manufacturer (in device enumeration of PCI, USB, et al. buses) as Apple and its product as a specific Apple keyboard, then it is perfectly legitimate for operating systems to treat it as that Apple keyboard. Vendor ID 05AC Product ID 024F is the Apple Aluminium Keyboard (U.S.).

The problem here is that the VA109M is not that keyboard.

The Apple keyboard has special and unusual semantics for the Fn key, which differ from most keyboards. The Linux device driver that gets attached to Apple keyboards is hid_apple, and that knows to handle Apple's special Fn key with its private USB HID "usage".

The VA109M isn't an Apple keyboard. It is a Varmilo keyboard. It doesn't work like an Apple keyboard. It does not emit the Apple special USB HID "usage" for Fn. Like most keyboards, it doesn't make Fn visible via the USB at all.

So driving it like the Apple keyboard that it says that it is, does not work.

  • A poor fix, that is also non-trivial to enact, is to disable or remove the hid_apple driver from Linux.
  • A poor fix is to use the fnmode=2 option to the hid_apple driver to invert its Fn shift state. That at least switches to the semantics of those keys being function keys rather than media/device control keys.
  • The right fix is to buy keyboards from a manufacturer that knows how to set vendor IDs properly, rather than from Varmilo.

Further reading

1
  • Thanks for this info. I think my best option would be to use your second "poor fix", as I don't really need the media keys for what I usually do. I will avoid buying Chinese keyboard in future I think, regardless of how attractive they look. Aug 21, 2020 at 11:51
3

I've made my one work.

Suppose you will not plug a real Apple keyboard into your machine someday.

  1. Create a file /etc/modprobe.d/hid_apple.conf
  2. Add options hid_apple fnmode=2 and save
  3. sudo update-initramfs -u on Debian distros, or sudo mkinitcpio -P for Arch distros
  4. reboot
  5. Switch the keyboard to Windows mode (if it has the function)
1

According to the manufacturer: https://en.varmilo.com/keyboardproscenium/subject_product_detailed?subjectid=221

Windows OS only, macOS does not support shortcut keys. If this refers to the function key, then this may be the answer why. Perhaps their macOS support is as spotty as their Linux support.

1
  • I would not be at all surprised if that were the case - that'll teach me to spend £180 on a keyboard without adequately exploring its compatibility. Perhaps I'll look into permanently mapping the media shortcut keys to function keys in software. Thanks for the pointer. Aug 18, 2020 at 10:02
1

holding FN + W more than 3 seconds helped me to exit MAC mode. And function keys worked correctly. This instruction I read from manual from support of store, that I bought the keyboard.

1
  • This didn't work for me, unfortunately. May 2, 2021 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .