Page 1 of 1

Mouse driver reset causes logout

Posted: Wed Oct 24, 2012 10:12 am
by epadget1
Hello all,
I've encountered a strange problem where running a script meant to reset a misbehaving mouse driver caused Mint to log out. I'm running Maya MATE on my laptop. The problem does not appear to be reproducible -- the script worked just fine before causing a logout this morning, and hasn't done it again since then. However, if there's something I can change to keep this from happening again I would like to.

I wrote the script ("/usr/bin/fixmouse") based on some suggestions online to fix my laptop mouse when it becomes unresponsive or jumpy:

Code: Select all

#!/bin/bash
#resets mouse if it gets stuck
rmmod psmouse
modprobe psmouse

echo done.
I've been calling it by typing "sudo fixmouse".

Am I doing something stupid or risky? I guess I don't really understand very well what rmmod and modprobe are doing, so I might be missing something obvious.

Any thoughts about how to keep it from happening again would be appreciated! Thanks!

Re: Mouse driver reset causes logout

Posted: Thu Oct 25, 2012 10:24 am
by xenopeek
rmmod removes the psmouse kernel module, and modprobe loads it again. Basically, switching it off and then on again. Instead of rmmod, the manpage for rmmod is suggesting you do modprobe --remove instead. Adding --verbose makes it verbose, so it will tell you what it is doing and you don't need the final echo as feedback. So change it to:

Code: Select all

#!/bin/bash
#resets mouse if it gets stuck
modprobe --remove --verbose psmouse
modprobe --verbose psmouse
Test the modprobe --remove though, as there may be a reason you need to do rmmod for this problem.

Re: Mouse driver reset causes logout

Posted: Wed Oct 31, 2012 11:22 pm
by epadget1
xenopeek wrote:rmmod removes the psmouse kernel module, and modprobe loads it again. Basically, switching it off and then on again. Instead of rmmod, the manpage for rmmod is suggesting you do modprobe --remove instead. Adding --verbose makes it verbose, so it will tell you what it is doing and you don't need the final echo as feedback. So change it to:

Code: Select all

#!/bin/bash
#resets mouse if it gets stuck
modprobe --remove --verbose psmouse
modprobe --verbose psmouse
Test the modprobe --remove though, as there may be a reason you need to do rmmod for this problem.
I will give this a try. Thank you Vincent!

Re: Mouse driver reset causes logout

Posted: Wed Oct 31, 2012 11:30 pm
by epadget1
xenopeek wrote:rmmod removes the psmouse kernel module, and modprobe loads it again. Basically, switching it off and then on again. Instead of rmmod, the manpage for rmmod is suggesting you do modprobe --remove instead. Adding --verbose makes it verbose, so it will tell you what it is doing and you don't need the final echo as feedback. So change it to:

Code: Select all

#!/bin/bash
#resets mouse if it gets stuck
modprobe --remove --verbose psmouse
modprobe --verbose psmouse
Test the modprobe --remove though, as there may be a reason you need to do rmmod for this problem.
Apparently that didn't fix it. Five minutes after making the suggested changes to the script, I ran it as before and was logged out again. Trying it again now, there's no problem. I get:

Code: Select all

sudo fixmouse
[sudo] password for : 
rmmod /lib/modules/3.2.0-23-generic/kernel/drivers/input/mouse/psmouse.ko
insmod /lib/modules/3.2.0-23-generic/kernel/drivers/input/mouse/psmouse.ko 
Any more thoughts?