I'm using a KVM-switch like setup to share my keyboard and mouse between a Windows machine and a Linux machine.
I have a Logitech Mouse and Corsair (K95-RGB) Keyboard (ironically both devices made and optimized for windows with only windows-side official driver support...) and the problem is that when I switch the devices from Windows (or offline) to Linux, Linux picks up that the devices are plugged in and activates them immediately, I can use the devices within 1 second no matter how recently I last switched or which state the devices were in previously.
When I switch from Linux (or offline) to Windows, Windows can take an awful amount of time to first detect the devices, and another awful lot of time to actually enable them...
According to my Windows clock (I counted), roughly 38 seconds for device detection (powering on), and another 17 seconds (update: on a re-test later on I found the mouse activating in ~15s and keyboard 5 secs later, or in ~20s) for device activation (e.g. for the driver to kick in properly, so from the time I switch to windows I waited 55 seconds before I could use the devices) this time was the same for both my Keyboard and Mouse despite using separate driver software and being completely different devices.
So what takes Linux effectively around 1 second to do, windows takes up to 1 minute to do, usually in the range of 40-60 seconds based on my experience over roughly half a month.
To further clarify things. The first 35-40 seconds that Windows takes to power on/detect the devices only happens if the devices were recently disconnected. Basically what is happening is that when I disconnect the devices (switch away from Windows) windows takes 35-40 seconds to acknowledge that the devices have been disconnected (making the device disconnected sound). If I switch back to windows after this point, the devices are detected/powered on immediately, but still take a good 15-20 seconds to be usable (for the drivers to work).
Question #1 is whether I can somehow hasten the driver enablement for the devices after they have been detected and powered on? (Maybe somehow prevent the drivers from being unloaded completely in the first place? Or offload them to a RAMDisk for faster load? Something else?)
Question #2. Can I somehow reduce the time(out?) before Windows disconnects the devices after they have been unplugged (switched to another computer)? I'd prefer this to be as close to instant as possible.
Extra Info:
My setup is as follows (from computer to devices)
- USB 2.0 Port
- USB 1.X USB Switch
- USB 2.0, 4 Port Manhattan Powered USB Hub
- Corsair K95-RGB Keyboard (uses 2 USB Ports, one for extra power)
- Logitech G402 Hyperion Fury Mouse
- Wacom CTH-680 Tablet.
Tests:
I tested the same switch/hub setup on Linux and in the UEFI BIOS, none of the issues on Windows were observed (except that the keyboard and keyboard alone takes a few seconds to be re-detected by the ckb driver, what this means is that macro/extra keys don't work until after a few seconds on Linux for the keyboard. Otherwise everything works perfectly in <1s)
I decided to test plugging my mouse alone directly in since it's the easiest and on the first connect it exhibited a similar behavior of a roughly ~50 second wait before the mouse was usable (much of this time was again waiting for it to be detected and powered in the first place). If I repeated this test afterwards by unplugging the mouse and plugging it back in, it was instantly activated/usable, and similarly if I unplugged it then and plugged it into the already active USB hub, it was again instantly activated. But if I used the switch to turn the devices off/on it reverts to the same pattern as before. (Plug and play works best if you are not disconnecting/reconnecting an entire hub with several devices connected)
I tried switching the usb switch off of windows, waiting for Windows to disconnect the devices (~40s) and playing the device disconnect sound, at which point I switched back to windows, device detection was instant but driver load still took 15-20 seconds. (Wacom untested) mouse and keyboard become usable at the exact same time despite the keyboard driver being seemingly more complex and should probably be taking longer to load than the mouse (it's kind of like no device can work until all the devices connected to the hub have had their drivers loaded, may just be coincidence though).
I tried booting in safe mode (generic drivers only), in here the device disconnect still took ~40s but the driver activation after detection took <1s for the mouse and <5s for the keyboard (much faster than the ~17s for both; but in light of this I decided to re-test the activation time after detection for both devices after booting out of safe mode, and true enough, this time the keyboard took around 5 seconds longer than the mouse to load the drivers (mouse ~15s, keyboard ~20s).
I ran another test after uninstalling the Corsair Utility Engine (keyboard drivers) the keyboard did not initialize any faster (still took ~20s). After a restart, the keyboard would activate almost as fast as it did in safe mode. I then re-installed the Corsair Utility Engine and tried again, and with the corsair drivers active it was fast again. I rebooted, and things went back to the way they were before. I uninstalled the corsair utility engine again, and despite it being uninstalled, the keyboard does not initialize fast anymore. Further testing lead me to conclude that I can uninstall the corsair specific keyboard drivers and use the generic ones instead (with the corsair utility engine still running and activating the leds) and this gives me enough speed boost so that driver enablement takes 5s (mouse) and ~10s (keyboard), however this solution is not an option for me since it means my keyboard would not function correctly.