138

I use Ubuntu 14.04 on a laptop, usually with an external usb mouse and keyboard and screen connected. Sometimes, however, I unplug all of them and move the laptop and keep using it with the builtin keyboard and screen and touchpad.

At random times it happens that the touchpad stops working (but if I plug the usb mouse, the usb mouse does work). Though this happens very rarely, when it does it's a great annoyance, as I'm forced to reboot if I need the touchpad to work again.

Is there some workaround that I can try, such as killing some process that would automatically restart, or some command that would cause the touchpad driver to restart or refresh or something? Anything that may "wake up" the touchpad without having to reboot?

matteo
  • 2,491

16 Answers16

125

To restart the laptop's touchpad driver:

Open terminal by pressing Ctrl+Alt+T and execute the following command

sudo  modprobe -r psmouse

then

sudo modprobe psmouse
maruf
  • 1,419
100

I found a way to do this:

First, open a terminal, and print out all input devices to find the id you need for the input device you want to disable. In terminal, type:

xinput --list

Next: Notice where it says id=X in one long column for every input device. You want to find the device id that corresponds to the input device you want to disable (Maybe something that sounds like "touchpad"). Then replace X in the following command with the id number representing the input device you want to disable:

xinput disable X

Note: If you're not sure which device id you should use to disable the touchpad, then you can find out by testing random id's and seeing if your mouse pad still works. Make sure you are NOT DOING ANYTHING IMPORTANT. Save all your work and be prepared to restart your computer if you do something like disable your keyboard. (You may have trouble trying to enable it again if you can't type into the terminal.

Then you'll have to run this last line (Thanks for catching this Arch Stanton!)

xinput enable X

Reason: I desperately needed an answer to this problem because the problems I was experiencing with my touchpad made doing any kind of work impossible. Suddenly, at some random moment when using my laptop, for apparently no reason, my touchpad goes into some kind of "special mode". Merely moving one finger on my touchpad would cause the screen to scroll, instead of actually moving the cursor of the mouse on the screen so it was impossible to get the mouse to hover over anything in broswer without considerable coordinating efforts to account for the scrolling screen and non moving mouse. I wanted to find a way, WITHOUT RESTARTING THE LAPTOP, to reset the touchpad. On the plus side, resetting the touchpad with the method above actually fixes my problem.

Update: To make resetting the touchpad even easier, I made a hotkey for the above listed commands. When my touchpad goes on the fritz, I simply do the key combination ctrl+super+r and it does the reset for me. Quick and easy.

Here's how:

-Create a file inside your home directory and call it something like "touchpad-reset.sh".

-Inside this file, put in two of the three (the last two) previous commands listed above except, instead of using an X id number for the device, since it's subject to change with added peripherals (maybe??) you can do use this instead:

Here's an output from my computer inside the terminal using this commmand:

xinput --list

Result:

Virtual core pointer                        id=2    [master pointer  (3)]⎜   
   ↳ Virtual core XTEST pointer                 id=4    [slave  pointer  (2)]⎜   
   ↳ Genius 2.4G Wireless Mouse                 id=10   [slave  pointer  (2)]⎜   
   ↳ MSFT0001:00 06CB:75BD UNKNOWN              id=13   [slave  pointer  (2)]⎜   
   ↳ ELAN Touchscreen                           id=12   [slave  pointer  (2)]⎜ 

-Now what you do, you replace the X (which was an id before) for xinput disable X and xinput enable X with the name corresponding to that id inside single quotes. For example, from the above, if you wanted to do it for id=13, my touchpad device, you would use:

xinput disable 'MSFT0001:00 06CB:75BD UNKNOWN'
xinput enable 'MSFT0001:00 06CB:75BD UNKNOWN'

-So now, you're disabling by name instead of ID number, where an id may possibly change in time and then you'd be disabling and enabling some other device.

Finally, you need to give the permissions to make this file executable; run this command with your working directory in the terminal as your home directory (where you created the file):

chmod +x your_script_name.sh

So once you make this file with the appropriate commands written inside, making sure it's in your home directory, take the following steps below:

  1. Press the super key (windows key on PC) on keyboard to bring up the unity side bar. Type in 'system settings' and press the enter key.
  2. Find the 'Keyboard' option under where it says 'Hardware' and click on it.
  3. Select the 'Shortcuts' tab.
  4. In the left window, select 'Custom Shortcuts'
  5. Click on the + button near the bottom center.
  6. A window should pop up asking for a description name and a command to put in.
  7. Make the name something like "reset touchpad"
  8. Use this command: gnome-terminal -x ./name_of_your_script.sh
  9. Click on 'Apply'
  10. You should now see your shortcut listed and on the far right it should say "Disabled" or some other garbage. Click on that text and be prepared to make some kind of key combination, perhaps like ctrl+super+r.
  11. Once you make this key combination, you're done.

Congrats! Have fun.

user3499524
  • 1,109
  • 1
    Then you'll have to run xinput enable X. – Arch Stanton Dec 16 '15 at 15:21
  • Ah-ha! Did i forget to put that in there? Shoot.

    Thanks for adding that in there. Just like me to blow it in the end.

    – user3499524 Dec 19 '15 at 01:32
  • Ahah nevermind, you saved me :-) – Arch Stanton Dec 19 '15 at 11:09
  • xinput list + disable + enable works great – axel22 Mar 02 '16 at 18:40
  • 3
    enable/disable also work with ID only instead of device name – Z. Zlatev Feb 06 '17 at 07:34
  • My touchpad (dell xps 13) has recently starting falling into 2-finger-mode (which means one finger causes it to scroll, etc) which makes it impossible to move the mouse or left click. Installing xinput then disabling / re-enabling the touchpad is the only reliable fix I've found. Thank you! – Mala Jan 28 '18 at 17:48
  • 1
    Thanks. This solution worked for me. And I didn't even need to restart my computer. My touchpad was troubling me. I think xinput disable/enable is a quick fix. – Archit Jun 13 '18 at 04:59
  • id didn't work for me, but the full device name seemed to work. What ended up happening is that the touchpad would let me move the mouse cursor just a little bit then it would stop again. –  Dec 24 '18 at 21:31
  • 1
    This solution did not work for me. Ubuntu 18.04 with "SYNA8004:00 06CB:CD8B Touchpad", Lenovo X1 Carbon Gen 7. I get snappy touchpad behavior after resuming from hibernation. – SaTa Sep 27 '19 at 03:14
  • 1
    THANK YOU! Works very well and you saved me from restarting my computer! :) – Hendy Irawan Jun 06 '20 at 20:24
  • this solution WORKS for me. – Allexj Jan 26 '21 at 07:06
  • this is strange. touchpad always switches back to one-finger scrolling after reboots and shutdowns. using your method only disables the touchpad, and doesn't enable it. – MycrofD Mar 28 '21 at 12:25
  • it worked for me on Ubuntu 22.02 and USB mouse. – CognitiveRobot Sep 05 '22 at 20:07
  • I couldn't format code in a comment, so I provided another answer below: https://askubuntu.com/questions/528293/is-there-a-way-to-restart-the-touchpad-driver/1443306#1443306 . This completes your script by automatically parsing out the input ID. – Carl Nov 30 '22 at 18:52
