User(s) browsing this thread: 2 Guest(s)
|
Watchdog script to get rid of wireless (WiFi) disconnections
|
|
07-02-2009, 05:38 PM
(This post was last modified: 07-07-2009 09:26 PM by keramidas.)
|
|||
|
|||
|
Hi all,
This is my first post. I'm using a PCH A-110 with a WN-100, connected to my wireless network (provided by a Zyxel 802.11g router). About every day, my PCH was disconnecting from the wireless network, and switching to wired mode. I don't have an Ethernet cable plugged in, so I had to switch on the TV, go to the Setup page (using the remote control) and put the network mode to Wi-Fi again. ![]() My 802.11g router is reliable and doesn't crash/disconnect my other Wi-Fi devices, so I had to find a good way for the PCH to reconnect without user intervention, until the issue gets fixed in later firmwares ![]() Good news: it seems to work great ! ![]() To use the script on your PCH, first set it to Wireless mode, then add a line to /share/start_app.sh as follows: #M_A_R_K_E_R_do_not_remove_me /bin/nice -n-20 /share/net_watchdog.sh & exit 0 Now type this into a file called /share/net_watchdog.sh: #!/bin/sh STARTUP_DELAY="300" INTERVAL="20" IF_CONF="/etc/network/interfaces" WPA_CONF="/opt/wifi/config/wpa_supplicant.conf" IFACE=`sed -n 's|^iface \(.*\) inet static$|\1|p' $IF_CONF` MY_IP=`sed -n 's|^\taddress \(.*\)$|\1|p' $IF_CONF` NETMASK=`sed -n 's|^\tnetmask \(.*\)$|\1|p' $IF_CONF` GATEWAY_IP=`sed -n 's|^\tgateway \(.*\)$|\1|p' $IF_CONF` GATEWAY_ESSID=`sed -n 's|^\tssid="\(.*\)"$|\1|p' $WPA_CONF` /bin/sleep ${STARTUP_DELAY} while [ 0 ]; do /bin/sleep ${INTERVAL}; /bin/ping -c1 ${GATEWAY_IP} 1>/dev/null 2>/dev/null || ( /sbin/ifconfig ${IFACE} down; /usr/bin/killall -9 wpa_supplicant; /sbin/ifconfig ${IFACE} ${MY_IP} netmask ${NETMASK}; /opt/wifi/bin/wpa_supplicant -B -Dotus -iwlan0 -c${WPA_CONF}; /opt/wifi/bin/iwconfig ${IFACE} essid ${GATEWAY_ESSID}; /sbin/route add default gw ${GATEWAY_IP} ); done Now type: chmod +x /share/net_watchdog.sh Now reboot or run the script manually (by typing the same command as in /share/start_app.sh). Note that the script will first wait 300 seconds (5 minutes) before doing anything, so in case of problems, you have 5 minutes to kill it and to remove it from your startup script ![]() Please share your ideas, constructive comments and good/bad experiences about this script ! |
|||
4 users say Thank You to keramidas for this post |
|
07-02-2009, 06:22 PM
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
Whether it works or not I for one am extreneley grateful that you have taken the time to write not only the script but also a good little guide for those none techies like me to follow.
I can see me referring quite a few to this thread to see if it helps with disconnections.
A400: SSD+SD Card(Apps), HDMI A300: USB(Apps), HDMI C200: USB(Apps), BD SH-B083L(SB01), HDMI CAT6 Wired Network: TV TX-P42G20, HP ProCurve 1400-8G, Netgear GS-608/605, Synology CS407 |
|||
|
07-02-2009, 06:34 PM
(This post was last modified: 07-02-2009 07:05 PM by keramidas.)
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
Hi chris57,
My pleasure. I can't guarantee miracles but for me, it works well. On my PCH-A110, which will soon have 4 days uptime, the "dmesg" command shows an endless stream of: Disconnection Notify (...) ************* ZD_PARAM_ROAMING: 0 ZD_PARAM_WPA: <3>enable Station Mode Set Encryption Type NONE (...) ================ZD_PARAM_COUNTERMEASURES: <3>disable ZD_PARAM_DROPUNENCRYPTED: <3>enable Disconnection Notify Disconnection Notify Set Encryption Type NONE (...) Set Encryption Type NONE giwscan - Report Scan Results giwscan - pBssList->bssCount : 0 pid: 32171 CWY - usbdrvwext_siwscan giwscan - Report Scan Results giwscan - pBssList->bssCount : 5 pid: 32171 ZD_PARAM_AUTH_ALGS: <3>OPEN_SYSTEM Disconnection Notify ZD_PARAM_DROPUNENCRYPTED: <3>enable usbdrv_wpa_ioctl: ZD_CMD_SET_GENERIC_ELEMENT wpaie Length : 0 wd->ap.wpaLen: 0 ZD_IOCTL_PRIVACY: <7>Connected to AP, MAC: 00:a0:c5:XX:XX:XX little_endian enable Disconnection Notify ************* ZD_PARAM_ROAMING: 1 Disconnection Notify Connected to AP, MAC: 00:a0:c5:XX:XX:XX little_endian zfwUsbSubmitBulkUrb fail, status: 0xffffffea usbdrv_close usbdrv_netif_carrier_off usbdrv_isolate_driver Disconnection Notify zfLnxUsbDataIn_callback() : status=0xffffff7d (...) Enter open() zfwInitUsbTxQ Disconnection Notify Disconnection Notify Disconnection Notify ************* ZD_PARAM_ROAMING: 0 ZD_PARAM_WPA: <3>enable Station Mode Set Encryption Type NONE (...) ================ZD_PARAM_COUNTERMEASURES: <3>disable ZD_PARAM_DROPUNENCRYPTED: <3>enable Set Encryption Type NONE (...) Disconnection Notify Disconnection Notify giwscan - Report Scan Results giwscan - pBssList->bssCount : 0 pid: 3381 Set Encryption Type NONE (...) CWY - usbdrvwext_siwscan giwscan - Report Scan Results giwscan - pBssList->bssCount : 3 pid: 3381 ZD_PARAM_AUTH_ALGS: <3>OPEN_SYSTEM Disconnection Notify ZD_PARAM_DROPUNENCRYPTED: <3>enable usbdrv_wpa_ioctl: ZD_CMD_SET_GENERIC_ELEMENT wpaie Length : 0 wd->ap.wpaLen: 0 ZD_IOCTL_PRIVACY: <3>enable Disconnection Notify ************* ZD_PARAM_ROAMING: 1 Disconnection Notify Connected to AP, MAC: 00:a0:c5:XX:XX:XX little_endian usbdrv_close usbdrv_netif_carrier_off usbdrv_isolate_driver Disconnection Notify zfLnxUsbDataIn_callback() : status=0xffffff7d etc... etc... This indicates several disconnections, and the subsequent reconnections by the watchdog script. It seems to reconnect every time ![]() Do you want to really test the script ? Run it, wait at least 5 minutes then do: /opt/wifi/bin/iwconfig wlan0 essid HAHAHAHA This "suicidal" command asks your PCH to connect to a nonexistent WiFi access point. My watchdog script should detect the connection problem, and automagically reconnect to the correct (ie: your own) WiFi router again. I tried it several times, it worked, and my SSH session to the PCH was not even dropped
|
|||
|
07-07-2009, 09:27 PM
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
I edited the 1st post, to fix a problem with parameters of "ping". If you copy/pasted this script for your PCH, please replace it with this new version...
I'm currently testing the "version 2" of this script. Stay tuned
|
|||
|
07-17-2009, 10:32 AM
|
|||
|
|||
RE: Watchdog script to get rid of wireless (WiFi) disconnections
(07-07-2009 09:27 PM)keramidas Wrote: I edited the 1st post, to fix a problem with parameters of "ping". If you copy/pasted this script for your PCH, please replace it with this new version... great job I have the same problem. but how to put the script? can be a more detailed? TV: Panasonic TX-P42X10E | Xbox 360 | Popcorn hour A-110 wi-fi + 1TB WD10EADS | Ipad 3G 32Gb Blog TecnologiaXte |
|||
|
07-18-2009, 08:01 PM
(This post was last modified: 07-19-2009 05:52 AM by chris57.)
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
Have you installed Telnet via the CSI? Do that and reboot your NMT.
Make sure you have the NMT Apps FTP, myihome and SMB server ON. Install on your PC notepad++:- http://notepad-plus.sourceforge.net/uk/site.htm Now navigate with your PC to the NMT HDD share. Then look for a file called start_app.sh and open it with Notepad++. You will see the lines from the first post MARKER DO NOT...... Add the lines that is in the first post to the file with Notepadd++, then save. /bin/nice -n-20 /share/net_watchdog.sh & exit 0 The create a new file in Notepadd++, make sure you save not as a Windows Cf file but as a LinuxUnix file just copy the start_app.sh and remove all the text and add the text below and save it, make sure you do not do this to the actual start_app.sh file though. Now type this into a file and save it in /share/ as 'net_watchdog.sh' #!/bin/sh STARTUP_DELAY="300" INTERVAL="20" IF_CONF="/etc/network/interfaces" WPA_CONF="/opt/wifi/config/wpa_supplicant.conf" IFACE=`sed -n 's|^iface \(.*\) inet static$|\1|p' $IF_CONF` MY_IP=`sed -n 's|^\taddress \(.*\)$|\1|p' $IF_CONF` NETMASK=`sed -n 's|^\tnetmask \(.*\)$|\1|p' $IF_CONF` GATEWAY_IP=`sed -n 's|^\tgateway \(.*\)$|\1|p' $IF_CONF` GATEWAY_ESSID=`sed -n 's|^\tssid="\(.*\)"$|\1|p' $WPA_CONF` /bin/sleep ${STARTUP_DELAY} while [ 0 ]; do /bin/sleep ${INTERVAL}; /bin/ping -c1 ${GATEWAY_IP} 1>/dev/null 2>/dev/null || ( /sbin/ifconfig ${IFACE} down; /usr/bin/killall -9 wpa_supplicant; /sbin/ifconfig ${IFACE} ${MY_IP} netmask ${NETMASK}; /opt/wifi/bin/wpa_supplicant -B -Dotus -iwlan0 -c${WPA_CONF}; /opt/wifi/bin/iwconfig ${IFACE} essid ${GATEWAY_ESSID}; /sbin/route add default gw ${GATEWAY_IP} ); done Now type open filezilla FTP on your PC and log into the root of the NMT via ftpuser, port21 etc and goto Server>Enter Custom Command: site chmod 755 net_watchdog.sh Now reboot or run the script manually (by typing the same command as in /share/start_app.sh). A clumsy none Telnet way of getting to the same place, I think. You only need to install Telnet to get the start_app.sh file. A400: SSD+SD Card(Apps), HDMI A300: USB(Apps), HDMI C200: USB(Apps), BD SH-B083L(SB01), HDMI CAT6 Wired Network: TV TX-P42G20, HP ProCurve 1400-8G, Netgear GS-608/605, Synology CS407 |
|||
|
07-19-2009, 11:55 PM
|
|||
|
|||
|
For me, the script does not seem to work.
It kills the connection and rebuilds it every 20 seconds. Quite interesting to try to start telnet and kill the script within 20 secs.. :-) My gateway is up (resulting in valid data) so it must be something else that makes it decide to rebuild the connection.... Please let me know about version 2.1 :-)) Droggie - Broken A110 + non-supported TP-Link TL WN 821 N + WD10EADS laying worthless waiting for better times |
|||
|
07-20-2009, 10:20 AM
|
|||
|
|||
RE: Watchdog script to get rid of wireless (WiFi) disconnections
(07-19-2009 11:55 PM)Droggie Wrote: For me, the script does not seem to work. thanks Chris, I currently do not have the hard disk. Just buy and i will try the procedure. TV: Panasonic TX-P42X10E | Xbox 360 | Popcorn hour A-110 wi-fi + 1TB WD10EADS | Ipad 3G 32Gb Blog TecnologiaXte |
|||
|
07-23-2009, 10:42 PM
|
|||
|
|||
|
Hee Keramidas,
Any progress on your script ? If you need testers, I would gladly be of help... just let me know. It appears that your script is at least capable of getting the connection back on. Greetz Droggie - Broken A110 + non-supported TP-Link TL WN 821 N + WD10EADS laying worthless waiting for better times |
|||
|
07-24-2009, 09:36 PM
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
It's certainly nice to see people putting their creativity at work but .....
I'm thinking you're trying to work around an underlying problem, which is: why is your WiFi disconnecting? Shouldn't you try different channel settings first to see if you can stabilize the wireless connection? Or, on the other hand, is the distance to the router ok and, more importantly, are there any obstacles in the way such as concrete walls, floors, aluminium underflooring, etc.? |
|||
|
07-24-2009, 10:06 PM
(This post was last modified: 07-24-2009 10:31 PM by keramidas.)
|
|||
|
|||
RE: Watchdog script to get rid of wireless (WiFi) disconnections
(07-24-2009 09:36 PM)EdP Wrote: It's certainly nice to see people putting their creativity at work but .....Thanks for your answer. It's a good question... Actually I have 3 laptops connected to the same network, and they never get disconnected. It's a Zyxel router and it's very, very reliable for me. The distance is around 8 meters in an apartment, one brick wall but no door so it should really be fine. There are some networks around, I have changed the channel and now it's a bit better, but I suspect the underlying problem might be that my router is 802.11g while the WN100 is a draft N device. I may try adding a draft N access point next to my router, and connect the PCH alone on it. By the way... Here is the last generation of my script: net_watchdog_v3.sh It is intended mainly for use with Transmission. And for Droggie who asked for a newer version :-) Code: begin 666 net_watchdog_v3.sh.gz- Login to your PCH and type: uudecode temp.txt - Now type: gunzip net_watchdog_v3.sh.gz - Now type: chmod +x net_watchdog_v3.sh.gz - The script is now ready for use ! Explanation about this script: - First it will sleep for 5 minutes. So in case of problem, you have enough time to disable it. - Then it will check wireless connection every 20 seconds, by PING on your gateway. - If the PING fails 3 times in a row, it will stop Transmission, sync your data to disk, and reset the network connection in the PCH. - If 3 consecutive resets of the connection are not enough, and mono (the video player) is not running, it restarts the PCH. Have fun ! |
|||
|
07-24-2009, 11:47 PM
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
Interesting, keramidas. I don't have this kind of problem with my wireless setup, but for those who do I imagine this script is great.
Maybe it could include some more checks than just mono before rebooting (at row 34). amp_test is used of ISO/DVD structure playback which is quite common, and some people use mpd for music playback (a minority, though). Another suggestion is to add this script to the CSI, for easy maintenance and easy installation for the many users who may benefit from your work. Have a look at http://www.networkedmediatank.com/showth...?tid=13161 Thank's for sharing your work. Audio, video, disco - I hear, I see, I learn. Wiki. Wiki? Wiki! |
|||
|
09-11-2009, 07:30 AM
(This post was last modified: 09-11-2009 07:50 AM by DocDownUnder.)
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
Hi Keramidas
Thanks for your efforts, just one clarification do I install this as specified in post no11 or as specified in the first post? Thanks for your help!! [QUOTE='keramidas' pid='217010' dateline='1248469564'] Thanks for your answer. It's a good question... |
|||
|
09-11-2009, 08:42 AM
|
|||
|
|||
|
RE: Watchdog script to get rid of wireless (WiFi) disconnections
Hi,
Yes you should follow the instructions from post #11. First post is now obsolete. (09-11-2009 07:30 AM)DocDownUnder Wrote: Hi Keramidas |
|||
|
09-18-2009, 10:53 PM
|
|||
|
|||
| RE: Watchdog script to get rid of wireless (WiFi) disconnections | |||
|
« Next Oldest | Next Newest »
|

Twitter
Facebook
NMT Wiki
Search
Member List
Help
A-400 [13 May 2013]







![[+]](images/collapse_collapsed.gif)




