I want to pass through a USB mouse to virtual machine in VirtualBox. I'm aware that VirtualBox can emulate its own Mouse/Keyboard based on input events from the host system. But that is not what I want. My mouse has configurable keys that can only be configured from a Windows driver. I want to be able to do that from a virtual machine (Windows) and if that works I may also want to try and reverse engineer its protocol for libratbag or something similar.
VirtualBox
So the whole USB device has to be passed through to the virtual machine. I have a second mouse that I can use for my host system.
VirtualBox seems to offer a way to add USB devices. However when I click on the USB icon with the little green plus symbol it tells me "no devices available".
Host
I guess I somehow need to disconnect the mouse from the host's input driver. But I don't exactly know how to do that.
From this question - or more specifically its accepted answer - I found out that you can unbind a HID device from a driver. So I tried the following (My mouse registers two HIDs):
echo -n "0003:258A:1007.0012" > /sys/bus/hid/drivers/hid-generic/unbind
echo -n "0003:258A:1007.0013" > /sys/bus/hid/drivers/hid-generic/unbind
Although I have no clue what it exactly does.
My mouse stopped working after that (sort of expected). But I still couldn't select it in VirtualBox - even after I restarted it.
I'm willing/able to switch to a different Virtualization tool like qemu if that simplifies things. But I guess that this is not the problem. Maybe I need to write a udev rule that prevents it to be detected as HID? But I'm not exactly a udev expert and I don't know what is required to make this work.