Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
* John kerry[16.09.2015 11:32]: > even i checked on http://www.shellcheck.net/ , its not giving any feedback, > it seems correct but still its not working. add 1 line on top of your script for debugging: set | logger and check with 'logread -f' the output when you press the button. bye, bastian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
* John kerry[16.09.2015 08:10]: > Hi, > > I have changed the script as below: > > MYDEV='eth0.2' > > ["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "INTERFACE" = 'wan'] && ^^^ a space here, so [ "$ACTION" - the same at the end: 'wan' ] use "$INTERFACE" with the '$' please learn shell-scripting. maybe it's an good idea to use a static checker like http://www.shellcheck.net/ >{ > devstatus "$MYDEV" | grep '"up": true' && >{ > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > } > } > > > but its not working. > > What mistake i am doing. bye, bastian - greetings to china?! ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
Hi , [ "$ACTION" = "pressed" ] && [ "$BUTTON" = "lanwifi" ] && [ "$INTERFACE" = "wan" ] && { devstatus "$MYDEV" | grep '"up": true' && { echo "" > /dev/console echo "SWITCH TO RJ45" > /dev/console echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness } } even i checked on http://www.shellcheck.net/ , its not giving any feedback, it seems correct but still its not working. I writing this script under /etc/hotplug.d/button/50-button file. I have to change any other file? Regards, john On Wed, Sep 16, 2015 at 2:43 PM, Bastian Bittorfwrote: > * John kerry [16.09.2015 08:10]: > > Hi, > > > > I have changed the script as below: > > > > MYDEV='eth0.2' > > > > ["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "INTERFACE" = 'wan'] && >^^^ a space here, so [ "$ACTION" - the same at the end: 'wan' ] > use "$INTERFACE" with the '$' > > please learn shell-scripting. maybe it's an good idea to use a static > checker like http://www.shellcheck.net/ > > >{ > > devstatus "$MYDEV" | grep '"up": true' && > >{ > > echo "255" > > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > } > > } > > > > > > but its not working. > > > > What mistake i am doing. > > bye, bastian - greetings to china?! > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
* John kerry[16.09.2015 12:18]: > I am getting below log: ok, i see: INTERFACE is not set, so you have to remove the check for this var and hardcode it. please stop sending mails like this, debug on your own with a local friend. bye, bastian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
Hi, I understand its not good to mail like this, But I am quite new on this and even no body knows in my friends about this. Could you please help I hard coded the interface as below: set | logger [ "$ACTION" = "pressed" ] && [ "$BUTTON" = "lanwifi" ] && { devstatus "eth0.2" | grep "up":true && { echo "" > /dev/console echo "SWITCH TO RJ45" > /dev/console echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness } } But still same problem. Regards, John On Wed, Sep 16, 2015 at 6:23 PM, Bastian Bittorfwrote: > * John kerry [16.09.2015 12:18]: > > I am getting below log: > > ok, i see: INTERFACE is not set, so you have to remove the check for > this var and hardcode it. > > please stop sending mails like this, debug on your own with a local friend. > > bye, bastian > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
Hi, I have changed the script as below: MYDEV='eth0.2' ["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "INTERFACE" = 'wan'] && { devstatus "$MYDEV" | grep '"up": true' && { echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness } } but its not working. What mistake i am doing. Could you please correct it me. Regards, John On Tue, Sep 15, 2015 at 7:51 PM, Bastian Bittorfwrote: > * John kerry [15.09.2015 13:44]: > > Hi, > > > > I have added following condition but its not working: > > > > MYDEV='eth0' > > > > if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && { > remove the 'if' > > devstatus "$MYDEV" | grep '"up": true' && { > > echo "255" > > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > } > > } > > > > fi > remove the 'fi' > > please change the first line to e.g. > [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "$INTERFACE" = 'wan' ] > && { > > INTERFACE is the 'name' of the device, e.g. 'wan' or 'lan' > DEVICE is the real thing, e.g. eth0.1 > > > Am i doing any mistake or need to change anything > > you can always TEST you script with e.g. > > set -x > INTERFACE=bla > DEVICE=blubb > . name_of_your_script > set +x > > bye, bastian > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
Hi, I have tried script: *["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2"] && { ["${ACTION}" = "ifup" -a "${INTERFACE}" = "wan"] && {echo "" > /dev/console echo "SWITCH TO RJ45" > /dev/consoleecho "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness } & }* *but still no luck :(* Could anyone please figure out what mistakes i am doing. Regards, John On Wed, Sep 16, 2015 at 9:12 AM, John kerrywrote: > Hi, > > I have changed the script as below: > > MYDEV='eth0.2' > > ["$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "INTERFACE" = 'wan'] && >{ > devstatus "$MYDEV" | grep '"up": true' && >{ > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > } > } > > > but its not working. > > What mistake i am doing. > > Could you please correct it me. > > Regards, > John > > On Tue, Sep 15, 2015 at 7:51 PM, Bastian Bittorf > wrote: > >> * John kerry [15.09.2015 13:44]: >> > Hi, >> > >> > I have added following condition but its not working: >> > >> > MYDEV='eth0' >> > >> > if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && { >> remove the 'if' >> > devstatus "$MYDEV" | grep '"up": true' && { >> > echo "255" > >> > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness >> > } >> > } >> > >> > fi >> remove the 'fi' >> >> please change the first line to e.g. >> [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "$INTERFACE" = 'wan' ] >> && { >> >> INTERFACE is the 'name' of the device, e.g. 'wan' or 'lan' >> DEVICE is the real thing, e.g. eth0.1 >> >> > Am i doing any mistake or need to change anything >> >> you can always TEST you script with e.g. >> >> set -x >> INTERFACE=bla >> DEVICE=blubb >> . name_of_your_script >> set +x >> >> bye, bastian >> > > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
Please can anyone reply On Tue, Sep 15, 2015 at 2:16 PM, John kerrywrote: > Hi, > > I have written the following condition in /etc/hotplug.d/button/50-wps file > if [ "$ACTION" = "pressed" -a "$BUTTON" = "lanwifi" ]; then > echo "" > /dev/console > echo "SWITCH TO RJ45" > /dev/console > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > fi > > So Now whenever i pressed button the Status LED will glow otherwise OFF. > > But i need to check one more condition eth0 link UP/Down, If UP only i > have to ON the status LED. > > Could anyone please tell how i can add such condition in this script. > > Regards, > > > > On Tue, Sep 15, 2015 at 2:00 PM, John kerry wrote: > >> Hi, >> >> 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. >> >> I am able ON/OFF Status LED based on eth0 link up/down using below >> >> config led 'led_status' >> option name 'STATUS' >> option interval '50' >> option sysfs 'wndr3700:green:status' >> option default '0' >> option trigger 'netdev' >> option mode 'link' >> option dev 'eth0' >> >> But i need to check first above button that is pressed only i have to >> check eth0 status. >> >> I am not able to mix both condition in one place. >> >> Could anyone please reply, how i can add such condition in that file. >> > > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
On 15 September 2015 at 09:17, John kerrywrote: > Please can anyone reply Is someone here your paid support with 1h response time? ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
* John kerry[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
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
Hi, I have written the following condition in /etc/hotplug.d/button/50-wps file if [ "$ACTION" = "pressed" -a "$BUTTON" = "lanwifi" ]; then echo "" > /dev/console echo "SWITCH TO RJ45" > /dev/console echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness fi So Now whenever i pressed button the Status LED will glow otherwise OFF. But i need to check one more condition eth0 link UP/Down, If UP only i have to ON the status LED. Could anyone please tell how i can add such condition in this script. Regards, On Tue, Sep 15, 2015 at 2:00 PM, John kerrywrote: > Hi, > > 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. > > I am able ON/OFF Status LED based on eth0 link up/down using below > > config led 'led_status' > option name 'STATUS' > option interval '50' > option sysfs 'wndr3700:green:status' > option default '0' > option trigger 'netdev' > option mode 'link' > option dev 'eth0' > > But i need to check first above button that is pressed only i have to > check eth0 status. > > I am not able to mix both condition in one place. > > Could anyone please reply, how i can add such condition in that file. > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
On 15/09/2015 09:27, Rafał Miłecki wrote: > On 15 September 2015 at 09:17, John kerrywrote: >> Please can anyone reply > > Is someone here your paid support with 1h response time? although i find this emails annoying and funny at the same time we can probably assume that it is not him that thinks so but some manager further up in his hierachy that does not understand how opensource works that is pressuring him. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
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 Bittorfwrote: > * John kerry [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
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
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 kerrywrote: > 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 > wrote: > >> * John kerry [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
Re: [OpenWrt-Devel] OpenWrt /etc/hotplug.d/button/00-wps
* John kerry[15.09.2015 13:44]: > Hi, > > I have added following condition but its not working: > > MYDEV='eth0' > > if [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" ] && { remove the 'if' > devstatus "$MYDEV" | grep '"up": true' && { > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > } > } > > fi remove the 'fi' please change the first line to e.g. [ "$ACTION" = "pressed" -a "$BUTTON" = "BUT_2" -a "$INTERFACE" = 'wan' ] && { INTERFACE is the 'name' of the device, e.g. 'wan' or 'lan' DEVICE is the real thing, e.g. eth0.1 > Am i doing any mistake or need to change anything you can always TEST you script with e.g. set -x INTERFACE=bla DEVICE=blubb . name_of_your_script set +x bye, bastian ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel