Jump to content

Action on plugging AND unplugging a mouse


theYinYeti
 Share

Recommended Posts

I am aware of the Gnome settings for when I plug a mouse. But this is not what I want.

 

Is there a way to execute something when I plug a mouse, AND when I unplug a mouse. I want to respectively disable, and enable again the touchpad in such case.

 

My touchpad comes in the way when I type text, but sometimes I need it (when no other mouse). For now, I tried a compromise with

syndaemon -i 2 -K

but that's not satisfactory because the touchpad is unresponsive when I need it, and it keeps clicking randomly when I type text.

 

Yves.

Link to comment
Share on other sites

Older it seems…

[yves@localhost ~]$ rpm -qa | grep -i xorg
libxorg-x11-devel-7.3-4mdv2009.0
x11-server-xorg-[b]1.4.2[/b]-10.1mdv2009.0

 

I don't know much about evdev, but maybe it is used:

[yves@localhost ~]$ sed -n '/mouse/,/Section/p' /etc/X11/xorg.conf
Driver "mouse"
Option "Protocol" "ExplorerPS/2"
Option "Device" "[b]/dev/mouse[/b]"
EndSection
[yves@localhost ~]$ ls -l /dev/mouse
lrwxrwxrwx 1 root root 10 2009-03-10 08:58 /dev/mouse -> input/mice
[yves@localhost ~]$ ls -l /dev/input/mice
crw-r----- 1 root root 13, 63 2009-03-10 09:58 /dev/input/mice
[yves@localhost ~]$ ls -l /dev/input/event*
crw-r----- 1 root root 13, 64 2009-03-10 09:58 /dev/input/event0
crw------- 1 yves root 13, 65 2009-03-10 09:58 /dev/input/event1

The major number from these event* devices is the same as that of mice, and the minor is very close.

 

Yves.

Link to comment
Share on other sites

Yep... mmm, I guess with evdev disabled/not used any of these suggestions should work:

http://llbb.wordpress.com/2007/07/09/auto-...chpad-on-linux/

However, with the evdev driver loaded instead they will probably not work. You will need an appropriate HAL rule instead to be put in /etc/hal/fdi/policy folder, but I can't be sure about its syntax (I'm an xml goofy).

Maybe the last suggestion above will work if put in, say, /etc/rc.local or any other multiuser startup script.

Edited by scarecrow
Link to comment
Share on other sites

Thank you scarecrow :)

 

That worked: I created a “/etc/udev/rules.d/85-synaptics.rules†file with this content:

ACTION=="add", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient TouchpadOff=1"
ACTION=="remove", SUBSYSTEM=="input", ID_CLASS="mouse", RUN+="/usr/bin/synclient TouchpadOff=0"

 

I also added the following new line at the end of both “/etc/X11/gdm/Init/Default†and “/etc/X11/gdm/PreSession/Defaultâ€, just before the “exit 0†last line:

/usr/bin/synclient TouchpadOff=`grep -ic mouse /proc/bus/usb/devices`

I have yet to see if this works, as I haven't disconnected so far.

 

Yves.

Edited by theYinYeti
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...