Wireshark, Logitech Mice, Emulation Bugs, and more

EDIT: I also asked for help on reddit and thanks to /u/gort818 I compiled and installed ratbag which is a neat thing some kind person made that allows me to set polling rate and dpi for my mouse in linux. (link: https://github.com/libratbag/libratbag)

EDIT 2: Piper / libratbag isn’t actually setting the polling rate after committing changes. I still need help. :frowning:

Hi everyone,
I’m currently trying to work around a Proton (WINE?) bug and could use some assistance. When playing a game I experience significant hitching if I move my mouse around the screen. (Closed bug as seen here https://bugs.winehq.org/show_bug.cgi?id=46976)

Through lots of searching around the web I found that the issue is due to my Logitech G903 mouse which has a polling rate of 1000 hz. I have a windows virtual machine where I can use the Logitech software to turn the polling down to 500hz; this works around the bug. However, when I hit my kvm switch or simply restart my computer, the USB receiver for my mouse is reset and falls back to 1000 hz.

I first tried to use the work arounds found on this page: https://wiki.archlinux.org/index.php/Mouse_polling_rate

However, I only have USB 3.0 ports in my system; blacklisting the xhci-hcd driver does not work around the problem because I have USB 3.0 xhci controller and the mousepoll setting for usbhid (xhci) is broken… (Currently another open bug https://bugzilla.kernel.org/show_bug.cgi?id=82571)

I tried to get Solaar to run which might have an option to change the polling rate for me, but it throws a permission error stating it can’t read /dev/hidraw8 and I’ve not been able to launch the program as sudo since the GUI will not pop up.

I then stumbled upon this post from stack exchange (https://askubuntu.com/questions/624075/how-do-i-set-the-usb-polling-rate-correctly-for-my-logitech-mouse). Some very smart person used wireshark to sniff the USB traffic and suss out the command being sent to his mouse receiever so he could do so within Linux.

I attempted to follow this persons footsteps, but there’s not enough information in his post for me to really understand how to continue. I was able to download and install wireshark, and I even dumped the traffic sent / received when I send the command to lower the polling rate in windows. (wireshark log here: https://www.dropbox.com/s/rlj10erkwoxcq8p/captured%20usb%20packets.pcapng?dl=0 ). However, I am not really sure what I’m looking for in the
wireshark logs to continue on with.

I adapated this guys Ruby script and tried what I thought was the Hex code for lowering the polling rate (but whatever I tried was def a guess and did not work).

#!/bin/ruby
HIDIOCSFEATURE = 0xC0024806

f = File.open("/dev/hidraw1", “w+”)
f.ioctl(HIDIOCSFEATURE,"\x20\x03")

Additionally, I don’t know which hidraw device to point this script to. I was able to figure out my USB Receivers hardware id, but there are 4 hidraw devices to choose from.

peter@zenbox3800:~$ lsusb | grep -i logitech
Bus 003 Device 049: ID 046d:c539 Logitech, Inc. USB2.0 Hub

peter@zenbox3800:~$ ls -l /sys/class/hidraw
total 0
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw0 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.3/usb5/5-4/5-4:1.2/0003:0B05:18F3.0001/hidraw/hidraw0
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw1 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.3/usb5/5-5/5-5:1.0/0003:1B1C:1C06.0002/hidraw/hidraw1
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw10 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.1/usb3/3-3/3-3.1/3-3.1.1/3-3.1.1:1.2/0003:046D:C539.0078/0003:046D:4067.0079/hidraw/hidraw10
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw2 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.1/usb3/3-1/3-1.1/3-1.1:1.3/0003:0D8C:01C2.0003/hidraw/hidraw2
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw6 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.1/usb3/3-3/3-3.1/3-3.1.1/3-3.1.1:1.0/0003:046D:C539.0076/hidraw/hidraw6
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw7 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.1/usb3/3-3/3-3.1/3-3.1.1/3-3.1.1:1.1/0003:046D:C539.0077/hidraw/hidraw7
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw8 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.1/usb3/3-3/3-3.1/3-3.1.1/3-3.1.1:1.2/0003:046D:C539.0078/hidraw/hidraw8
lrwxrwxrwx 1 root root 0 Sep 26 09:27 hidraw9 -> …/…/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:08.0/0000:05:00.1/usb3/3-1/3-1.4/3-1.4:1.0/0003:048D:8295.0012/hidraw/hidraw9

Is anyone able to point me in the right direction here? What should I be looking for in the wireshark log? I think I’m close to a solution, but I need someone smarter than myself to put
the pieces together.

System information:

peter@zenbox3800
OS: Pop 20.04 focal
Kernel: x86_64 Linux 5.4.0-7642-generic
Uptime: 22h 16m
Packages: Unknown
Shell: bash 5.0.17
Resolution: 5120x1440
DE: GNOME 3.36.4
WM: Mutter
WM Theme: Pop
GTK Theme: Pop-dark [GTK2/3]
Icon Theme: Pop
Font: Fira Sans Semi-Light 10
Disk: 1.5T / 3.2T (49%)
CPU: AMD Ryzen 7 3800X 8-Core @ 16x 3.9GHz
GPU: GeForce GTX 1080
RAM: 28603MiB / 32023MiB

1 Like