Rainbow turns off user led (usb bound)

Hello,

I have configured omnia-led:user1 to show USB status in green
after boot, led is off.

when I exec /etc/init.d/led start, led goes on (green colour)

when I execute /etc/init.d/rainbow, led goes off.

setting default LED status to ON did not help, disabling that LED colour did not help.
the only difference in /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1
is that “autonomous” contains “1” after rainbow script, but setting it to “0” doesn’t help.
Any ideas what can be wrong?

I am not sure how to help …but …this is my config for user1,user2 leds …(one usb device with two mounts)

/etc/config/system
config led
        option sysfs 'omnia-led:user1'
        option name 'USB1'
        option trigger 'usbdev'
        option default '1'
        option dev '3-1'  ## sometimes this is lost during reboot/restart of rainbow

config led
        option name 'USB2'
        option trigger 'usbdev'
        option default '1'
        option sysfs 'omnia-led:user2'
        option dev '5-1' ## sometimes this is lost during reboot/restart of rainbow

Here is correspond color setup …

/etc/config/rainbow
config led 'usr1'
        option color '00d27f'
        option status 'auto'

config led 'usr2'
        option color '00ff83'
        option status 'auto'

You do not need to run rainbow manually, there is /etc/cron.d/rainbow scheduled for every minute. So changing anything in /sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1 is reverted back after 59sec , based on rainbow(colors) ; system(probe/trigger/on-off) config(s). Check that “system” uci config first to ensure you have it correct.

I am using Luci to do the changes (save + apply) rather doing the manual edit in uci config and restarting some service. (i do not have /etc/init.d/led at all …i only have led_autoconfig:). btw: rainbow do only intesinty and color, not the triggering or setting the led on/off/auto …

I don’t run rainbow manually - I have just tested it, because my LED went off after I set it up to be green.

here is my system:

config led
        option dev '4-1'
        option sysfs 'omnia-led:user1'
        option trigger 'usbdev'
        option name 'UPS'
        option default '0'

and rainbow:

config led 'usr1'
        option status 'auto'
        option color 'green'

… while rainbow syncing might work every minute, I can only confirm that it turns my LED off.
I set default to ‘1’ and so far it seems to work, after manual run of rainbow the LED went off again.

after reboot the same happened.

I wonder where you did get the comments:
## sometimes this is lost during reboot/restart of rainbow
because that might be just the problem I encounter

I have it like this:

system uci config , led part
config led
        option sysfs 'omnia-led:user1'
        option name 'USB1'
        option trigger 'usbdev'
        option default '1'
        option dev '3-1'

config led
        option name 'USB2'
        option trigger 'usbdev'
        option default '1'
        option sysfs 'omnia-led:user2'
        option dev '5-1'

that comment i wrote there as a note :slight_smile: … sometimes the “first” block setup is lost and i have to set it back again (trigger, dev values). I do not know why. Occurs like three times so far. I am suspecting that usbdev is busy or timeouting and led-trigger is not correctly detecting that device at that moment.

default=0 vs status=auto

default=0… means that led is off until some trigger detects event. For “netdev” device that is kind of fine, it is blinking only when rx/tx event are detected. Previous version of “system” allowed to specify read/write for each usbdev/blockdevice, but since some time option mode/trigger is no longer available. At the previous times i have to configure the “usbdev” twice (one for read and second for write, nowadyas you just set it once and it does the read/write triggers automatically)
So i think that for “usbdev” you have to have “default=1” and it should work.

status=auto
… in rainbow uci config you have “option status ‘auto’” . On=led is shining , Off=led is off, Auto=hardware is triggering if the led is on or off.
auto(rainbow) + default=0(system) --> led is off for “usbdev” , but i would expect that if there is write/read that led will blink (this works for “netdev” , but it does not work for “usbdev”, obviously)
auto(rainbow) + default=1(system) --> led is on for “usbdev”, this reacts to HW events correctly

/etc/init.d/rainbow sets the colors ; /etc/init.d/system is (not only) for led setup …so you have to reload both if you change led setup (or use Luci and save/apply just the led-config there)

raibow_syncing

(that cron task running each minute) is for the hw intensity button , it compares the value from “button” with value set by “rainbow intesity” and ensures that what you set via button is written to/is same as in rainbow.magic file. Value in /etc/rainbow.magic file regulates intensity, so if there will be “0” , leds will be dimed fully. If value is “0” use command rainbow intensity 100 to set max shining :slight_smile: or use “intensity button” and if the shining level remains same after one minute syncing is fine :slight_smile:

aha. So, setting default=1 did NOT help.

/etc/init.d/led start does set USB led to ON/green
/etc/init.d/rainbow start sets it to OFF.
and since rainbow runs AFTER led at boot time, I have it off by default.

I ran strace:

open("/sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/autonomous", O_WRONLY|O_LARGEFILE) = 3
write(3, "1", 1)                        = 1
close(3)                                = 0
open("/sys/devices/platform/soc/soc:internal-regs/f1011000.i2c/i2c-0/i2c-1/1-002b/leds/omnia-led:user1/color", O_WRONLY|O_LARGEFILE) = 3
write(3, "0 255 0", 7)                  = 7

the first write disabled the LED, the second did ust set colour. just as my first comment says.
I am able to set “autonomous” to “0” and the LED shines now.

when I set ‘autonomous’ to 1 and plug USB device out and back in, the LED starts shining and the autonomous contains ‘0’.

so the problem is clearly that rainbow should not set autonomous to ‘1’.

I do not have this service. I have to use /etc/init.d/system to reload led-config …and /etc/init.d/rainbow to reload ‘color’ setup.