hi guys,
did anyone manage to set this up on a wl-500gp v2 running RC5?
I tried wifitoggle package, but doesn't work.
Did some debugging and found the followings:
1. If I press ez-setup while wifi is off, hotplug catches the event and triggers wifi up , but wifi up generates some additional ses and reset events, and don't know why , and afterwards while wifi is on hotplug doesn't catch button events at all .
2. if I switch wifi off by wifi down from command line, then hotplug catches button events again.
any idea what's the relation between wifi and buttons or hotplug??
here's my code:
root@OpenWrt:~# cat /etc/hotplug.d/button/01-wifitoggle
#!/bin/sh
logger $BUTTON
logger $ACTION
lock_file="/tmp/last_wifi_toggle"
if [ "$BUTTON" = "ses" ] && [ "$ACTION" = "released" ] && [ ! -e $lock_file ] ; then
touch $lock_file
echo "rm -f $lock_file" | at now + 5 minutes
( sleep 1; /sbin/woggle ) &
fi
root@OpenWrt:~#
root@OpenWrt:~# cat /sbin/woggle
#!/bin/sh
case "$(uci get wireless.@wifi-device[0].disabled)" in
1)
logger wifion
uci set wireless.@wifi-device[0].disabled=0
wifi up
echo 1 > /proc/diag/led/wlan
;;
*)
logger wifioff
uci set wireless.@wifi-device[0].disabled=1
wifi down
echo 0 > /proc/diag/led/wlan
;;
esac
and some logs:
Jun 22 23:04:17 OpenWrt user.notice root: ses
Jun 22 23:04:17 OpenWrt user.notice root: pressed
Jun 22 23:04:17 OpenWrt user.notice root: ses
Jun 22 23:04:17 OpenWrt user.notice root: released
Jun 22 23:04:18 OpenWrt user.notice root: wifion
Jun 22 23:04:19 OpenWrt daemon.info hotplug: name=wlan0, path=/devices/ssb0:3/net/wlan0
Jun 22 23:04:20 OpenWrt user.info kernel: b43-phy0: Loading firmware version 410.2160 (2007-05-26 15:32:10)
Jun 22 23:04:20 OpenWrt user.notice root: reset
Jun 22 23:04:20 OpenWrt user.notice root: pressed
Jun 22 23:04:20 OpenWrt user.notice root: ses
Jun 22 23:04:20 OpenWrt user.notice root: pressed
Jun 22 23:04:25 OpenWrt daemon.info hotplug: name=hw_random, path=/devices/virtual/misc/hw_random
Jun 22 23:04:25 OpenWrt daemon.info hotplug: name=hw_random, path=/devices/virtual/misc/hw_random
Jun 22 23:04:25 OpenWrt user.info kernel: b43-phy0: Loading firmware version 410.2160 (2007-05-26 15:32:10)
Jun 22 23:04:25 OpenWrt daemon.info hotplug: name=mon.wlan0, path=/devices/ssb0:3/net/mon.wlan0
Jun 22 23:04:26 OpenWrt user.notice root: reset
Jun 22 23:04:26 OpenWrt user.notice root: released
Jun 22 23:04:26 OpenWrt user.notice root: ses
Jun 22 23:04:26 OpenWrt user.notice root: released
Jun 22 23:04:26 OpenWrt user.notice root: reset
Jun 22 23:04:26 OpenWrt user.notice root: pressed
Jun 22 23:04:26 OpenWrt user.notice root: ses
Jun 22 23:04:26 OpenWrt user.notice root: pressed
Jun 22 23:04:31 OpenWrt daemon.info hotplug: name=hw_random, path=/devices/virtual/misc/hw_random
Jun 22 23:04:31 OpenWrt user.info kernel: device wlan0 entered promiscuous mode
Jun 22 23:04:31 OpenWrt user.info kernel: br-lan: port 2(wlan0) entering forwarding state
Jun 22 23:04:34 OpenWrt user.info kernel: device wlan0 left promiscuous mode
Jun 22 23:04:34 OpenWrt user.info kernel: br-lan: port 2(wlan0) entering disabled state
Jun 22 23:04:34 OpenWrt user.info kernel: device wlan0 entered promiscuous mode
Jun 22 23:04:34 OpenWrt user.info kernel: br-lan: port 2(wlan0) entering forwarding state
this is the result of one ez-setup button press while wifi is off. you can see one ses pressed then ses released what is the expected behavior, than my wifion message, this is fine, but than there are some additional events caught by hotplug. I created /tmp/last_wifi_toggle and after 5 minutes deleting it via at to avoid hotplug catching the auto generated events by wifi up.
appreciate any idea.
thank you!