Configure LED for external USB?


Gruntfuggly

Mostly Harmless
Joined
Feb 2, 2004
Messages
1,487
Location
Brighton, UK
Website
www.zaonce.com
Can I configure the wifi LED to come on when the external USB is enabled instead of the internal wifi?

BTW - I've tried searching, but 'led' and 'usb' aren't the most helpful search terms  <_<
 
Last edited by a moderator:
You could try turning off the wifi LED using the LED settings app in recent versions of the OS, then modifying /usr/pandora/scripts/op_usbhost.sh to set or clear the LED at the appropriate point. It's a short script, so shouldn't be hard to modify.


Setting and clearing LEDs is documented on the Wiki. Give me a shout if you can't find it.
 
Not automatically, but yes.

The script /usr/pandora/scripts/op_ledsettings.sh is responsible for setting the wifi LED trigger to "phy0radio" or "none", thereby turning it on or off. Change the script so that it does not change that trigger.

Next change the script /usr/pandora/scripts/op_usbhost.sh to "echo default-on > /sys/class/leds/pandora\:\:wifi/trigger" when the USB is enabled, and "echo none > /sys/class/leds/pandora\:\:wifi/trigger" when it is disabled.

Alternatively you could rebuild the USB host driver to have an LED trigger as well, but that's probably a lot more work than needed.
 
The script /usr/pandora/scripts/op_ledsettings.sh is responsible for setting the wifi LED trigger to "phy0radio" or "none", thereby turning it on or off. Change the script so that it does not change that trigger.
You sure about that? On mine, op_ledsettings is the zenity backend to the item in the settings menu. I don't understand how the triggers work at the moment, but it doesn't appear to be a script that's called whenever the LEDs need to change.
 
Yeah, you're right. Big mistake on my part. I did some better digging this time and found it's actually /etc/init.d/wl1251-init. Line 51 is where it is actually getting set: comment out that line and the wifi will no longer automatically turn it on with the wifi. Then modify the op_usbhost.sh script to turn it on and off.
 
Or couldn't you use the setting that's backed by that zenity scripts to do the same, as one of the options in that lets you disable the wifi led?


I'm also not clear at present what benefits using the trigger system over writing the brightness directly are, but I'm not at my Pandora currently so can't check.
 
Triggers can do many things and are controlled by the driver they're attached to.

The SD controller has a trigger so that every time it reads or writes it turns the LED on, something which would be impossible with a userland daemon. Similarly, you can have set the trigger for the LEDs to "phyXrx" and "phyXtx" to blink every time data is received or sent, or the phyXassoc trigger which comes on only when the wifi is actually connected (but no indication whether it is turned on or not), all controlled by the kernel module itself.

There's triggers for the charging module and the fuel gauge, for bluetooth, for any regular GPIO line, plus a few basic things to simply turn them on, or blink at regular intervals. I know there's also a trigger for CPU activity but I don't think it's part of the Pandora's kernel.
 
Back
Top