[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

disable appletouch when plugging in mouse



Hey,

Somewhere I picked up a script that disables the trackpad when a mouse
is plugged in by unloading the module. That isn't very nice because X
gets very confused: after the event device is gone, the new one after
unplugging the mouse isn't driven by the synaptics driver so you don't
have all the nice features any more!

I just rewrote the script completely:
 * simply power down the touchpad now
 * use sysfs, no longer rely on device naming

It might depend on CONFIG_USB_SUSPEND, I don't know. I have it, and it
works.

Here it goes:

#! /bin/bash
# seems to need bash for whatever reason... dash doesn't work
#
# This is a little hotplug script that disables the touchpad when
# you plug in a usb mouse and re-enables it when the mouse is unplugged.
#
# Simply put this into /etc/hotplug/usb/usbhid and thats it...

case $ACTION in
add|remove)
	state=/sys/bus/usb/drivers/appletouch/*/power/state

	if ls /sys/bus/usb/drivers/usbhid/*/input:mouse* >/dev/null 2>&1
	then
		echo -n 3 > $state
	else
		echo -n 0 > $state
	fi
	;;
esac

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: