You are not logged in.
Pages: 1
Hey,
Is there a way to detect if my mouse is currently plugged?
I know that udev lists add and remove. But if the mouse is plugged when the system is off there is none.
Thanks for help!
Last edited by GNA (2014-03-07 19:42:47)
Offline
lsusb, if it's a usb mouse.
Offline
I disable a laptop's touchpad, if a mouse is connected, with this:
lsusb | grep -qi mouse && synclient TouchpadOff=1
Offline
Thank you! This completely solves my issues!
I'll add this to the wiki so others may find it.
==> https://wiki.archlinux.org/index.php/To … _detection
Last edited by GNA (2014-03-07 19:44:52)
Offline
@GNA: have you even tried the udev rules provided on the wiki? udev can detect device add/remove events even across suspend.
Offline
udev can detect device add/remove events
Yes, but using lsusb *when* convenient, is easier than writing a udev rule to keep track of the USB "add" event that udev would fire at system bootup.
Offline
lahwaacz wrote:udev can detect device add/remove events
Yes, but using lsusb *when* convenient, is easier than writing a udev rule to keep track of the USB "add" event that udev would fire at system bootup.
Alright, I'm just saying that it is nonsense to put it into crontab: https://wiki.archlinux.org/index.php?ti … did=303516
The best place for such command is .xinitrc, that way you will have the touchpad turned off as soon as X starts and udev will handle future (dis)connections.
Btw, I have the following in my .xinitrc:
if [ $(ls /dev/input | grep mouse | wc -l) -gt 1 ]; then
synclient TouchpadOff=1
fi
Offline
Pages: 1