OpenWrt Forum Archive

Topic: Wl 500gp Buttons

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,
I'm tring to make my router an AP with a vodafone UMTS modem (Huawei E220)
I've sucessefuly configured the modem however I would like to know how could I use the buttuns to disable and enabling the connection. I've found this:

******************************************************************************

http://wiki.openwrt.org/MobileAPHowTo2

6. Misc

How about a little script to monitor the SES button and connect?
root@OpenWrt:~# vi /usr/sbin/dialmon
#!/bin/sh
junk=0
until [ $junk -eq 1 ]
do
        sleep 1
        read junk </proc/sys/button
done
# turn on white LED in SES button
echo 32 > /proc/sys/diag
/usr/sbin/pppd call cingular
root@OpenWrt:~# chmod +x /usr/sbin/dialmon

Let's use SES amber to show connect status. Add echo to these files:
root@OpenWrt:~# cd /etc/ppp
root@OpenWrt:~# rm ip-up ip-down
root@OpenWrt:~# cp /rom/etc/ppp/ip-up .
root@OpenWrt:~# cp /rom/etc/ppp/ip-down .
root@OpenWrt:~# vi ip-up
#!/bin/sh
[ -z "$6" ] || env -i ACTION="ifup" INTERFACE="$6" PROTO=ppp /sbin/hotplug "iface"
echo 33 > /proc/sys/diag
root@OpenWrt:~# vi ip-down
#!/bin/sh
[ -z "$6" ] || env -i ACTION="ifdown" INTERFACE="$6" PROTO=ppp /sbin/hotplug "iface"
echo 0 >/proc/sys/diag

Now just run "dialmon &", and push the button!

******************************************************************************

However this doesn't work on asus.
Al the Information I've found was this:

The reset button does not work (due largely to mis-mapped /proc/sys/reset)
gpio 0 = RESTORE button (reset) (00 = unpressed, 01 = pressed)
gpio 1 = Power LED (enable = off, disable = on)
gpio 4 = EZ SETUP button (similar to linksys "button"?) (00 = unpressed, 01 = pressed)

Can anyone help me making a script using the buttons?

mkdir -p /etc/hotplug.d/button
touch /etc/hotplug.d/button/01-connect

and put this

if [ "$BUTTON" = "ses" ] ; then
 if [ "$ACTION" = "pressed" ] ; then
   (something like /usr/sbin/pppd call cingular etc.)
 fi
fi

Hi it doesn't work.
Again my problem is that i dont have the linksys router, mine is a Asus so i don't have the "ses" button. All I have is a LED (GPIO 1) and two buttons (GPIO 0 and GPIO 4).

Can anyone explain what should I do in order to use them? Seems like noone did this in asus.

If I make the procedure as in linksys

Code:

root@OpenWrt:~# vi /usr/sbin/dialmon
#!/bin/sh
junk=0
until [ $junk -eq 1 ]
do
        sleep 1
        read junk </proc/sys/button
done
# turn on white LED in SES button
echo 32 > /proc/sys/diag
/usr/sbin/pppd call cingular
root@OpenWrt:~# chmod +x /usr/sbin/dialmon

I Get this error:

Code:

/usr/sbin/dialmon: 8: cannot open /proc/sys/button: No such file

install a script into /etc/hotplug.d/button
it will be called when a button is pressed or released
you can check for these variables:
ACTION=<pressed|released>
BUTTON=<button name>
SEEN=<time since last press or release event>
polling the button state from a script is a very ugly solution...

@Casemod: I have wl-500gp as well, and this script working.  When you press EZSetup button then $BUTTON has "ses" value.

nbd wrote:

install a script into /etc/hotplug.d/button
it will be called when a button is pressed or released
you can check for these variables:
ACTION=<pressed|released>
BUTTON=<button name>
SEEN=<time since last press or release event>
polling the button state from a script is a very ugly solution...

I'm sorry I have a limited knowlage on linux... Wich script should I install in  /etc/hotplug.d/button ??

I may be getting this wrong sorry, but if i use the linksys script I cant find the directory /proc/sys/button.

Can someone give me an example, for instance to light up the GPIO 1 LED when I press the EZSetup button ( GPIO 4) just to see if there is anything wrong with the modules or that? Im confused :S

Thanks!

mkdir -p /etc/hotplug.d/button
touch /etc/hotplug.d/button/01-led
chmod 777 /etc/hotplug.d/button/01-led
vi /etc/hotplug.d/button/01-led

and put this into file

#!/bin/sh

if [ "$BUTTON" = "ses" ] ; then
 if [ "$ACTION" = "pressed" ] ; then
  LED=`cat /proc/diag/led/power`
  if [ "$LED" = "0" ]; then
    echo "1" > /proc/diag/led/power
  else
    echo "0" > /proc/diag/led/power
  fi
 fi
fi
obsy wrote:
mkdir -p /etc/hotplug.d/button
touch /etc/hotplug.d/button/01-led
chmod 777 /etc/hotplug.d/button/01-led
vi /etc/hotplug.d/button/01-led

and put this into file

#!/bin/sh

if [ "$BUTTON" = "ses" ] ; then
 if [ "$ACTION" = "pressed" ] ; then
  LED=`cat /proc/diag/led/power`
  if [ "$LED" = "0" ]; then
    echo "1" > /proc/diag/led/power
  else
    echo "0" > /proc/diag/led/power
  fi
 fi
fi

Hi, The Led script works ok, but if I put  /usr/sbin/pppd call cingular it does't do anything.

I've tried this script

 if [ "$BUTTON" = "ses" ] ; then
            if [ "$ACTION" = "pressed" ] ; then
               reboot
                fi
            fi

It works fine as the LED but if I write /usr/sbin/pppd call cingular instead of reboot nothing happens.

Any ideas??

Thanks!

(Last edited by Casemod on 11 Jul 2007, 15:51)

hi, try this

echo 1| /usr/sbin/pppd call cingular

The discussion might have continued from here.