Hi, If i am configuring below config under /etc/config/system file , The STATUS LED working fine based on eth0 link up/down.
config led 'led_status' option name 'STATUS' option interval '50' option sysfs 'db120:green:status' option default '0' option trigger 'netdev' option mode 'link' option dev 'eth0' The switch button defined as below under /etc/hotplug.d/button/50-wps if [ "$ACTION" = "pressed" -a "$BUTTON" = "lanwifi" ]; then echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness fi This working fine. I need to add condition as below: if [ "$ACTION" = "pressed" -a "$BUTTON" = "lanwifi" ]; then NEED TO ADD CONDITION (config led 'led_status' option name 'STATUS' option interval '50' option sysfs 'db120:green:status' option default '0' option trigger 'netdev' option mode 'link' option dev 'eth0' ) echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness fi Can anyone help me to solve this. Regards, John On Tue, Sep 15, 2015 at 6:38 PM, John kerry <kerry9...@gmail.com> wrote: > Hi, > > I have added following condition but its not working: > > MYDEV='eth0' > > if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && { > devstatus "$MYDEV" | grep '"up": true' && { > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > } > } > > fi > > Am i doing any mistake or need to change anything > > Regards, > John > > On Tue, Sep 15, 2015 at 4:07 PM, Bastian Bittorf <bitt...@bluebottle.com> > wrote: > >> * John kerry <kerry9...@gmail.com> [15.09.2015 08:52]: >> > I have to write some condition in >> > /etc/hotplug.d/button/50-wps/ file >> > >> > I have to configure cat /etc/hotplug.d/button/00-wps file for following >> > condition: >> > if [ "$BUTTON" = "BTN_2" ] && [ "$ACTION" = "pressed" ]; then >> > >> > I have to check eth0.1 if link is up then have ON status led otherwise >> OFF. >> >> if i understand you correctly, you want this: >> >> MYDEV='eth0.1' >> [ "$BUTTON" = 'BTN_2' -a "$ACTION" = 'pressed' ] && { >> devstatus "$MYDEV" | grep '"up": true' && { >> your_action_here >> } >> } >> >> but this is at least...rude. better you use the correct >> JSON-parser like: >> >> . /usr/share/libubox/jshn.sh >> json_load "$( devstatus eth0.1 )" >> json_get_var 'JSON_VAR_up' 'up' >> json_cleanup >> >> in case your dev is up you have e.g. >> $JSON_VAR_up = 1 >> >> bye, bastian >> > >
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel