Fix Lenovo Thinkpad T480s USB mouse/keyboard not working after waking up from suspend.

I had an issue with my T480s recently when running Ubuntu 21.10. The laptop suspends properly and can be woken with the USB keyboard but right after waking up the USB keyboard and mouse do not work. Here’s the workaround.

After some research and trial error I noticed that I can manually remove and reinsert the usbhid kernel module (using the laptop’s own keyboard) to get the USB mouse and keyboard to function again. All that was left was to make this run automatically after waking up from suspend.

Create a new file in /lib/systemd/system-sleep and call it something like myusbhidfix. The following content removes the usbhid module when you suspend the laptop and loads it back up when the laptop wakes. I think both steps can also be implemented together in one post line but it doesn’t matter.

#!/bin/bash
[ "$1" = "post" ] && exec modprobe usbhid
[ "$1" = "pre" ] && exec rmmod usbhid
exit 0

Make this new file executable. (chmod +x myusbhidfix).


168 Words

2022-04-03 00:00 +0000