55

I was having that problem with one laptop repeatedly until I noticed that the touchpad of that computer had its own On/Off switch which I must have been hitting by accident. Notably, the switch did not help to turn it back on. I just became careful not to press it, and before long I took to using an external wireless keyboard with integrated wireless touchpad, and I haven't had that problem since.

UPDATE: (Note: link below broken, solution is above) Since posting this "solution" I posted a comment which apparently met the user's needs. Having only just now learned that the comments remain only temporarily and are automatically deleted, I'm reposting the content of the useful comment below that it may be preserved for others:

I was sharing the "solution" that worked for me. Today it occurred to me to google for solutions more closely fitting your original question and found the following link. It isn't what I would personally consider "convenient", but it could at least be more elegant by making it a script out of it. I found this (see below) – gyropyge Sep 25 at 20:06

Press Alt+F2 and type in gksudo modprobe -r psmouse Type in the password, press Enter, and then press Alt+F2 again for entering the following gksudo modprobe psmouse and then press Enter

Zanna
  • 70,465
gyropyge
  • 2,558
  • 1
  • 16
  • 11
  • 2
    not my case, though – matteo Sep 25 '14 at 14:40
  • 2
    I was sharing the "solution" that worked for me. Today it occurred to me to google for solutions more closely fitting your original question and found the following link. It isn't what I would personally consider "convenient", but it could at least be make more elegant by making it a script.

    http://www.tuxtrix.com/2010/06/restarting-your-touchpadmouse-in-ubuntu.html

    – gyropyge Sep 25 '14 at 20:06
  • Thanks! I've marked your answer as the accepted answer though the answer is actually in your comment (well I haven't had the opportunity to test it but it sounds like it is the solution). – matteo Sep 28 '14 at 22:33
  • Thank you for the consideration of my after-thought comment. I too may wind up benefiting from that solution in the future, as my solution of trying not to hit a particularly easy-to-hit button bordering the edge of the touch-pad hasn't been particularly satisfactory. – gyropyge Sep 30 '14 at 20:51
  • "Having only just now learned that the comments remain only temporarily and are automatically deleted" WTF, really???? – matteo Oct 02 '14 at 18:58
  • Yes, really. I'm pretty new to this site despite the more distant time since I first signed up. My comment about them being automatically deleted is posted officially somewhere on this site. I found the information by accident, but I swear I really did find it. – gyropyge Oct 18 '14 at 08:49
  • News to me - comments are permanent as far as I know. Also, the link to your solution is broken. Looks like tuxtrix.com is no more... – Scaine Sep 12 '15 at 16:45
  • The link to the script no longer works. Could you please revise the answer? – user2392762 Nov 28 '15 at 13:27
  • 2
    Link was working for me, but just in case: If you are stuck with no mouse movement on your laptop (touchpad) then press the key combinations Alt+F2 and type in gksudo modprobe -r psmouse

    Type in the password, press enter, and then press Alt+F2 again for entering the following gksudo modprobe psmouse

    – G Trawo Dec 19 '15 at 01:43
  • Worked with my touchpad and built-in keyboard as well. Had to use a USB keyboard though. I'm running Xenial (16.04.3 LTS). Thanks :) – petobens Oct 01 '17 at 20:51
  • Looks like my notebook has this "disable key" too. Just got my touch pad to work again doing some ocus pocus, but I don't know what I did, next time I will make sure to keep track of my moves haha – jpenna Nov 10 '17 at 16:49
  • this save my life ; ) – yurenchen Aug 17 '18 at 13:05
  • worked for XFCE – Santropedro Dec 23 '19 at 01:42
