After restart or suspend or hibernate script dont work, it only works again if i put in terminal halevt -c ~/.halevt.xml. I have ubuntu 10.10 i put in Startup programs this command but like i said doesnt work,any ideas how to fix it?
Yes!
No.
After restart or suspend or hibernate script dont work, it only works again if i put in terminal halevt -c ~/.halevt.xml. I have ubuntu 10.10 i put in Startup programs this command but like i said doesnt work,any ideas how to fix it?
I had exactly the same absence of the serial numbers, but i pasted almost all string without _if0, so "/org/freedesktop/Hal/devices/usb_device_15d9_a4d_noserial".
And just wanted to add, that before making "toggling" testing the login/logout should be done (at least in mine maverick box ).
To the author: After reboot, if the external mouse inserted, the script not working, then i should done re-inserting of the pointer, as i understood, the script is only catching events of the insertion, but not the initial state. But anyway thanks, because for me on rather old laptop with buggy touchpad it made life easier.
I get it work from boot with: /bin/sh -c 'DISPLAY=:0 halevt -c ~/.halevt.xml' in Startup programs.
I create script which works when mouse is pluged in:
sudo gedit /etc/init.d/touchpad
sudo chmod +x /etc/init.d/touchpad#! /bin/sh
DEVICE_ID=`xinput -list | grep -i mouse | grep id= | sed 's/.*id=\([0-9]*\).*/\1/' `
if xinput -list | grep -i mouse | grep id=$DEVICE_ID > /dev/null
then
echo "je notr"
/bin/sh -c `DISPLAY=:0 gconftool-2 --set "/desktop/gnome/peripherals/touchpad/touchpad_enabled" --type boolean "false"`
else
echo "ni notr"
/bin/sh -c `DISPLAY=:0 gconftool-2 --set "/desktop/gnome/peripherals/touchpad/touchpad_enabled" --type boolean "true"`
fi
And than i add in startup programs /etc/init.d/touchpad that gets work from reboot now from suspend,hibernate i add:
sudo gedit /etc/pm/sleep.d/99-touchpad.sh
sudo chmod +x /etc/pm/sleep.d/99-touchpad.sh#!/bin/bash
case "$1" in
thaw|resume)
/etc/init.d/touchpad 2>/dev/null
;;
*)
;;
esac
exit $?
Now everything seems to work but i have to add in toggleTouchpad after # The argument was 'on', so turn the touchpad on
/bin/sh -c `DISPLAY=:0 gconftool-2 --set "/desktop/gnome/peripherals/touchpad/touchpad_enabled" --type boolean "true"`
and after # The argument was 'off', so turn the touchpad off
/bin/sh -c `DISPLAY=:0 gconftool-2 --set "/desktop/gnome/peripherals/touchpad/touchpad_enabled" --type boolean "false"`
If anybody know better solution pleasse post it, because this script turn off in gconf-editor not in xinput soo xinput than doesnt work.
Last edited by cobra11; December 6th, 2010 at 01:50 PM.
I get :
toggleTouchpad: command not found
I have copy and pasted everything in the guide twice now
Any ideas???
It sounds like either toggleTouchpad is not in your path, or possibly named slightly differently. In terminal try
and make sure that the directory you have placed toggleTouchpad in shows up. If you're not sure, post the results here and we'll take a look for you.Code:echo $PATH
Registered Linux user 446122 , Registered Machine 352936.
Working fine on my Compaq Presario V5101US & running Ubuntu 10.10 32bit
http://colorblinddesigns.com
I had some problems with the script in Karmic (9.10).
It appears that I might be running an older version of xinput (1.4.2) that does not support --set-prop, so instead I have to use the (now deprecated) --set-int-prop command.
I have also modified line 24 to change the way AWK is used - the previous version always assumed that there would be a fixed number of spaces in the device name.
I would be glad to hear your thoughts.Code:# toggleTouchpad by Brendon Dugan # Toggles a touchpad on or off depending on it's current state or CLI argument # # To configure, run the command 'xinput list' in terminal and identify your touch pad. # Using the output of the above command, change the touchpadString variable to a substring # of your touchpad's description that is unique to that device. # # To run, simply type 'toggleTouchpad' to toggle your touchpad on or off, or # 'toggleTouchpad on' to explicitly turn your touchpad on, or # 'toggleTouchpad off' to explicitly turn it off. # # Enjoy! # A function for logging safemk () { if [ ! -d $1 ]; then mkdir $1; chmod +rw $1; fi } logdir=/home/$USER/.toggleTouchpad touchpadString="TouchPad" touchpadID=$(xinput list | grep $touchpadString | awk -F '"' '{print $3}' | awk -F " " '{print $1}' | awk -F "=" '{print $2}') touchpadEnabled=$(xinput list-props $touchpadID | grep "Device Enabled" | awk -F ":" '{print $2}') sleeptime=1 # Create the logging directory safemk $logdir touch $logdir/errorLog.txt # Check for arguments on the command line if test $# -eq 1 then # Change the argument to lowercase arg1=$(echo $1 | tr [:upper:] [:lower:]) cliArg=1 else # There is no argument. cliArg=0 fi if [ $cliArg -eq 1 ] then # If there's an argument, check to see whether it is on, off, or junk if [ $arg1 = 'on' ] then # The argument was 'on', so turn the touchpad on xinput --set-int-prop $touchpadID "Device Enabled" 8 1 if [ $(xinput list-props $touchpadID | grep "Device Enabled" | awk -F ":" '{print $2}') -eq 0 ] then echo "Something went wrong\n" >> $logdir/errorLog.txt fi elif [ $arg1 = 'off' ] then # Sleep for a short time to fix a bug that re-enabled the touchpad immediately after disabling it sleep $sleeptime # The argument was 'off', so turn the touchpad off xinput --set-int-prop $touchpadID "Device Enabled" 8 0 if [ $(xinput list-props $touchpadID | grep "Device Enabled" | awk -F ":" '{print $2}') -eq 1 ] then echo "Something went wrong, perhaps \$sleeptime needs to be greater than $sleeptime ?\n" >> $logdir/errorLog.txt fi else # The argument was junk, so log the error and go on echo "Invalid argument \""$arg1"\" was supplied\n" >> $logdir/errorLog.txt fi else # There was no argument, so just toggle the touchpad to the opposite # of the state it has now. if [ $touchpadEnabled -eq 1 ] then xinput --set-int-prop $touchpadID "Device Enabled" 8 0 else xinput --set-int-prop $touchpadID "Device Enabled" 8 1 fi fi
Cheers.
I had to do the same thing with the awk statement on line 24. Mine wound up being:
Thanks for a great script!Code:touchpadID=$(xinput list | grep $touchpadString | awk -F " " '{print $7}' | awk -F "=" '{print $2}')
Joe
Ubuntu 10.10
I ended up with this script:PHP Code:
sudo nano /etc/init.d/touchpad
PHP Code:
touchpadID=$(xinput list | grep TouchPad | awk -F "=" '{print $2}' | awk -F " " '{print $1}')
touchpadEnabled=$(xinput list-props $touchpadID | grep "Device Enabled" | awk -F ":" '{print $2}')
mouseId=$(xinput list | grep Mouse | awk -F "=" '{print $2}' | awk -F " " '{print $1}')
mouseEnabled=$(xinput list-props $mouseId | grep "Device Enabled" | awk -F ":" '{print $2}')
if [ $mouseEnabled -eq 1 ]
then
xinput --set-int-prop $touchpadID "Device Enabled" 8 0
else
xinput --set-int-prop $touchpadID "Device Enabled" 8 1
fi
Enjoy!PHP Code:
sudo chmod +x /etc/init.d/touchpad
update-rc.d touchpad defaults
Hi Faifas
I tried your script and I got the following response.
cantru@mobile-UL50VT:~$ sudo chmod +x /etc/init.d/touchpad
cantru@mobile-UL50VT:~$ update-rc.d touchpad defaults
update-rc.d: warning: /etc/init.d/touchpad missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/touchpad already exist.
Died at /usr/sbin/update-rc.d line 57.
Any advice
Thanks.
Bookmarks