Weird USB issue on laptop wakeup

Most of the time, my laptop is connected to a dock via USB-C. Every so often I’ll close the lid and disconnect to bring it someplace. All good there. I then close the lid to put it to sleep, let it go a few hours reconnect it to my dock and wake it up. However when I do so, the USB devices on the dock are not seen. The laptop devices are all there, but not the ones on the dock. In a terminal window lsusb doesn’t see the devices. But when I run lspci, it rescans the buses, and then everything magically appears.

How do I get my laptop to properly rescan for devices whenever it wakes up from sleep? Or if it is scanning for devices, then maybe its a timing issue where the docking station isn’t fully available when the scan runs?

Running Ubuntu 22.04.4 LTS on a framework 16 with a Dell WD19 dock connected to the backmost USB-C port on the right side (facing the screen) of the laptop.

It’s not falling-off-a-log simple, but there is a way to run a user-defined script when the system wakes from sleep. That should do the trick, maybe combined with a call to sleep in your script to delay the scan for a few seconds.

My assumption is that I’m not the only person with a laptop that closes the lid and opens it. I would expect that this problem is more wide spread and that there is actual code or a solution for it.

If not, there is the potential this is a framework issue. Something with how this laptop starts up that isn’t accounted for in the firmware properly.