29

What may be easier, and which worked for me, was reloading the driver in the kernel. The following code first finds the name of the kernel driver which handles the touch pad, then unloads it with rmmod and reloads it with modprobe. Note that you need to be root to run these commands, so run sudo su first.

> lsmod | grep touch
hid_multitouch         20480  0 
> rmmod hid_multitouch 
> modprobe hid_multitouch
ChrisR
  • 391
  • 3
  • 5
  • 1
    +1 for lsmod | grep touch, most answers here are specific to particular drivers, and this is how to find out which one(s) you have – user56reinstatemonica8 May 13 '20 at 13:10
  • 2
    Of the top answers, this is the only one that worked for me. – Eric Walker Aug 20 '21 at 23:37
  • The only solution that worked for me : Dell Latitude 3460 | Ubuntu 20.04.5 LTS – Alexei Kouprianov Nov 16 '22 at 11:13
  • Worked for me on Ubuntu Unity 22.10. The touchpad's multitouch functionality was gone after waking the system from sleep, so I uninstalled xserver-xorg-input-synaptics, then fumbled around with various commands trying to reset the touchpad. This worked, and my two-finger scrolling is functional again. – ArrayBolt3 Jan 06 '23 at 15:49
18

If you have a synaptics touchpad :

synclient TouchpadOff=0
Mateo
  • 8,104
