You are not logged in.

#1 2021-07-24 08:28:07

MaddyBoo
Member
From: Portland, OR
Registered: 2017-05-02
Posts: 10
Website

How can I speed up USB connection times?

I've got a USB switch that I use to switch my keyboard/mouse/yubikey between my Arch Linux desktop and macOS laptop. It works great, but I'm a bit unhappy with how long Linux takes to enumerate and initialize the keyboard when switching from the laptop to the desktop (macOS -> Linux). When I switch to my laptop, macOS initializes the keyboard in under half a second, but when switching to my desktop, Linux takes over 2.5 seconds until the keyboard is usable which feels sluggish. My desktop is significantly more powerful and has a higher clock speed than the laptop, so I don't think this is arising from hardware limitations. It may seem a bit picky to be worried about this, but I switch back and forth many dozens of times per day and the delay bothers me.

For reference, the USB switch has 4 devices connected:

|__ USB Switch
    |__ Keyboard Built-in Hub
        |__ Yubikey
        |__ Keyboard
    |__ Teensyduino (Used to trigger the USB switch)
    |__ Wireless mouse dongle

I've tried unplugging all other devices from the switch and that speeds things up slightly, but it's still slower than macOS is with all peripherals still attached.

I am curious to know if there's anything I can do to speed things up. Can I perhaps write a udev rule to prioritize the keyboard when enumerating the new USB devices? I don't care how long the other devices take to connect, only the keyboard.

Here's dmesg during a connection, with the moment the keyboard becomes usable noted:

