Pandora pandora LEDs?

Tuxmmer

Still Fresh
Joined
Oct 27, 2011
Messages
9
I have a question, how to access the pandora LEDs from python? thanks
 
S

StreaK

Guest
actually good question [it would be nice if someone provide C/C++ snippet as well..]
 

TrashyMG

Sarcasm Dispenser
Staff member
Joined
Jan 18, 2010
Messages
10,607
There is a way you can echo a command to a system device to change the states of the LEDs, I was hoping for some detail listing of commands but this is the best I found.


Link


once you know that, you could just import os and run a command line argument..



Code:
import os


os.system('some command line argument')
 
Last edited by a moderator:

Tempel

Active Member
Joined
Dec 30, 2008
Messages
670
Age
32
Website
randy.heydon.selfip.net
According to that link, controlling LEDs is all about writing to specific files. So rather than running a shell command, you should write to the file in the usual way.



Code:
with open('/sys/class/leds/pandora::power/brightness', 'w') as led:

    led.write('255')
 
Last edited by a moderator:

Tuxmmer

Still Fresh
Joined
Oct 27, 2011
Messages
9
What are the names of all the LEDs and their equivalent?/sys/class/leds/pandora::power/brightness
 
Last edited by a moderator:

Kosmos

Member
Joined
Apr 10, 2012
Messages
228
Anyway to do it without a password?

echo 255 > /sys/class/leds/pandora\:\:power/brightness

Won't cut it.

I got the op_power.sh lid-event to work from a hotkey without password this way...

#!/bin/bash
# op_Standby.sh
# Assign this to a hotkey combo for instant SLEEP

# /usr/pandora/scripts/op_power.sh 0 <- Standby
# /usr/pandora/scripts/op_power.sh 3 <- Shutdown
# /usr/pandora/scripts/op_power.sh 0 lid <- for lid open event
# /usr/pandora/scripts/op_power.sh 1 lid <- for lid close event

sudo "/usr/pandora/scripts/op_power.sh" 0

#
# To make it a act as a standard command
# sudo cp ./bin/op_Standby.sh /usr/bin/op_standby

# PowerSettings require a password, therefore
# Edit the Suduers list in nano or you'll break the file
#
# sudo nano \etc\sudoers.d\50_openpandora
# "Add the following to the top of the file"
# %wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/op_power.sh


I would like something similarly workable for the LEDs.

I tried a few related methods which did not work as we are writing to a file not running an executable.

Ideas? Solutions? Anyone?
 
Top