Lenovo Ideapad S340 touchpad inactive after resume

it has been a while since this question was asked, but not so long that i thought starting a new thread was really necessary. i had a similar issue with slight loss of touchpad functionality on my thinkpad W540 (some of which i detailed here) running bodhi linux 5.1.0 which is based on ubuntu 18.04. i was reviving mine with similar commands: sudo modprobe -r psmouse && sudo modprobe psmouse.

that worked just fine and restored full functionality, but i was also searching for a way to get my system to effectively reset it self after waking from suspend. i tried similar methods to add commands to post-suspend wakeup without any luck. after some helpful discussion with @Tech_JA (as well as pointers in the linked thread from @Akito) and reading through some logs (most notably /var/log/pm-suspend.log), i realized there were some hooks (or commands) that the system was running as it woke up from suspend. for my system those hooks were located in /usr/lib/pm-utils/sleep.d.

the highest number hook (95) ran first and the lowest (000) ran last. i read through the other hooks to get an idea about what format worked (most all used #!/bin/sh instead of /bash for example) and decided try adding my hook after 00logging to make sure i could see it in case there were any errors or other issues.

i named my file 0000touchpad-mod and these were the contents:

#!/bin/sh
# modprobe psmouse off and back on

touchpad_mod()
{
        /sbin/modprobe -r psmouse && /sbin/modprobe psmouse
}

case "$1" in
	resume)
		touchpad_mod
		;;
esac

i ran chmod +x on the file to make sure it was executable.

i thought it would be better to restart the system entirely to ensure the possible solution had the best chance of success, but since i was already up and running i decided to suspend and see what happened. luckily, it worked as intended. the system ran my hook after all of the others and my touchpad had full functionality with no manual intervention.

i did reboot just to make sure the change survived that. then i waited a week to make sure i hadn’t done anything that would inadvertently have ill effects on my system. so far (knock on wooden head) it has worked perfectly every time and i now don’t even realize it runs in the background.

2 Likes