Mouse use is delayed when connecting via USB

I’m using a generic USB switch. It has 4 USB ports and will connect to two computers, pressing the button on top will switch the inputs between the two.

I have used it for years without issue going between a Windows and Mac computer. I recently started using it with my EndeaverOS desktop and a Mac. Pressing the button to go from Endeaver → Mac allows the Mac to make use of the keyboard/mouse immediate. Going from Mac → Endeaver incurs a 10+ second delay before the inputs are available.

I have ruled out it being the switch itself, as the same delay occurs if I plug the mouse directly into USB, unplug it, and plug it back in.

Mouse: Logitech G903
Have Piper installed- tried also installing Solaar but it is not compatible with the G903 via USB (at least I couldn’t get it to appear).

dmesg has some interesting logs. When I switch input with the USB switch it finds the hub, finds the mouse and keyboard, then hangs until the mouse gives a disconnect message at which point it’s usable with the system. Although interestingly enough if I switch and then immediately switch back (less than 1-2 seconds) the mouse is still usable 90% of the time- even if I see dmesg show the USB disconnect message. Anything longer than 1-2 seconds before switching back does trigger the delay though.

Here is the dmesg output starting with when I press the switch to go to another system, then waiting ~6 seconds to reattach it to EndeaverOS.

[28432.792715] usb 5-4: USB disconnect, device number 18
[28432.792724] usb 5-4.2: USB disconnect, device number 19
[28433.174556] usb 5-4.4: USB disconnect, device number 20
[28439.123338] usb 5-4: new high-speed USB device number 21 using xhci_hcd
[28439.265026] usb 5-4: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
[28439.265033] usb 5-4: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[28439.265037] usb 5-4: Product: USB 2.0 Hub
[28439.318573] hub 5-4:1.0: USB hub found
[28439.318896] hub 5-4:1.0: 4 ports detected
[28439.716675] usb 5-4.2: new full-speed USB device number 22 using xhci_hcd
[28439.949412] usb 5-4.2: New USB device found, idVendor=046d, idProduct=c33c, bcdDevice=19.01
[28439.949419] usb 5-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[28439.949421] usb 5-4.2: Product: G513 RGB MECHANICAL GAMING KEYBOARD
[28439.949424] usb 5-4.2: Manufacturer: Logitech
[28439.949425] usb 5-4.2: SerialNumber: 066639593435
[28440.034784] input: Logitech G513 RGB MECHANICAL GAMING KEYBOARD as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.2/5-4.2:1.0/0003:046D:C33C.0020/input/input64
[28440.090274] hid-generic 0003:046D:C33C.0020: input,hidraw2: USB HID v1.11 Keyboard [Logitech G513 RGB MECHANICAL GAMING KEYBOARD] on usb-0000:31:00.3-4.2/input0
[28440.096864] input: Logitech G513 RGB MECHANICAL GAMING KEYBOARD Keyboard as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.2/5-4.2:1.1/0003:046D:C33C.0021/input/input65
[28440.153521] hid-generic 0003:046D:C33C.0021: input,hiddev98,hidraw3: USB HID v1.11 Keyboard [Logitech G513 RGB MECHANICAL GAMING KEYBOARD] on usb-0000:31:00.3-4.2/input1
[28440.350012] usb 5-4.4: new full-speed USB device number 23 using xhci_hcd
[28440.582415] usb 5-4.4: New USB device found, idVendor=046d, idProduct=c086, bcdDevice= 7.02
[28440.582424] usb 5-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[28440.582428] usb 5-4.4: Product: Logitech G903 Wired/Wireless Gaming Mouse
[28440.582432] usb 5-4.4: Manufacturer: Logitech
[28440.582435] usb 5-4.4: SerialNumber: 0E60385E3138
[28440.673741] input: Logitech Logitech G903 Wired/Wireless Gaming Mouse as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.4/5-4.4:1.0/0003:046D:C086.0022/input/input68
[28440.673903] logitech-hidpp-device 0003:046D:C086.0022: input,hidraw5: USB HID v1.11 Mouse [Logitech Logitech G903 Wired/Wireless Gaming Mouse] on usb-0000:31:00.3-4.4/input0
[28440.681047] input: Logitech Logitech G903 Wired/Wireless Gaming Mouse as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.4/5-4.4:1.1/0003:046D:C086.0023/input/input69
[28440.736807] logitech-hidpp-device 0003:046D:C086.0023: input,hiddev100,hidraw6: USB HID v1.11 Keyboard [Logitech Logitech G903 Wired/Wireless Gaming Mouse] on usb-0000:31:00.3-4.4/input1
[28451.009981] logitech-hidpp-device 0003:046D:C086.0023: Device not connected

