Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).


  Search this Thread
Old 01-31-2013, 10:12 PM   #1
Registered: Apr 2004
Distribution: Debian GNU/Linux
Posts: 45

Rep: Reputation: 6
acpi script to change LED requires root and I need to make it not require root.

Distro: Debian Wheezy (Testing)
Laptop: Dell Inspiron 15R Special Edition (2012)
CPU: Intel Core i7 Ivy Bridge


I bought a new Dell 15R Special Edition laptop (2012 model).

The function key to enable/disable the touchpad does not work although I see that xev is generating X86TouchpadToggle events.

I found that /etc/acpi/ works for disabling the touchpad since it's the same touchpad as Asus laptops.

However, this script has a problem in that it assumes the laptop has an asus led, which it doesn't.

So I've created a new script to work with my laptop, as follows...

< ledf=/sys/class/leds/asus::touchpad/brightness
> ledf=/sys/class/leds/dell-laptop::touchpad/brightness source which I copy&pasted from

set -e

[ -f $pff ] || exit 0

atp_error() {
        logger -t${0##*/} -perr -- $*
        exit 1

. $pff || atp_error "Sourcing $pff failed"

[ -x /usr/bin/xinput ] || atp_error "Please install package xinput to enable toggling of touchpad devices."


    # extract the device id for the supplied touch device name
    # XXX:      according to man page 'list', 'list-props' and 'set-int-prop' are
    #   options, not arguments.
    xinput --list | sed -nr "s|.*$1.*id=([0-9]+).*|\1|p"

ENABLEPROP="Synaptics Off"
# Get the xinput device number and enabling property for the touchpad
XINPUTNUM=$(getTouchDeviceId "SynPS/2 Synaptics TouchPad")

if [ -z "$XINPUTNUM" ]; then
    XINPUTNUM=$(getTouchDeviceId "PS/2 Elantech Touchpad")
    ENABLEPROP="Device Enabled"

# if we failed to get an input, exit
[ "$XINPUTNUM" ] || atp_error "Invalid TouchPad id '$XINPUTNUM'"

# get the current state of the touchpad
TPSTATUS=$(xinput --list-props $XINPUTNUM | awk "/$ENABLEPROP/ { print \$NF }")
case $TPSTATUS in
                atp_error "Invalid TouchPad status '$TPSTATUS'"

# XXX: '--set-int-prop' deprecated
xcmd="xinput --set-int-prop $XINPUTNUM '$ENABLEPROP' 8"
if [ $TPSTATUS -eq 0 ]; then
        eval $xcmd 1 || atp_error "Command '$xcmd 1' failed"
        [ ! -w $ledf ] || echo 0 >$ledf ||
                atp_error "Writing 0 to $ledf failed"
        eval $xcmd 0 || atp_error "Command '$xcmd 0' failed"
        [ ! -w $ledf ] || echo 1 >$ledf ||
                atp_error "Writing 0 to $ledf failed"
It works PERFECTLY on my Dell laptop.

My problem is that it appears that I need sudo or root access to run this script. I want to somehow bind this script to the function key Fn+F3 which triggers a XF86TouchpadToggle key event.

Any ideas/suggestions? I've tried kde-config-touchpad and ktouchpadenabler. ktouchpadenabler only disables the touchpad until it is touched (worthless, possibly a bug) and kde-config-touchpad doesn't seem to provide a way to completely disable the touchpad by the keyboard.

Further, when I try to bind XF86TouchpadToggle to any hotkeys inside of KDE, I get an error popup that says "The key you just pressed is not supported by QT"!

So I need to somehow go *around* kde to get this done.. I'm not sure how to do it..
Right now, I'm just executing the script manually in a console with sudo or root and it works for toggling the touchpad (including LED status!) but I'm not sure what the proper way to do it is.

Any help is greatly appreciated.

[    0.000000] DMI: Dell Inc. Inspiron 7520/0PXH02, BIOS A07 10/03/2012
[    7.953394] dcdbas dcdbas: Dell Systems Management Base Driver (version 5.6.0-3.2)
[    8.104005] input: Dell WMI hotkeys as /devices/virtual/input/input8
Edit #2:
An acpi event is *not* generated when I press the Fn+F3 button to toggle the touchpad.. So I guess I *CAN'T* use acpid to run the script. What can I do??

Last edited by Sidicas; 01-31-2013 at 10:27 PM.
Old 01-31-2013, 11:07 PM   #2
Registered: Apr 2004
Distribution: Debian GNU/Linux
Posts: 45

Original Poster
Rep: Reputation: 6
Alright, I've got it... After spending a while looking through other people trying to manipulate system leds from userspace by doing ridiculous things (editing udev rules, ick!)

I added this to /etc/sudoers:
myusername ALL = (root) NOPASSWD: /etc/acpi/

And I also made sure that /etc/acpi/ is read-only, executable for everybody.

Which allows me to execute "sudo /etc/acpi/" without prompting for a password. Now I just need to bind this script to XF86TouchpadToggle and I'm done.


dell, inspiron, laptop, led

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
run script at login that requires root privileges Eredeath Programming 13 08-04-2010 10:44 PM
Make a file as difficult to change as possible, even for root. senseproof Linux - Security 5 05-11-2009 05:37 PM
Make a file as difficult to change as possible, even for root. senseproof Linux - Security 0 05-11-2009 04:20 AM
Fluxbox startup script.......... App requires root. DraaX Slackware 2 11-28-2004 08:27 AM
Why does kppp.desktop require root userid for non-root user? Linux - Networking 4 08-27-2001 09:18 AM > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 12:55 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration