sriemer / fix-linux-mouse

Hints how to fix USB mouse issues on Linux
44 stars 5 forks source link

Ubuntu seems to be prone to mouse disconnects on display server as well? #23

Closed sriemer closed 1 year ago

sriemer commented 5 years ago

Maybe it is only the Mir display server. But I've noticed that Ubuntu has issues with aperiodic mouse disconnects if there is a PixArt IC with faulty Logitech FW and HID_QUIRK_ALWAYS_POLL is not set in the hid_quirks.

Lite-On PixArt mouse on Ubuntu Xenial: https://askubuntu.com/questions/792335/kernel-install-issue-new-usb-device-found-product-usb-optical-mouse-repeating

HP X1200 on Ubuntu Xenial (4.4 kernel): https://forum.ubuntu-it.org/viewtopic.php?p=4945248

HP X500 on Ubuntu Bionic (4.18 kernel): https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1832041

It looks like the Mir mouse driver does not poll the mouse frequently enough.

Who can confirm? TIA

kalensk commented 2 years ago

I am running Ubuntu 22.04 with kernel 5.15.0-41-generic on X11 and not Wayland. I have also experienced this issue on Fedora 36 live usb when trying to debug the issue.

I have two mice that exhibit this behavior. Extremely annoying and at my wits end on how to get a usable computer! I am somewhat new to all this so hopefully you can help me provide enough information and possible help solve my issue. Is there a mouse I can purchase today that does not exhibit this behavior?!


Mouse 1: Amazonbasics mouse with model number MSU0939

dmesg output:

  465.405426] usb 3-1: New USB device found, idVendor=04f2, idProduct=0939, bcdDevice= 1.00
[  465.405429] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  465.405430] usb 3-1: Product: USB Optical Mouse
[  465.405430] usb 3-1: Manufacturer: PixArt
[  465.408587] input: PixArt USB Optical Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/0003:04F2:0939.0012/input/input44
[  465.408798] hid-generic 0003:04F2:0939.0012: input,hidraw2: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:00:14.0-1/input0
[  601.960354] usb 3-1: USB disconnect, device number 28
[  602.928373] usb 3-1: new low-speed USB device number 29 using xhci_hcd
[  603.080670] usb 3-1: New USB device found, idVendor=04f2, idProduct=0939, bcdDevice= 1.00
[  603.080674] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  603.080675] usb 3-1: Product: USB Optical Mouse
[  603.080675] usb 3-1: Manufacturer: PixArt
[  603.084179] input: PixArt USB Optical Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/0003:04F2:0939.0013/input/input45
[  603.084466] hid-generic 0003:04F2:0939.0013: input,hidraw2: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:00:14.0-1/input0

lsusb -v

  idVendor           0x04f2 Chicony Electronics Co., Ltd
  idProduct          0x0939 Amazon Basics mouse
  bcdDevice            1.00
  iManufacturer           1 PixArt
  iProduct                2 USB Optical Mouse

Mouse 2: Dell mouse with model number M-UVDEL1

dmesg output:

[ 1005.133190] usb 3-1: new low-speed USB device number 45 using xhci_hcd
[ 1005.286133] usb 3-1: New USB device found, idVendor=046d, idProduct=c016, bcdDevice= 3.40
[ 1005.286136] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1005.286137] usb 3-1: Product: Optical USB Mouse
[ 1005.286137] usb 3-1: Manufacturer: Logitech
[ 1005.289553] input: Logitech Optical USB Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/0003:046D:C016.0021/input/input59
[ 1005.289931] hid-generic 0003:046D:C016.0021: input,hidraw2: USB HID v1.10 Mouse [Logitech Optical USB Mouse] on usb-0000:00:14.0-1/input0
[ 1009.320727] usb 3-1: USB disconnect, device number 45
[ 1010.029181] usb 3-1: new low-speed USB device number 46 using xhci_hcd
[ 1010.182113] usb 3-1: New USB device found, idVendor=046d, idProduct=c016, bcdDevice= 3.40
[ 1010.182116] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1010.182117] usb 3-1: Product: Optical USB Mouse
[ 1010.182118] usb 3-1: Manufacturer: Logitech
[ 1010.185541] input: Logitech Optical USB Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/0003:046D:C016.0022/input/input60
[ 1010.245368] hid-generic 0003:046D:C016.0022: input,hidraw2: USB HID v1.10 Mouse [Logitech Optical USB Mouse] on usb-0000:00:14.0-1/input0
[ 1010.376719] usb 3-1: USB disconnect, device number 46
[ 1010.981173] usb 3-1: new low-speed USB device number 47 using xhci_hcd
[ 1011.134214] usb 3-1: New USB device found, idVendor=046d, idProduct=c016, bcdDevice= 3.40
[ 1011.134217] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1011.134218] usb 3-1: Product: Optical USB Mouse
[ 1011.134219] usb 3-1: Manufacturer: Logitech
[ 1011.137584] input: Logitech Optical USB Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/0003:046D:C016.0023/input/input61
[ 1011.137931] hid-generic 0003:046D:C016.0023: input,hidraw2: USB HID v1.10 Mouse [Logitech Optical USB Mouse] on usb-0000:00:14.0-1/input0

