Remap mouse buttons in the input filter
As the current USB HID driver simply parses the report descriptor some input devices will operate in its default configuration. That, however might be undesirable - input filter to the rescue.
The input_filter component is a powerful asset when it comes to configuring the behaviour of the input devices. Most prominently it enables one to use the CAPSLOCK key as ESC key.
Every now and then I use my - product placement incoming - Evoluent VerticalMouse3 on Genode. One of its nice features is having a proper middle mouse button besides (ab-)using the mouse wheel for this. This is particular convenient when using mouse chords or simply the X11 selection mechanism where the middle buttons is pasting the selection.
Unfortunately, the default setting provided by the USB HID driver maps the middle button to BTN_RIGHT while the most right button is mapped to BTN_SIDE. (For completness sake the thumb button is mapped to BTN_EXTRA.)
Since the mouse buttons are handled in the same way as keys I can use the <remap> feature of the input_filter to set up a more natural mapping:
[…] <remap> […] <key name="BTN_SIDE" to="BTN_RIGHT"/> <key name="BTN_RIGHT" to="BTN_MIDDLE"/> […] </remap> […]
Pay attention, though, if you use multiple different mouse devices at the same time because the input_filter will not differentiate them and will always apply the remapping rules.