Journactl logs do show an issue with libusb and udev, but I’m not sure how to dig deeper into what might be the cause there:

Nov 07 16:52:01 zack-bebop kernel: usb 5-4: new high-speed USB device number 30 using xhci_hcd
Nov 07 16:52:02 zack-bebop kernel: usb 5-4: New USB device found, idVendor=1a40, idProduct=0101, bcdDevice= 1.11
Nov 07 16:52:02 zack-bebop kernel: usb 5-4: New USB device strings: Mfr=0, Product=1, SerialNumber=0
Nov 07 16:52:02 zack-bebop kernel: usb 5-4: Product: USB 2.0 Hub
Nov 07 16:52:02 zack-bebop kernel: hub 5-4:1.0: USB hub found
Nov 07 16:52:02 zack-bebop kernel: hub 5-4:1.0: 4 ports detected
Nov 07 16:52:02 zack-bebop usbmuxd[87993]: libusb: error [udev_hotplug_event] ignoring udev action change
Nov 07 16:52:02 zack-bebop kernel: usb 5-4.2: new full-speed USB device number 31 using xhci_hcd
Nov 07 16:52:02 zack-bebop kernel: usb 5-4.2: New USB device found, idVendor=046d, idProduct=c33c, bcdDevice=19.01
Nov 07 16:52:02 zack-bebop kernel: usb 5-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 07 16:52:02 zack-bebop kernel: usb 5-4.2: Product: G513 RGB MECHANICAL GAMING KEYBOARD
Nov 07 16:52:02 zack-bebop kernel: usb 5-4.2: Manufacturer: Logitech
Nov 07 16:52:02 zack-bebop kernel: usb 5-4.2: SerialNumber: 066639593435
Nov 07 16:52:02 zack-bebop kernel: input: Logitech G513 RGB MECHANICAL GAMING KEYBOARD as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.2/5-4.2:1.0/0003:046D:C33C.002C/input/input82
Nov 07 16:52:02 zack-bebop kernel: hid-generic 0003:046D:C33C.002C: input,hidraw2: USB HID v1.11 Keyboard [Logitech G513 RGB MECHANICAL GAMING KEYBOARD] on usb-0000:31:00.3-4.2/input0
Nov 07 16:52:02 zack-bebop kernel: input: Logitech G513 RGB MECHANICAL GAMING KEYBOARD Keyboard as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.2/5-4.2:1.1/0003:046D:C33C.002D/input/input83
Nov 07 16:52:02 zack-bebop kernel: hid-generic 0003:046D:C33C.002D: input,hiddev98,hidraw3: USB HID v1.11 Keyboard [Logitech G513 RGB MECHANICAL GAMING KEYBOARD] on usb-0000:31:00.3-4.2/input1
Nov 07 16:52:03 zack-bebop kernel: usb 5-4.4: new full-speed USB device number 32 using xhci_hcd
Nov 07 16:52:03 zack-bebop kernel: usb 5-4.4: New USB device found, idVendor=046d, idProduct=c086, bcdDevice= 7.02
Nov 07 16:52:03 zack-bebop kernel: usb 5-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 07 16:52:03 zack-bebop kernel: usb 5-4.4: Product: Logitech G903 Wired/Wireless Gaming Mouse
Nov 07 16:52:03 zack-bebop kernel: usb 5-4.4: Manufacturer: Logitech
Nov 07 16:52:03 zack-bebop kernel: usb 5-4.4: SerialNumber: 0E60385E3138
Nov 07 16:52:03 zack-bebop kernel: input: Logitech Logitech G903 Wired/Wireless Gaming Mouse as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.4/5-4.4:1.0/0003:046D:C086.002E/input/input86
Nov 07 16:52:03 zack-bebop kernel: logitech-hidpp-device 0003:046D:C086.002E: input,hidraw5: USB HID v1.11 Mouse [Logitech Logitech G903 Wired/Wireless Gaming Mouse] on usb-0000:31:00.3-4.4/input0
Nov 07 16:52:03 zack-bebop kernel: input: Logitech Logitech G903 Wired/Wireless Gaming Mouse as /devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.4/5-4.4:1.1/0003:046D:C086.002F/input/input87
Nov 07 16:52:03 zack-bebop kernel: logitech-hidpp-device 0003:046D:C086.002F: input,hiddev100,hidraw6: USB HID v1.11 Keyboard [Logitech Logitech G903 Wired/Wireless Gaming Mouse] on usb-0000:31:00.3-4.4/input1
Nov 07 16:52:03 zack-bebop kernel: logitech-hidpp-device 0003:046D:C086.002F: HID++ 4.2 device connected.
Nov 07 16:52:03 zack-bebop mtp-probe[92134]: checking bus 5, device 32: "/sys/devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.4"
Nov 07 16:52:03 zack-bebop mtp-probe[92134]: bus: 5, device: 32 was not an MTP device
Nov 07 16:52:03 zack-bebop mtp-probe[92135]: checking bus 5, device 31: "/sys/devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.2"
Nov 07 16:52:03 zack-bebop mtp-probe[92135]: bus: 5, device: 31 was not an MTP device
Nov 07 16:52:03 zack-bebop usbmuxd[87993]: libusb: error [udev_hotplug_event] ignoring udev action change
Nov 07 16:52:03 zack-bebop usbmuxd[87993]: libusb: error [udev_hotplug_event] ignoring udev action change
Nov 07 16:52:03 zack-bebop systemd-logind[983]: Watching system buttons on /dev/input/event9 (Logitech G903 Wired/Wireless Gaming Mouse)
Nov 07 16:52:03 zack-bebop systemd-logind[983]: Watching system buttons on /dev/input/event5 (Logitech G513 RGB MECHANICAL GAMING KEYBOARD)
Nov 07 16:52:03 zack-bebop systemd-logind[983]: Watching system buttons on /dev/input/event6 (Logitech G513 RGB MECHANICAL GAMING KEYBOARD Keyboard)
Nov 07 16:52:03 zack-bebop mtp-probe[92155]: checking bus 5, device 32: "/sys/devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.4"
Nov 07 16:52:03 zack-bebop mtp-probe[92156]: checking bus 5, device 31: "/sys/devices/pci0000:00/0000:00:08.1/0000:31:00.3/usb5/5-4/5-4.2"
Nov 07 16:52:03 zack-bebop mtp-probe[92155]: bus: 5, device: 32 was not an MTP device
Nov 07 16:52:03 zack-bebop mtp-probe[92156]: bus: 5, device: 31 was not an MTP device
Nov 07 16:52:04 zack-bebop kcminit[92160]: Initializing  "/usr/lib/qt/plugins/plasma/kcms/systemsettings/kcm_mouse.so"
Nov 07 16:52:04 zack-bebop kcminit[92160]: Initializing  "/usr/lib/qt/plugins/plasma/kcms/systemsettings/kcm_touchpad.so"
Nov 07 16:52:04 zack-bebop kcminit[92160]: kcm_touchpad: Using X11 backend

Any thoughts are greatly appreciated. I think one workaround would be to get a KVM with DDM/emulation so that Endeaver never sees it “disconnect” and cause the reconnect hang.

Interesting behavior I just noticed. If I perform the switch at the EndeavorOS login/lock screen the switch is instant. So it seems to be something related to being logged in on the desktop.

edit
Just kidding, that behavior isn’t consistent.

I have weird mouse issues too. Until i can find a better fix I do the following

  1. open termina
  2. bluetoothctl
  3. power off
  4. power on
  5. wait for mouse to connect
  6. unblock
  7. exit bluetoothctl

mouse works fine after that . . .

Try a different mouse