lsusb -v

  idVendor           0x046d Logitech, Inc.
  idProduct          0xc016 Optical Wheel Mouse
  bcdDevice            3.40
  iManufacturer           1 Logitech
  iProduct                2 Optical USB Mouse

I have tried adding usbhid.quirks=0x413c:0x301a:0x00000400 to /etc/default/grub and sudo update-grub and rebooting. But the issue still persists

Part of /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvme.noacpi=1 i915.enable_psr=0 mem_sleep_default=deep usbhid.quirks=0x413c:0x301a:0x00000400"
GRUB_CMDLINE_LINUX=""

I have also tried sudo bash -c "echo -1 > /sys/module/usbcore/parameters/autosuspend" as well as sudo tlp usb both of which did not work either.

Can you help explain a solution that would work today or mouse I could buy as I am going crazy! Thanks for the help!!!

kalensk commented 2 years ago

Oh I see I need to set this in GRUB_CMDLINE_LINUX_DEFAULT, sudo update-grub, and reboot.

usbhid.quirks=0xaaaa:0xbbbb:0x00000400 fixes the issue while aaaa is the USB vendor ID and bbbb is the USB product ID in hex from lsusb or lsusb -vvv output.

where usb vendorID and productID are found from dmesg or lsusb -v.

~I "think" that seemed to have fixed things...so far at least.~ The issue seems to persists with GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvme.noacpi=1 i915.enable_psr=0 mem_sleep_default=deep usbhid.quirks=0x046d:0xc016:0x00000400"

for

[  723.439073] usb 3-1: New USB device found, idVendor=046d, idProduct=c016, bcdDevice= 3.40
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc016 Optical Wheel Mouse
[  564.784725] usb 3-6.1: reset low-speed USB device number 17 using xhci_hcd
[  572.320658] usb 3-6.1: reset low-speed USB device number 17 using xhci_hcd
[  572.640208] usb 3-6.1: device descriptor read/64, error -32
[  573.067949] usb 3-6.1: device descriptor read/64, error -32
[  573.491704] usb 3-6.1: reset low-speed USB device number 17 using xhci_hcd
sriemer commented 2 years ago

Yep, you did it correctly now. Thanks for reporting, @kalensk. With that info I can fix the upstream kernel for you.

The remaining issue looks like a suspend issue and is not at usbhid but at usbcore level. Try setting usbcore.autosuspend=-1 and further usbcore quirks as needed. See #21.

sriemer commented 2 years ago

The Amazon Basics branded Chicony PixArt mouse MSU0939 has been fixed at upstream already (06/2019): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.19-rc7&id=dcf768b0ac868630e7bdb6f2f1c9fe72788012fa You could report a bug to the Ubuntu kernel team via Launchpad so that they fix this. The patch should be included in the 5.15 upstream kernel already.

The Dell M-UVDEL1 is plain too old (around 2002). USB3 wasn't invented in that time. It is likely that its firmware is incompatible to USB3. See #25. I can recommend you the Dell MS116 as a very nice and recent Dell mouse.

sriemer commented 1 year ago

Issue is not relevant anymore. So closing.