[Level 3] How to disable mouse pad?
The mouse pad always make me confuse~
Because whiling typing, I'll touch it, and sometime the mis-operation will just close my working screen. It will make me crazy.
Therefore, I write a script to disable the mouse pad,
at this moment, only the external mouse is active.
But, when I try to enable it, I find out that I cannot enable it, it's that a bug???
Whatever, if you have the same problem, just remove your external mouse,
and the touch pad will be active again.
Just enjoy it~
Wish this helps.
regards,
Stanley Huang
Because whiling typing, I'll touch it, and sometime the mis-operation will just close my working screen. It will make me crazy.
Therefore, I write a script to disable the mouse pad,
at this moment, only the external mouse is active.
But, when I try to enable it, I find out that I cannot enable it, it's that a bug???
Whatever, if you have the same problem, just remove your external mouse,
and the touch pad will be active again.
Just enjoy it~
#!/usr/bin/bash
showUsage() {
cat <<EOF
Usage:
$0 (d)isable/(e)nable
Ex.
$0 (d)isable
$0 (e)nable
Note.
for solaris only
EOF
}
disableMousePad() {
[ ! -z "$modno" ] && pfexec modunload -i $modno
}
enableMousePad() {
[ ! -z "$modname" ] && pfexec modload /kernel/drv/amd64/$modname
}
showMousePad() {
echo "Show mod info:"
pfexec modinfo | grep mouse | grep PS/2
}
################################################## main
export LC_ALL=C
modno=`pfexec modinfo | grep mouse | grep PS/2 | awk '{print($1)}'`
modname=`pfexec modinfo | grep mouse | grep PS/2 | awk '{print($6)}'`
if [ ! -z "$modname" ]
then
echo "$modname" >> $0.mousepad
elif [ -f $0.mousepad ]
then
modname=`cat $0.mousepad | head -1`
else
echo "missing modname info, exit program..."
exit 1
fi
#set -vx
#sAction=`echo $1 | /usr/bin/tr [A-Z] [a-z]`
sAction=$1
case $sAction in
disable|d|DISABLE|D)
disableMousePad
showMousePad
;;
enable|e|ENABLE|E)
enableMousePad
showMousePad
;;
*)
echo "Error with wrong action($1), exit program..."
showUsage
;;
esac
showUsage() {
cat <<EOF
Usage:
$0 (d)isable/(e)nable
Ex.
$0 (d)isable
$0 (e)nable
Note.
for solaris only
EOF
}
disableMousePad() {
[ ! -z "$modno" ] && pfexec modunload -i $modno
}
enableMousePad() {
[ ! -z "$modname" ] && pfexec modload /kernel/drv/amd64/$modname
}
showMousePad() {
echo "Show mod info:"
pfexec modinfo | grep mouse | grep PS/2
}
################################################## main
export LC_ALL=C
modno=`pfexec modinfo | grep mouse | grep PS/2 | awk '{print($1)}'`
modname=`pfexec modinfo | grep mouse | grep PS/2 | awk '{print($6)}'`
if [ ! -z "$modname" ]
then
echo "$modname" >> $0.mousepad
elif [ -f $0.mousepad ]
then
modname=`cat $0.mousepad | head -1`
else
echo "missing modname info, exit program..."
exit 1
fi
#set -vx
#sAction=`echo $1 | /usr/bin/tr [A-Z] [a-z]`
sAction=$1
case $sAction in
disable|d|DISABLE|D)
disableMousePad
showMousePad
;;
enable|e|ENABLE|E)
enableMousePad
showMousePad
;;
*)
echo "Error with wrong action($1), exit program..."
showUsage
;;
esac
Wish this helps.
regards,
Stanley Huang
Comments
Post a Comment