LX50 Scroll Wheel Tilt Fix

This was another task I never thought I’d figure out, but, eventually I got it… kind of.

The problem was that my Logitech mouse (part of the S510 cordless keyboard/mouse combo package) sent <scroll lock> -> left/right -> <scroll lock> combinations when tilting the wheel instead of mouse button presses. As this mouse lacks side buttons I would have liked to use the wheel as mouse buttons 4 and 5. I could not understand why Logitech had configured this mouse to send this key-press sequence instead of just letting the mouse report button presses by default (perhaps this setting can be saved in the mouse by sending some command?)

Wheel tilts reported as mouse button presses was possible to set up using the SetPoint utility under Windows (and is by default) but there was no tool to change it for those of us running Linux. I couldn’t even find any reports of any others with the same request as I. There existed some Logitech-mouse-tweak software for Linux out there though, revoco, lomoco, g5hack, g400fix), that could change other settings on otherĀ  mouse models.

I downloaded whatever sources I could find to study the source to try figure out how I could make the mouse work like I wanted it. I found that some was based on libusb (0.1) and others utilized hiddev.

I downloaded a couple of trial USB sniffers for windows and tried to sniff the communications between the Logitech drivers and the device on device initialization, without any luck at first. It seemed like whenever I activated the sniffing software, Logitech SetPoint would no longer be able to identify the device so no initialization was attempted. This put a stop to my first attempt.

I retried some year later though with another piece of sniffing software which didn’t screw up device identification with which I managed to capture some of the communication. Not knowing anything really about USB protocols though I had to learn more about that in order to be able to interpret anything the logs told me (even though the software had many nice protocol decoding functions.).

First I attempted to use libusb, but got the message that a kernel driver had claimed interface, one could detach / reattach by echoing theh corresponding string to some file in the /sys filesystem. But still could not get it to work.

HIDDEV seemed like the simpler solution, and I could borrow the code from g5_hiddev.c almost in its entity, just changing the HID-report payload.

Tried to send the whole windows init sequence that I had captured, which would change the operation the button performed. Something like (shortened):

10 01 41 02 01 22 36
10 FF 80 00 00 00 00
10 01 81 07 00 00 00
10 01 81 07 00 00 00
10 03 41 02 02 11 56
10 01 81 07 05 00 00
10 01 81 00 00 00 00
10 01 81 00 00 00 00
10 01 81 00 00 00 00
10 01 80 00 10 03 00
10 01 80 00 10 03 00
10 01 80 00 00 00 00
10 03 81 07 00 00 00
10 03 81 07 00 00 00
10 03 81 07 05 00 00
10 01 81 01 00 00 00
10 01 81 01 00 00 00
10 01 81 01 42 00 00
10 03 81 00 00 00 00
10 03 81 00 00 00 00
10 03 81 00 00 00 00
10 01 80 01 42 00 00
10 01 80 01 42 00 00

Then tried to send them on by one until I found the one that worked:

10 01 80 01 00 00 00

The very same sequence but with 00 in the second position disables the “change DPI” buttons on many corded Logitech mice. Think 0x0 addresses corded mouse and 0x1 wireless (something about the dongle).

lx5fix.c