AnteBios
  • 181
  • 4
    Yeyaaaaa! Ubuntu 18.04 LTS with xfce and it worked like a charm with Synaptics! – 4Z4T4R Jun 07 '19 at 05:21
  • 1
    Be careful if synclient isn't installed... I tried installing synclient to see if it would help and after installing xserver-xorg-input-synaptics, after restart, my keyboard and USB mouse stopped working. sudo apt-get remove --auto-remove xserver-xorg-input-synaptics and restart got them back again – user56reinstatemonica8 May 13 '20 at 13:07
  • 2
    Thank you! This worked for me on Ubuntu/Xubuntu 20.04.2 LTS. If you put the above command in a hidden BASH script somewhere and link it to a keyboard shortcut, you can easily reactivate the touchpad when it goes out. – Aces Feb 01 '21 at 01:49
  • this is it for me. I tried to enable the "disable touchpad while typing" feature and it disabled until I ran the command you shared. Thank you! – asgs Oct 07 '21 at 08:30
13

If you do not know what module your touchpad uses you can find out with a bit of digging around

grep -iA2 touchpad /proc/bus/input/devices

for me this returns

N: Name="Elan Touchpad"
P: Phys=
S: Sysfs=/devices/platform/80860F41:03/i2c-11/i2c-ELAN0100:00/input/input10

then see what kernel modules are available in this category:

ls $(find /lib/modules/$(uname -r) -type d -name mouse)

which for me returns

appletouch.ko  bcm5974.ko  cyapatp.ko  elan_i2c.ko  gpio_mouse.ko  
psmouse.ko  sermouse.ko  synaptics_i2c.ko  synaptics_usb.ko  vsxxxaa.ko

Cross reference the two - in my case it looks like the module for my touchpad is elan_i2c.ko

Edit: I recently figured out how to reliably get the name of the driver in use with a convoluted command, which terdon simplified nicely for me

grep -hriPo 'DRIVER=\K.+' /sys 2>/dev/null | while read driver; do [ -e /lib/modules/$(uname -r)/kernel/drivers/input/mouse/"$driver"* ] && echo $driver; done

To check you got the right module, test the command to unload it from the kernel:

sudo modprobe -r elan_i2c

The touchpad will instantly die if you got the right module, so you can easily find it by trial and error. Reload it with

sudo modprobe elan_i2c

This effectively restarts the module. You can run the two commands together like this:

sudo modprobe -r elan_i2c && sudo modprobe elan_i2c

I occasionally have to do this on resume from suspend.

Zanna
  • 70,465
10

For me, on kernel 4.13.0-46 on Asus for ELAN1200, it wasn't about reloading elan_i2c but the hid-multitouch driver:

sudo modprobe -r hid-multitouch && sudo modprobe hid-multitouch
pholat
  • 209
  • my Asus laptop is using a hid driver for BOTH keyboard & touchpad, so it need to do like this in a single cmdline, otherwise you cannot type after modprobe -r. – Tomofumi Nov 19 '18 at 03:42
  • @user56reinstatemonica8 it should, thanks for noticing, edited. – pholat May 14 '20 at 09:39
7

Here is what was working for me is [Zenbook ASUS UX501VW]:

sudo  modprobe -r elan_i2c
sudo  modprobe elan_i2c

And my missing touch pad is back.

Thomas
  • 6,223
3

The simplest solution might be to:

  • plug in a mouse
  • go to System Settings >> Mouse and Touchpad
  • switch the touchpad to ON
  • 1
    Welcome to Ask Ubuntu! ;-) Solutions do not need to be geeky to be good! Just keep it short and simple... :-) – Fabby Jun 20 '18 at 23:30
  • 1
    This is the only solution that worked for me! Tried various "lsmod" and "sudo modprobe" solutions above, none of them worked. – sh37211 Dec 27 '20 at 01:42
1

One bash command-line to reset a touchpad (based on @user3499524 response):

id=`xinput --list |grep -i touchpad | cut -f2 | cut -f2 -d=` && xinput disable $id && xinput enable $id && echo "The touchpad has been reset."
1

I call this script mouse-reset. It removes and then modprobes all the modules listed in the answers to this question so far:

#!/bin/bash

modules=(psmouse hid_multitouch elan_i2c)

for mod in "${modules[@]}"; do
    sudo rmmod "$mod" 2> /dev/null
    sudo modprobe -v "$mod" 2> /dev/null
done
Tom Hale
  • 3,508
1

Also try gksudo /etc/init.d/hotplug restart

qwr
  • 2,802
1

illusionist.

I understand you are running Ubuntu 14.04; Mine is a little different (as follows):