<-- USB switch triggered (connect to this computer)
[1303544.724556] usb 1-2.1: new high-speed USB device number 89 using xhci_hcd
[1303544.862489] usb 1-2.1: New USB device found, idVendor=14cd, idProduct=8601, bcdDevice= 0.00
[1303544.862494] usb 1-2.1: New USB device strings: Mfr=1, Product=3, SerialNumber=0
[1303544.862496] usb 1-2.1: Product: USB 2.0 Hub
[1303544.862497] usb 1-2.1: Manufacturer: USB Device
[1303544.867532] hub 1-2.1:1.0: USB hub found
[1303544.870490] hub 1-2.1:1.0: 4 ports detected
[1303545.214374] usb 1-2.1.1: new high-speed USB device number 90 using xhci_hcd
[1303545.357530] usb 1-2.1.1: New USB device found, idVendor=2109, idProduct=2812, bcdDevice= d.a0
[1303545.357536] usb 1-2.1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[1303545.357538] usb 1-2.1.1: Product: USB2.0 Hub
[1303545.357540] usb 1-2.1.1: Manufacturer: VIA Labs, Inc.
[1303545.362777] hub 1-2.1.1:1.0: USB hub found
[1303545.365541] hub 1-2.1.1:1.0: 4 ports detected
[1303545.484391] usb 1-2.1.3: new full-speed USB device number 91 using xhci_hcd
[1303545.824373] usb 1-2.1.1.1: new full-speed USB device number 92 using xhci_hcd
[1303545.869575] usb 1-2.1.3: New USB device found, idVendor=046d, idProduct=c52b, bcdDevice=12.11
[1303545.869581] usb 1-2.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[1303545.869583] usb 1-2.1.3: Product: USB Receiver
[1303545.869584] usb 1-2.1.3: Manufacturer: Logitech
[1303546.000078] logitech-djreceiver 0003:046D:C52B.045A: hiddev96,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:01:00.0-2.1.3/input2
[1303546.212992] logitech-hidpp-device 0003:046D:4069.045B: HID++ 4.5 device connected.
[1303546.304362] usb 1-2.1.4: new full-speed USB device number 93 using xhci_hcd
[1303546.309612] usb 1-2.1.1.1: New USB device found, idVendor=[...], idProduct=[...], bcdDevice= [...]
[1303546.309620] usb 1-2.1.1.1: New USB device strings: Mfr=[...], Product=[...], SerialNumber=[...]
[1303546.309623] usb 1-2.1.1.1: Product: Yubikey [...]
[1303546.309625] usb 1-2.1.1.1: Manufacturer: Yubico
[1303546.368283] input: Yubico Yubikey [...]
[1303546.444734] hid-generic [...]: input,hidraw1: USB HID [...] Keyboard [Yubico Yubikey [...]] on usb-[...]
[1303546.454840] hid-generic [...]: hiddev97,hidraw2: USB HID [...] Device [Yubico Yubikey [...]] on usb-[...]
[1303546.576792] usb 1-2.1.4: New USB device found, idVendor=16c0, idProduct=0486, bcdDevice= 2.00
[1303546.576800] usb 1-2.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1303546.576802] usb 1-2.1.4: Product: Teensyduino RawHID
[1303546.576804] usb 1-2.1.4: Manufacturer: Teensyduino
[1303546.576806] usb 1-2.1.4: SerialNumber: 4755050
[1303546.610999] hid-generic 0003:16C0:0486.045E: hiddev98,hidraw3: USB HID v1.11 Device [Teensyduino Teensyduino RawHID] on usb-0000:01:00.0-2.1.4/input0
[1303546.626808] hid-generic 0003:16C0:0486.045F: hidraw4: USB HID v1.11 Device [Teensyduino Teensyduino RawHID] on usb-0000:01:00.0-2.1.4/input1
[1303546.734339] usb 1-2.1.1.4: new full-speed USB device number 94 using xhci_hcd
[1303547.031869] usb 1-2.1.1.4: New USB device found, idVendor=24f0, idProduct=0140, bcdDevice= 1.00
[1303547.031875] usb 1-2.1.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[1303547.031876] usb 1-2.1.1.4: Product: Das Keyboard
[1303547.031878] usb 1-2.1.1.4: Manufacturer: Metadot - Das Keyboard
[1303547.078877] input: Metadot - Das Keyboard Das Keyboard as /devices/pci0000:00/0000:00:01.1/0000:01:00.0/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1.4/1-2.1.1.4:1.0/0003:24F0:0140.0460/input/input596
[1303547.154659] hid-generic 0003:24F0:0140.0460: input,hidraw5: USB HID v1.10 Keyboard [Metadot - Das Keyboard Das Keyboard] on usb-0000:01:00.0-2.1.1.4/input0
[1303547.207863] input: Metadot - Das Keyboard Das Keyboard System Control as /devices/pci0000:00/0000:00:01.1/0000:01:00.0/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1.4/1-2.1.1.4:1.1/0003:24F0:0140.0461/input/input597
[1303547.284465] input: Metadot - Das Keyboard Das Keyboard Consumer Control as /devices/pci0000:00/0000:00:01.1/0000:01:00.0/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1.4/1-2.1.1.4:1.1/0003:24F0:0140.0461/input/input598
[1303547.284556] hid-generic 0003:24F0:0140.0461: input,hidraw6: USB HID v1.10 Device [Metadot - Das Keyboard Das Keyboard] on usb-0000:01:00.0-2.1.1.4/input1
<-- Keyboard becomes usable (t = 2.56s)
[1303547.541271] input: Logitech MX Master 2S as /devices/pci0000:00/0000:00:01.1/0000:01:00.0/usb1/1-2/1-2.1/1-2.1.3/1-2.1.3:1.2/0003:046D:C52B.045A/0003:046D:4069.045B/input/input599
[1303547.541570] logitech-hidpp-device 0003:046D:4069.045B: input,hidraw7: USB HID v1.11 Keyboard [Logitech MX Master 2S] on usb-0000:01:00.0-2.1.3/input2:1
$ uname -srm
Linux 5.12.15-1-ck-zen x86_64

I use Sway, but I don't think that's where the bottleneck is because I've tested from a TTY and get similar results.

Last edited by MaddyBoo (2021-07-24 08:30:50)

Offline

#2 2024-08-28 02:01:52

xx_chungus
Member
Registered: 2024-08-28
Posts: 1

Re: How can I speed up USB connection times?

Hi, wondering if you ever figured anything out. I'm switching every 10 or so minutes and windows is noticeably faster to pick up my mouse and keyboard.

Offline

Board footer

Powered by FluxBB