Saturday, August 12, 2017

kernel - Logitech M560 mouse on linux sends messed up input events

My friend bought yesterday a Logitech M560 mouse (you can see it here) and tried it on her Ubuntu system. It seems to be a relatively new model, so there is no info about it anywhere, except for logitech's own website. The key mapping was off, but I thought it was easy to remap the buttons - I 've been doing it for the past decade with a variety of Logitech mice. However, unlike other mice, where you have to say switch button 13 with button 2, this mouse sends some key press events, as if you had typed on the keyboard.


The mouse has left and right click buttons, a scroll wheel with tilt capability (4 buttons), back and forward buttons on the side, plus a small square button behind the wheel - a total of nine buttons. Pressing the wheel does not function as middle click, there is no switch under it. Instead, pressing the wheel engages and disengages a lock, allowing it to revolve either in steps or freely.


I wanted to get all the "usual" buttons to do what they were supposed to and map the middle click action to the small button behind the wheel, so I started off with xev and xinput to identify which is which:


Button 1 -> left click
Button 3 -> right click
Button 4 -> wheel up
Button 5 -> wheel down
Button 8 -> tilt left
Button 9 -> tilt right


And here's the weird part:
Pressing the forward button is like pressing Super_R (keycode 134).
Pressing the back button yields simultaneously Super_L and d (keycodes 133 & 40).


Even more weirdness:
Pressing the square button once, gives simultaneously Alt_L, Super_L and XF86TouchpadOff (keycodes 64, 133, 201).
Pressing it a second time is like pressing button 1...


So, the first six buttons send button press/release events, while the other three send multiple key press/release events.


It is relatively easy to map a mouse button to a keyboard keycode, but is it possible to do the opposite, without crippling the system's keyboard? Should I contact someone from kernel.org to add support for the mouse?

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...