Results 1 to 5 of 5

Thread: Halevt and permissions, commands running but not correctly

  1. #1
    Join Date
    Mar 2007
    Location
    TN, US
    Beans
    607
    Distro
    Ubuntu

    Halevt and permissions, commands running but not correctly

    I recently decided to attempt to implement automatically disabling my laptop's touchpad when my external mouse is connected, and I am just about there. Unfortunately, what I suspect to be a permissions problem is stopping me from succeeding. Here's what I have done so far:
    1. Written a Script which will enable or disable the touchpad based upon cli argument (verified to work when called via terminal)
    2. Set up a rule for halevt which successfully launches an arbitrary command when the mouse is connected or disconnected (even successfully logging itself)
    3. Determined that the script is in fact being called upon device connection (by adding echo statements to the script which are working)


    When launching halevt, I have even tried running it as my user/group, and with a special config file, all to no avail. Any help would be greatly appreciated!

    Also, here is my command to run halevt:
    Code:
    sudo halevt -u brendon -g brendon -c /home/brendon/.halevt.xml
    My .halevt.xml file:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <halevt:Configuration version="0.1" xmlns:halevt="http://www.environnement.ens.fr/perso/dumas/halevt.html">
    	<halevt:Device match="hal.info.udi = /org/freedesktop/Hal/devices/usb_device_46d_c70e_00076142E023">
    		<halevt:Insertion exec="/home/brendon/bin/toggleTouchpad off"/>
    		<halevt:Removal exec="/home/brendon/bin/toggleTouchpad on"/>
    	</halevt:Device>
    </halevt:Configuration>
    And the script being run:
    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!
    touchpadString="TouchPad"
    touchpadID=$(xinput list | grep $touchpadString | awk -F " " '{print $6}' | awk -F "=" '{print $2}')
    touchpadEnabled=$(xinput list-props $touchpadID | grep "Device Enabled" | awk -F ":" '{print $2}')
    
    # 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-prop $touchpadID "Device Enabled" 1
    		echo "ON"
    	elif [ $arg1 = 'off' ]
    	then
    		# The argument was 'off', so turn the touchpad off 
    		xinput --set-prop $touchpadID "Device Enabled" 0
    		echo "OFF"
    	else
    		# The argument was junk, so do nothing 
    		sleep 1
    	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-prop $touchpadID "Device Enabled" 0
    	else
    		xinput --set-prop $touchpadID "Device Enabled" 1
    	fi
    fi
    Registered Linux user 446122 , Registered Machine 352936.

  2. #2
    Join Date
    Mar 2007
    Location
    TN, US
    Beans
    607
    Distro
    Ubuntu

    Re: Halevt and permissions, commands running but not correctly

    *Polite bump*
    Registered Linux user 446122 , Registered Machine 352936.

  3. #3
    Join Date
    Mar 2007
    Location
    TN, US
    Beans
    607
    Distro
    Ubuntu

    Re: Halevt and permissions, commands running but not correctly

    Another polite bump.
    Registered Linux user 446122 , Registered Machine 352936.

  4. #4
    Join Date
    Mar 2007
    Location
    TN, US
    Beans
    607
    Distro
    Ubuntu

    Re: Halevt and permissions, commands running but not correctly

    *Bump* -- Somehow this thread managed to make it all the way to page 12 in just a few hours... this is a busy forum!
    Registered Linux user 446122 , Registered Machine 352936.

  5. #5
    Join Date
    Mar 2007
    Location
    TN, US
    Beans
    607
    Distro
    Ubuntu

    Re: Halevt and permissions, commands running but not correctly

    Solved here!
    Registered Linux user 446122 , Registered Machine 352936.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •