Re: [OpenWrt-Devel] AR9344 Openwrt - LAN and WAN interface link issue
Hi Jow, Thank you so much for the reply. Below is my /etc/config/network file config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config interface 'lan' option ifname 'eth0.1 eth1' option type 'bridge' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' config interface 'wan' option ifname 'eth0.2' option proto 'dhcp' config switch option name 'eth0' option reset '1' option enable_vlan '1' config switch_vlan option device 'eth0' option vlan '1' option ports '0t 2 3 4 5' config switch_vlan option device 'eth0' option vlan '2' option ports '0t 1' config switch option name 'eth1' option reset '1' option enable_vlan '1' config switch_vlan option device 'eth1' option vlan '1' option ports '0 1 2 3 4 5' Could you please tell how i can use command to check WAN and LAN link separately using switch command. Regards, On Wed, Oct 28, 2015 at 6:51 PM, Jo-Philipp Wichwrote: > Hi Afkar, > > > The same thing if we connect only WAN cable and check "cat > > /sys/class/net/eth0.1/carrier" and "cat /sys/class/net/eth0.2/carrier" > > both returns "1" . But it should not be like this. > > This is expected since both eth0.1 and eth0.2 are actually SoC > connection to the external switch ICs CPU port, those PCB traces are > always connected. > > In order to get the link state for single ports on the external switch, > use the swconfig command. > > ~ Jow > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] AR9344 Openwrt - LAN and WAN interface link issue
Hi Jow, Thanks a lot for the reply. I have tried the switch command but getting failed response as below: root@openwrt:/# swconfig dev switch0 port 1 get link failed root@openwrt:/# swconfig dev switch0 port 2 get link failed root@openwrt:/# swconfig dev switch0 port 3 get link failed root@openwrt:/# swconfig dev switch0 port 4 get link failed Do i need to change the /etc/config/network file which i share in previous mail. One more thing, the switch command below both are same, then how will get to know differentiate between WAN and LAN. WAN: swconfig dev switch0 port 1 get link LAN: swconfig dev switch0 port 1 get link Could you please guide, as I newbie to this. Regards, Afkar On Wed, Oct 28, 2015 at 11:29 PM, Jo-Philipp Wichwrote: > Hi Afkar, > > WAN: > > swconfig dev switch0 port 1 get link > > LAN: > > swconfig dev switch0 port 1 get link > swconfig dev switch0 port 2 get link > swconfig dev switch0 port 3 get link > swconfig dev switch0 port 4 get link > > > ~ Jow > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] AR9344 Openwrt - LAN and WAN interface link issue
Hi, When I connect only LAN cable and check below command on console "cat /sys/class/net/eth0.1/carrier" will get "1" its correct but when we check "cat /sys/class/net/eth0.2/carrier" even the only LAN cable is connected it returns "1" but i didn't connect the WAN cable. The same thing if we connect only WAN cable and check "cat /sys/class/net/eth0.1/carrier" and "cat /sys/class/net/eth0.2/carrier" both returns "1" . But it should not be like this. Any help would be appreciate. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] AR9344 Openwrt + check Multiple condition /etc/config/system
I am working on AR9344 Openwrt. I have configured the status led based on eth0.2 trigger in /etc/config/system config led 'Status_led' option name 'Status_led' option interval '50' option sysfs 'db120:green:status' option default '0' option trigger 'netdev' option mode 'link tx rx' option dev 'eth0.2' I have configured GPIO16 as input. I want to check both condition as below: if( (GPIO16 is high) && (eth0.2 is high) ) { Status Led ON } else { status led OFF } I need to check both condition to ON/OFF Status LED. Could anyone help me to write both condition to ON/OFF Status LED. Any help would be appreciate. Regards, ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] How to config GPIO and read the GPIO value in OpenWRT
I have configured button definition in the mach-file as below: .desc = "LAN WIFI button", .type = EV_KEY, .code = KEY_LAN_WIFI_BUTTON, .debounce_interval = DB120_KEYS_DEBOUNCE_INTERVAL, .gpio = DB120_GPIO_BTN_LAN_WIFI, .active_low = 1, and add script under file : etc/hotplug.d/button/50-buttonpress if [ "$ACTION" = "pressed" -a "$BUTTON" = "lanwifi" ]; then echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness else echo "0" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness fi In this case if i move the slide switch, it works fine but one issue is there. When i do reset the status LED always ON. If we move slide switch only it works i mean to say suppose now slide switch in low state means Status LED is OFF then if i do reset the device then also the Status LED becomes ON. On Sun, Oct 18, 2015 at 6:07 AM, Hartmut Knaack <knaac...@gmx.de> wrote: > Afkar Rafique schrieb am 16.10.2015 um 03:47: > > Thanks for the reply. > > > > I have change the script as below: > > > > #!/bin/sh /etc/rc.common > > > > START=19 > > start() { > > echo in > /sys/class/gpio/gpio16/direction 2> /dev/null > > echo 16 > /sys/class/gpio/export 2> /dev/null > > Still, you can only set the direction AFTER exporting the GPIO (otherwise > the gpioXX > directory with its contents like direction don't exist). > > > if [ "$(cat /sys/class/gpio/gpio16/value)" == "1" ] ; then > > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > else > > echo "0" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > fi > > } > > > > I need to monitor the LED on/off all the time during runtime. > > > > During start of this script its working, but not getting how to make it > work run time. > > > > Could you please explain how i can do it in gpio-button. > > That would require you to add a custom button definition in the mach-file > of your > specific device and compile your own firmware image. > You could however use a small script which infinitely loops through your > poll and sleeps > for a second, so the CPU can work on other tasks, too (while true; do > if...then...else > sleep 1; done). Downside is, that you can only react to "button press > events", which are > long enough (one second, as this is the low limit of sleep time). Also, > don't forget to > let it run in background, so you don't block your init process. > > > > > On Fri, Oct 16, 2015 at 3:38 AM, Hartmut Knaack <knaac...@gmx.de > <mailto:knaac...@gmx.de>> wrote: > > > > Afkar Rafique schrieb am 15.10.2015 um 04:07: > > > Thanks for the reply. > > > > > > i have Create /etc/init.d/buttons and written below script: > > > > > > #!/bin/sh /etc/rc.common > > > START=19 > > > start() { > > > /bin/umount /etc/config 2>/dev/null > > > echo out > /sys/class/gpio/gpio16/direction 2> /dev/null > > > echo 16 > /sys/class/gpio/export 2> /dev/null > > > if [ "$(cat /sys/class/gpio/gpio16/value)" == "1" ] ; then > > > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > > else > > > echo "0" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > > fi > > > } > > > > > > and restart . > > > > > > chmod +x /etc/init.d/buttons > > > /etc/init.d/buttons enable > > > /etc/init.d/buttons start > > > > > > Now i am able to read the GPIO 16 value 1/0 based on GPIO state, > but as above script i have written to ON/OFF the Status LED based on GPIO > value, Status LED is not getting OFF even if GPIO16 value is "0". > > > > > > Can anyone please help on this > > > > > > > Quite a mess you've got there. No idea why you need to umount > /etc/config, > > but anyway: First thing in GPIO setup is exporting, then you set its > direction. > > If you intend to read the GPIO status, then better use "in" as > d
Re: [OpenWrt-Devel] How to config GPIO and read the GPIO value in OpenWRT
Thanks for the reply. I have change the script as below: #!/bin/sh /etc/rc.common START=19 start() { echo in > /sys/class/gpio/gpio16/direction 2> /dev/null echo 16 > /sys/class/gpio/export 2> /dev/null if [ "$(cat /sys/class/gpio/gpio16/value)" == "1" ] ; then echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness else echo "0" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness fi } I need to monitor the LED on/off all the time during runtime. During start of this script its working, but not getting how to make it work run time. Could you please explain how i can do it in gpio-button. On Fri, Oct 16, 2015 at 3:38 AM, Hartmut Knaack <knaac...@gmx.de> wrote: > Afkar Rafique schrieb am 15.10.2015 um 04:07: > > Thanks for the reply. > > > > i have Create /etc/init.d/buttons and written below script: > > > > #!/bin/sh /etc/rc.common > > START=19 > > start() { > > /bin/umount /etc/config 2>/dev/null > > echo out > /sys/class/gpio/gpio16/direction 2> /dev/null > > echo 16 > /sys/class/gpio/export 2> /dev/null > > if [ "$(cat /sys/class/gpio/gpio16/value)" == "1" ] ; then > > echo "255" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > else > > echo "0" > > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness > > fi > > } > > > > and restart . > > > > chmod +x /etc/init.d/buttons > > /etc/init.d/buttons enable > > /etc/init.d/buttons start > > > > Now i am able to read the GPIO 16 value 1/0 based on GPIO state, but as > above script i have written to ON/OFF the Status LED based on GPIO value, > Status LED is not getting OFF even if GPIO16 value is "0". > > > > Can anyone please help on this > > > > Quite a mess you've got there. No idea why you need to umount /etc/config, > but anyway: First thing in GPIO setup is exporting, then you set its > direction. > If you intend to read the GPIO status, then better use "in" as direction. > Now, do you just want to do an action (LED on/off) just during start of > this > script, or all the time during runtime, when the GPIO status changes? In > the > latter case, you should look into gpio-button. > > > > > > > On Thu, Oct 15, 2015 at 12:37 AM, Martin Blumenstingl < > martin.blumensti...@googlemail.com martin.blumensti...@googlemail.com>> wrote: > > > > On Wed, Oct 14, 2015 at 12:19 PM, Afkar Rafique <afkar...@gmail.com > <mailto:afkar...@gmail.com>> wrote: > > > Could anyone please explain how i can configure and read GPIO > value. > > There's an article on the wiki which explains how to set a GPIO to a > > specific value: [0] > > If you want to read a GPIO value then you use direction "in" and then > > simply cat to read the "value". > > > > The only thing that you might have to do is doing a bit of maths to > > get the correct GPIO number. > > When you are trying to read GPIO #16 then it's GPIO #16 of a specific > > chip -> /sys/class/gpio/ should contain a file gpiochipNNN. > > What you do is take NNN (let's assume it's 456) and add your GPIO > > number to it: 456 + 16 = 472 -> this is the number needef to "export" > > the GPIO. > > > > > > [0] http://wiki.openwrt.org/doc/hardware/port.gpio#software > > > > > > > > > > ___ > > openwrt-devel mailing list > > openwrt-devel@lists.openwrt.org > > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel > > > > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] How to config GPIO and read the GPIO value in OpenWRT
Hi, I am working on AR9344 Openwrt. I need to configure the GPIO16 and read the status of GPIO. Based on GPIO read value, has to ON/OFF the status LED. Could anyone please explain how i can configure and read GPIO value. Regards, ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] How to config GPIO and read the GPIO value in OpenWRT
Thanks for the reply. i have Create /etc/init.d/buttons and written below script: #!/bin/sh /etc/rc.common START=19 start() { /bin/umount /etc/config 2>/dev/null echo out > /sys/class/gpio/gpio16/direction 2> /dev/null echo 16 > /sys/class/gpio/export 2> /dev/null if [ "$(cat /sys/class/gpio/gpio16/value)" == "1" ] ; then echo "255" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness else echo "0" > /sys/devices/platform/leds-gpio/leds/db120:green:status/brightness fi } and restart . chmod +x /etc/init.d/buttons /etc/init.d/buttons enable /etc/init.d/buttons start Now i am able to read the GPIO 16 value 1/0 based on GPIO state, but as above script i have written to ON/OFF the Status LED based on GPIO value, Status LED is not getting OFF even if GPIO16 value is "0". Can anyone please help on this On Thu, Oct 15, 2015 at 12:37 AM, Martin Blumenstingl < martin.blumensti...@googlemail.com> wrote: > On Wed, Oct 14, 2015 at 12:19 PM, Afkar Rafique <afkar...@gmail.com> > wrote: > > Could anyone please explain how i can configure and read GPIO value. > There's an article on the wiki which explains how to set a GPIO to a > specific value: [0] > If you want to read a GPIO value then you use direction "in" and then > simply cat to read the "value". > > The only thing that you might have to do is doing a bit of maths to > get the correct GPIO number. > When you are trying to read GPIO #16 then it's GPIO #16 of a specific > chip -> /sys/class/gpio/ should contain a file gpiochipNNN. > What you do is take NNN (let's assume it's 456) and add your GPIO > number to it: 456 + 16 = 472 -> this is the number needef to "export" > the GPIO. > > > [0] http://wiki.openwrt.org/doc/hardware/port.gpio#software > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] AR9344 OpenWRT LED Handling
Hi Everyone, I have configured the /etc/config/system file as below: 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.2' so It is working fine whenever i connect eth0.2 is UP ON the Status LED and OFF the LED in case of eth0.2 is down. I need to add one more condition before checking eth0.2 UP/DOWN to handle the Status LED. I need to check whether "$ACTION" = "pressed" -a "$BUTTON" = "BUT_1" is pressed or not, then will check eth0.2 UP/down. If BUT_1 pressed and eth0.2 up --> Status LED ON otherwise OFF. Could anyone tell how i can add Button condition in /etc/config/system file. Regards, Afkar ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Separate Default SSID for 2.4GHz and 5GHz
Hi Everyone, I am working on AR93XX openWrt project. I have to configure the wifi0 as 2.4GHz and 5Ghz as per the selection of user. Mainly I have to add selection in the GUI to switch between 2.4GHz and 5GHz. I have to keep two separate default SSID for 2.4GHz and 5GHz. Could anyone can help me that how I can keep two separate configuration and how I can handle this in software. I mean to say how I can thin into GUI and can handle backend. Thanks. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel