Fixing USB mouse or laptop touchpad freeze and hanging in Ubuntu

After upgrading from Ubuntu 12.04 to 12.10, I occasionally started facing a problem with my touchpad. All of a sudden the left and right clicks would stop working. Left click only worked on the unity panel (on the left) and the top Ubuntu menu bar (which contains the clock, network and sound icons). These are two three possible solutions to this problem -

1) Restart the laptop touchpad or USB mouse [1]
This can be done via the command line and does not require you to reboot or logout of your account.

To restart the laptop touchpad -
  • Open terminal (ctrl + alt + t) or press alt + f2 to bring up unity's command lens.
  • Execute the following commands (recommended to run using gksudo but can be run using sudo as well) - 
    • gksudo modprobe -r psmouse (removes the mouse interface from the linux kernel)
    • gksudo modprobe psmouse (adds the mouse interface to the linux kernel)
To restart a USB mouse -
  • Open terminal (ctrl + alt + t) or press alt + f2 to bring up unity's command lens.
  • Execute this command - 
    •  sudo /etc/init.d/hotplug restart
Edit - If you're using a laptop, you can also try this option (requires function keys). The function key combination might not be applicable on your laptop model.

2) Uncheck the 'Disable touchpad while typing' option [2]
This setting is specific to the laptop touchpad.
  • Go to System Settings -> Mouse and Touchpad (under Hardware section)
  • Click on the Touchpad tab and uncheck the Disable touchpad while typing option.

3) Ensure that the Unity HUD or any other Unity lens is off
I was watching a video in VLC fullscreen mode. I primarily use VLC's keyboard commands - ctrl + navigation keys & alt + navigation keys - to move around the playback. During playback I abruptly switched to another app. That's when I faced this problem yet again. I had already unchecked the option as mentioned in step 2 above sometime ago. I tried restarting my mouse by running the commands mentioned in step 1, but that didn't work as well.

While I was using the browser via my keyboard (alt + tab to the rescue) and searching google for help, I happened to press escape 2-3 times and lo and behold, the mouse started working again.

And then it struck me! Whenever you have any unity lens open - the application, video, audio lens or even the HUD - the only areas where you can click with the lens open are the unity panel on the left hand side and the top menu bar. You cannot click anywhere in the app display area when any lens is open. These were exactly the symptoms I was facing and it seems that pressing the escape button multiple times closed a lens which was open in the background (probably when VLC was in fullscreen mode).

To reproduce the above mentioned problem - open a video in VLC and switch to fullscreen mode. Press alt once - this does bring up the HUD for VLC, but it does not show up in front. Now since the HUD is active (but not visible though), you won't be able to use any keyboard commands in VLC! Press escape once which will close the HUD and you'll be able to use VLC keyboard commands again.

Alternatively, you can just open the unity lens once (by pressing the Windows/super button) and close it. This should fix the issue.

References -
[1] Restarting your touchpad/mouse in Ubuntu in simple steps
[2] Trackpad freezes often [closed]

2 comments:

  1. That mouse problem (frozen touchpad mouse) bugged me for the longest time and then I finally read this article. A perfect solution that modprobe [-r] psmouse
    Thanks you very much
    (I know it is a bit outdated, but still)

    ReplyDelete
  2. There is same problem for me in Ubuntu 18.04 & now I found this solution, still working..
    Thank you buddy.

    ReplyDelete