![]() ![]() |
Dec 20 2005, 12:05 AM
Post
#1
|
|
|
Group: Members Posts: 15 Joined: 7-June 05 Member No.: 7,282 |
Since I can't do without connection profiles for my wifi networking, I came up with a stopgap solution for use while waiting until Opie's Network app does the right thing. Perhaps other people will find it useful too. Here it is.
I'm running OZ3.5.4-RC1 on tosa, but this should work regardless of the platform. It uses opie-sh to provide the GUI, so if you haven't installed it (and why haven't you? It's an excellent tool to slap quickie GUIs onto your shell scripts), then do an "ipkg install opie-sh" before you start. Step One Create a file in /opt/QtPalmtop/bin named "wlanchooser.sh", and make it executable: touch /opt/QtPalmtop/bin/wlanchooser.sh chmod +x /opt/QtPalmtop/bin/wlanchooser.sh Edit the file and paste in this script: CODE #!/bin/sh OPIE_SH=$OPIEDIR/bin/opie-sh OURNAME="WLAN Chooser" NETDIR="/etc/network" DBASEDIR="${NETDIR}/wlanlib" # ---- Code begins WLANLIST=`ls -1 $DBASEDIR` wlanstat=`ifconfig wlan0 2> /dev/null` if [ "x$wlanstat" = "x" ]; then command=`echo "$WLANLIST" | $OPIE_SH -g -i -t "Activate which profile?" -l 2>/dev/null` if [ "x$command" != "x" ]; then cp $DBASEDIR/$command $NETDIR/interfaces ifup wlan0 | $OPIE_SH -t "${OURNAME} Results" -f fi else $OPIE_SH -m -t "$OURNAME" -M "Shall I disconnect the WLAN?" -g command=$? if [ "$command" = "0" ]; then ifdown wlan0 fi fi rm -f /tmp/qcop-msg-wlanchooser.sh Step Two Create a file in /opt/QtPalmtop/apps/Opie-SH/ named "wlanchooser.desktop": touch /opt/QtPalmtop/apps/Opie-SH/wlanchooser.desktop Edit the file and paste this in: CODE [Desktop Entry] Exec=wlanchooser.sh Icon=opie-sh/opie-sh Type=Application Name=WLAN Chooser Comment=Choose between wlan configurations Step Three Make a new subdirectory: mkdir /etc/network/wlanlib Step Four Copy your existing interface script to the directory, with a new name, such as: cp /etc/network/interfaces /etc/network/wlanlib/Roaming That's about it. When you run the chooser, you'll get a list of all the files in /etc/network/wlanlib/ and when you pick one, it will get copied over the top of /etc/network/interfaces. So, create a whole new interfaces file for each different "profile" you want, and save it to /etc/network/wlanlib/ with some descriptive name. If you run the Chooser when your wlan0 interface is active, you'll get a confirmation box. Confirm and the wlan0 interface will be brought down. (Cancel by tapping on the little 'x'. I really should add a proper button, I guess.) It's crude, but it works well enough for me. I have three files in wlanlib, named "Roaming", "Home", and "Office". |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 21st May 2013 - 07:05 AM |