Mouse driver reset causes logout

Forum rules
Before you post please read this

Mouse driver reset causes logout

Postby epadget1 on Wed Oct 24, 2012 10:12 am

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!
Last edited by epadget1 on Wed Oct 31, 2012 11:26 pm, edited 2 times in total.
epadget1
Level 1
Level 1
 
Posts: 13
Joined: Fri Jun 17, 2011 1:56 pm

Linux Mint is funded by ads and donations.
 

Re: Mouse driver reset causes logout

Postby xenopeek on Thu Oct 25, 2012 10:24 am

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.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14995
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mouse driver reset causes logout

Postby epadget1 on Wed Oct 31, 2012 11:22 pm

Vincent Vermeulen 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!
epadget1
Level 1
Level 1
 
Posts: 13
Joined: Fri Jun 17, 2011 1:56 pm

Re: Mouse driver reset causes logout

Postby epadget1 on Wed Oct 31, 2012 11:30 pm

Vincent Vermeulen 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?
epadget1
Level 1
Level 1
 
Posts: 13
Joined: Fri Jun 17, 2011 1:56 pm


Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 3 guests