31

This seems like a common problem, but after trying all of the fixes I've found on forums, I'm still at a loss.

Specs:

  • computer: Asus k501LX-EB71
  • OS: Ubuntu 14.04.3
  • kernel: 3.19.0-26-generic
  • touchpad: Elantech touchpad
  • driver: xserver-xorg-input-synaptics-lts-trusty (OR) xserver-xorg-input-synaptics-lts-vivid (not sure which one is in use)

What I've tried: I can run sudo modprobe -r psmouse to "turn off" the touchpad, and then sudo modprobe psmouse to turn it back on. This works fine. However when I suspend, I can't "revive" the touch pad, even if I enter these commands.

Any thoughts?

UPDATE:

I don't observe this problem if I hibernate instead of suspend. I'm not sure what to make of that clue...

CURRENT WORKAROUND:

Since hibernate seems to not cause a problem and I have an appropriate amount of swap memory, I just hibernate as the default action for things like closing the lid. Here are the steps I followed to enable hibernate. I also modified other default power settings to go to hibernate using the dconf Editor under org>gnome>settings-daemon>plugins>power

Ross Allen
  • 1,609

10 Answers10

24

The following solution worked for me on my Acer Predator Helios 300 running Ubuntu 18.04 (5.0.0-36-generic) when all else did not-

Check if the solution works
Try running the following command after waking up from suspend when your trackpad is not working- /sbin/rmmod i2c_hid && /sbin/modprobe i2c_hid.
If this makes your trackpad work, follow the below steps to create an automatic solution that runs this everytime you wake up from suspend.

Permanent Solution
1. Create /lib/systemd/system-sleep/touchpad
2. Open the above file and edit it, sudo vi /lib/systemd/system-sleep/touchpad
3. Save the following content in the file-

#!/bin/sh

case $1 in
  post)
    /sbin/rmmod i2c_hid && /sbin/modprobe i2c_hid 
  ;;
esac
  1. Make it executable- chmod +x /lib/systemd/system-sleep/touchpad

This basically restarts the i2c_hid device upon waking up from suspend.

Courtesy: https://unix.stackexchange.com/a/526488/283735

nihal111
  • 341
  • 2
  • 2
22

This bug is reported in launchpad: Elantech touchpad stops working after suspend. After suspend the OP tries # modprobe -r psmouse and # modprobe psmouse and it doesn't work. But what if psmouse was removed before suspend and inserted after suspend?

If this works manually then you can automate by creating a new file in the /lib/systemd/system-sleep/ directory containing:

#!/bin/sh

case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0` if no pre suspend action required
    modprobe -r psmouse
    ;;
  post/*)
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required
    sleep 2
    modprobe psmouse
    ;;
esac

It is known after a suspend the psmouse module can't be removed. We also know it can be removed and inserted before a suspend. So this technique removes it before suspend. After resume insert it and hopefully the kernel won't reject it.

The sleep 2 command is from my own problems where systemd and kernel (via gnome or APM) were both sleeping and waking up. I needed to redirect pulseaudio sound back to the TV due to a bug introduced in Ubuntu 16.04/pulseaudio 8.0. The 2 second delay was necessary for kernel and systemd to finish waking up. Still haven't figured out the dual suspend and dual resume yet....

10

I deal with two simple approaches with this issue. The first, which not always works (as you mentioned) just restarts the mouse module after the suspend action.

sudo rmmod psmouse ; sudo modprobe psmouse

Here is a nice discussion on how to do this "automatically": how to execute a command after resume from suspend?

An alternative approach is to kill the module before suspend, avoiding to lock of the module after the resume (which apparently is what generates the issue, as WinEunuuchs2Unix underlined).

To do that I use a simple command line to suspend the laptop instead of just closing the lid "manually". Of course this is not fancy at all, but works and it is a straigh forward solution. No time to hack involved.

sudo rmmod psmouse ; sudo pm-suspend

And then, after resuming the laptop, you should re-enable the module by typing:

sudo modprobe psmouse

You can always hack the default pm-suspend script, but I won't recommend it. It is simple and safer to generate these ad-hoc small command sequences.

Last, an easy, fast way to quickly do the "killing/suspend" and the "re-enable" of the mouse module is to associate those steps with keyboard shortcuts: How can I change what keys on my keyboard do? (How can I create custom keyboard commands/shortcuts?).

Hope it works, it does for me, although is really uncomfortable to deal with this in such way. I have this issue in both, HP and Asus Laptops.

Rho
  • 1,244
  • 1
  • 12
  • 21
7

It was recommended that I post my workaround as an answer:

I found that hibernate (sudo pm-hibernate) did not experience the same problems with touchpad restarting, therefore I just set all relevant power options to hibernate instead of suspend. This requires a little bit of effort since hibernate is disabled by default. Here's what needs to happen

Ross Allen
  • 1,609
1

I have a Lenovo IdeaPad S340 with an Elan touchpad and I am running Ubuntu 18.04. After resuming from suspend the touchpad is barely working as it is very jittery and it is almost impossible to get the cursor to go where you want. The touchpad uses the i2c_hid driver. I created a script to restart the driver on wake from suspen d as suggested by nihal111 and it works.

I'd like to add that to get the touchpad to be recognised at all, I had to disable secure boot, switch to EFI booting (disable legacy boot) and add kernel parameter i8042.nopnp to grub config. Not 100% sure that I needed all three of them, but after doing that it started working. The wake from suspend fix sorted out the final issues, and it is now working great!

1

Patching the kernel will solve this problem. You can find

  1. the patch on the Linux kernel mailing list and

  2. patching instructions at “How to patch the kernel with a specific commit”.

My K501LB now works as it should.

David Foerster
  • 36,890
  • 56
  • 97
  • 151
1

This worked for me:

  1. Boot into BIOS, on system boot-up hold F2 or ESC

  2. Change the Touchpad setting in your BIOS from ADVANCED to BASIC (makes no difference with regards to functionality)

Now the touchpad should still work when resumed from suspend.

pst007x
  • 8,210
0

The various modprobe solutions didn't work for me. What did work was switching to a text-only tty and then back to graphics, with Ctrl+Alt+F3 and then Ctrl+Alt+F2. Note that switching to a different graphical session with Ctrl+Alt+F1 and then back to my original graphical session with Ctrl+Alt+F2 didn't work.

Note: the F<number>s for your system might be different. E.g. in the past I remember that the graphical sessoin was F7.

ntc2
  • 700
0

I have several Asus laptops, I have had to disable the touchpad on all of them. They cause locking issues, and other problems.

0

Drivers that don't respond well to suspension are pretty common regardless of the OS. I'm glad you found a workaround via hibernation.

Since suspend doesn't fully power off and hibernation does, that would appear to indicate that the driver doesn't respond well to the "1/2 life" of suspension, but is perfectly capable of coming up during a power-on cycle which is what hibernation provides upon waking.

source: http://manpages.ubuntu.com/manpages/trusty/man8/pm-action.8.html

Elder Geek
  • 36,752