Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : Network Control Scripts


synerr
01-06-2008, 05:13 PM
I put together some simple scripts to connect/disconnect to wireless networks.

This scripts use iLiad network profiles file to find your list of preferred networks. (/mnt/settings/registry/nwprofiles.xml) They will then scan for any of these networks. If they available, They it will use any WEP keys you provided the iLiad and try to connect. If they cannot connect to or find any of these networks, they will try to connect to any open network it can find.

Use is really simple. You just unzip the file and transfer it to your iLiad. Since they are .sh script files, you can run them from the iLiad interface just by "opening" them, so you don't have to run them from the shell.

There are two scripts:

start_network.sh
stop_network.sh


Once they run start_network.sh, you will see some new files:

preferred_networks.txt: the list of the networks it found listed in the iLiad
scanned_networks.txt: the list of networks it could find
open_networks.txt: any open (unsecured) networks it could find
last_connection_status.sh: the network it could connect to and your ip address, dns, and so forth.


If anyone has any comments, suggestion, etc; thanks! :)

Martijn
01-11-2008, 03:05 PM
Hi,

This looks very interesting. Being able to reliable bring up the wireless (and shut it down afterwards) in combination with the Feedbooks downloader would be great.

Unfortunately I ran into a problem: I couldn't bring my wireless connection up.

I think it is because I use WPA encryption. I tried replacing the line:
export COMMAND="$WLAN_SCRIPT start '$1' enc $2"
with:
export COMMAND="$WLAN_SCRIPT start '$1' wpa $2"
but that did not seem to be enough.

My wireless does come up when I manually use:
wireless.sh start MySSID wpa MyPassPhrase

Furthermore my passphrase is shown correctly in the prefered_networks.txt line. (Though that file also contains some empty lines and a line containing "-1").
And my network is shown in the scanned_networks.txt file.

However, when I run the start_network.sh script the last_connection_status.txt file shows:
Starting Network
=====================
No Network Found

I could dig into the script myself, but I figure you know it better.
(Also I haven't setup ssh yet, so testing would be a pain.)

Oh, I do have a feature request:
Opening a small txt file takes ridiculous amount of time, so could you put the network status (connected to .../disconnected) in the name of a file or in a manifest.xml for the last_connection_status.txt file ?
That way it is possible to see the status directly in the content listener.

Thanks.

dkm365
01-12-2008, 10:26 AM
Wouldn't WPA require more info, as there is more than just the WPA1 & WPA2 variable? I haven't looked at the script, but it would seem likely that more than one line would need altered to make the change from WEP to WPA. Also, if you have the broadcast SSID turned off on your router it may take multiple attempts to connect and an automated script may have difficulty with that. I know on my linux laptop on a network that is not broadcasting the SSID, I often have to manually attempt a connection once or twice when the automated script fails.

I'm interested to see whether you get it to work with WPA.

Martijn
01-13-2008, 05:54 AM
You might be right that there is more to it.
wireless.sh start MySSID wpa MyPassPhrase
Does start my wireless connection but not reliably it seems.

However, I found another set of scripts that suit my needs:
http://www.mobileread.com/forums/showthread.php?t=14718

Those scripts do not automatically connect to any available wireless network, but I'm fine with that (for now :)).