When I was working at my Govt job, I had a ton of electronics to repair. One of my maintenance friends gave me a bottle of clear liquid (not Vodka…that’s another story). They would paint this liquid on small electronic connectors. It would expand, and secure the connection, and would also act as part of the connection, as if it was copper or other transmittable metals. Don’t know the name of it now, but I know it was very expensive. The connections never came apart.
I did buy some 4" usb extensions to leave in my usb ports, just as not to wear out the ports.
Came to think of it, some of the crashes I have had was because I use a USB hub, as both the Focusrite and the keyboard has USB A plugs, but I have USB C in my laptop. I also power the laptop through the hub, and if power to the hub for some reason is disconnected (cough cough drummer fiddling with cables cough) then the Focusrite boots and causes the crash. So it might not be the USB connection that is to blame - depending on your setup.
Follow-up on the Focusrite angle on this - I ended up posting a support request with Focusrite, and they suggested a newer driver than the one recommended for my version of the Scarlett 2i4 - and it helped. No BSOD, just the driver that dies, but that was easier to remedy than having to wait for the diagnostic tools to run after a BSOD.
I’ve run into similar issues.
I’ve had good luck by referring the usb connector to the laptop using Velcro. Keeps it from moving much but still can be disconnected.
I really wish there was a USB connection that would truly lock in. I know part of the reason they don’t is so people don’t ruin the computer-side connector when they grab their laptops without unplugging the peripherals
The USB-C connectors have a locking mechanism that is really lame.
I had a friend many moons ago who used to put together racks for touring bands. One of the things he would do to keep things connected was Apply a little dab of silicone caulk on the 1/4” jack and plug so they wouldn’t come out do to bumping and road vibration.
I have used my favorite DIY material, Instamorph - Moldable Plastic (I buy it on Amazon). While its’ warm I glom it on like chewing gum around the USB port (with the cable inserted) - then it hardens - not perfect but lessens movement. I really only use it for worn USB ports that really should be replaced.