This laptop: Acer Swift 1 (EUFI); x86-64 bit.

OS type: Ubuntu 16.04 LTS.

Touchpad type: SYNA7DAB:00 06CB:7DAC Touchpad (synaptics_i2c.ko).

Solution provided: https://help.ubuntu.com/community/SynapticsTouchpad/ShortcutKey

Create a bash file script (as suggested: Create a symlink to the bash script and map a hotkey to it); The contents should be as follows:

#!/bin/bash

declare -a STATES=(1 0)
DEVICE=$(xinput list --name-only | grep Touchpad)
STATE=$(xinput list-props "$DEVICE" | grep 'Device Enabled' | sed 's/^.*:[ \t]*//')
xinput set-prop "$DEVICE" 'Device Enabled' ${STATES[$STATE]}

Ensure it has eXecutable permissions!

sudo chmod +x path/filename.sh

This solution works great for myself. Hopefully it applies to you as well.

Personal details of own issue (possibly applicable to your situation)

For some unknown reason: This laptop's touchpad will auto-magically become non-functional (yet is still running AFAIK). I have attempted to remove the USB-based optical mouse; yet run into the same issue.

xinput --list dump:

larvae@MST-Laptop:~/Desktop$ xinput --list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                     id=10   [slave  pointer  (2)]
⎜   ↳ SYNA7DAB:00 06CB:7DAC Touchpad            id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Video Bus                                 id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ Logitech USB Receiver                     id=9    [slave  keyboard (3)]
    ↳ HD WebCam                                 id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=13   [slave  keyboard (3)]
    ↳ Acer WMI hotkeys                          id=14   [slave  keyboard (3)]

grep -iA2 touchpad /proc/bus/input/devices dump:

larvae@MST-Laptop:~/Desktop$ grep -iA2 touchpad /proc/bus/input/devices
N: Name="SYNA7DAB:00 06CB:7DAC Touchpad"
P: Phys=i2c-SYNA7DAB:00
S: Sysfs=/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-SYNA7DAB:00/0018:06CB:7DAC.0003/input/input11

Recap of solution (provided by UBUNTU): https://help.ubuntu.com/community/SynapticsTouchpad/ShortcutKey

0

I'm using an Apple Macbook Retina Pro; the touchpad sometimes stops working. Most of the above methods won't find the driver as the name doesn't contain 'mouse' or 'touch'.

To find the touchpad driver, in my case bcm5974:

MacBookPro:~$ xinput list-props 11
Device 'bcm5974':
    Device Enabled (147):   1`
...

Then to unload and reload:

MacBookPro:~$ sudo modprobe -r bcm5974
MacBookPro:~$ sudo modprobe bcm5974

Solved.

user118684
  • 151
  • 2
  • 4
  • 11
  • 1
    11 is the specific device number in your case, you'll have to find this number using xinput --list before you can use it here. – Yaron Jun 26 '19 at 09:34
0

I'm on Alienware 13 R2 with Ubuntu 18.04 LTS and none of the above worked for me.

Well, I can say that xinput disable/enable really changes the device status and it even reflects in Settings UI. However, the touchpad just do not come back alive.

What does help me was to blacklist i2c_hid module as mentioned here and below:

sudo su
echo 'blacklist i2c_hid' >> /etc/modprobe.d/blacklist.conf
depmod -a
update-initramfs -u

After reboot everything was ok.

As a side note, I also use dconf to set touchpad/send-events to disabled-on-external-mouse. This way touchpad is only enabled when there's no external mouse.

To install dconf:

apt-get install dconf-editor -y
0

Similar problem Latitude 7430, Ubuntu 22.04. Touchpad would randomly stop or require I use 4 fingers on it at once to move. Building on the solution outlined by user3499524, I completed a short script:

#! /bin/bash # Tested on Xorg. 
# Will probably not work on Wayland.

TOUCHPAD_ID=$(xinput --list | grep -i -e touchpad | grep -Po 'id=\S+' | sed -e 's/^id=//g') xinput disable "$TOUCHPAD_ID" sleep 1 xinput enable "$TOUCHPAD_ID"

I mapped it as you suggested to a hotkey (F12). Works for Xorg. Not tested for Wayland.

Carl
  • 101
  • 1