Ubuntu 20.04: Scroll wheel doesn't work for wireless mouse after system wakes up or when first plugged-in
Solution 1:
modprobe
doesn't help here, the best chance is to reset the USB bus for this malfunctioning or missing device.
Look for the USB ID in the form of VID:PID of the device with lsusb
. Install usbutils
and issue usbreset VID:PID
. After this, the device should be functioning again without unplugging and replugging. The bus reset is not exactly equal, but should be close enough.
To automate this action, make a systemctl service for it:
sudo vim /etc/systemd/system/[email protected]
Paste in these lines, and save the file:
[Unit]
Description="Reset a USB device after system resume"
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
[Service]
Type=oneshot
ExecStart=/usr/bin/usbreset %i
[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
Recall the VID:PID value you got from lsusb
.
For example, maybe it was 0bda:5411
.
Enable/start the service by running a command like: sudo systemctl start reset-usb-upon-wake@VID:PID.service
, such as sudo systemctl start reset-usb-upon-wake@0bda:5411.service
.
This way, even if you have multiple devices that need this kind of service, they can all use this single service file.