thanks again brisbin33
]]>I'm not sure if this is specific to your setup or if iwlist has changed its output for reals, if others (and me whenever i get back to my netbook) have issues, i'll update the script itself.
in any event, it seems using this as PARSER would get you working:
PARSER='
BEGIN { FS=":"; OFS="="; }
/\<Cell/ { if (essid) print essid, security, quality[1]/quality[2]*100; security="none" }
/\<ESSID:/ { essid=substr($2, 2, length($2) - 2) } # discard quotes
/\<Quality:/ { split($2, quality, "[/\ ]") }
/\<Encryption key:on/ { security="wep" }
/\<IE:.*WPA.*/ { security="wpa" }
END { if (essid) print essid, security, quality[1]/quality[2]*100 }
'
let me know if it works.
]]>lowie ~ $ iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 00:1D:60:19:CA:00
Protocol:802.11b/g
ESSID:"lowie82ph"
Mode:Managed
Channel:11
Quality:73/100 Signal level:-61 dBm Noise level:-83 dBm
Encryption key:on
Bit Rates:54 Mb/s
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
Cell 02 - Address: 00:1F:F3:C4:B5:39
Protocol:802.11b/g/n
ESSID:"vixienne "
Mode:Managed
Channel:1
Quality:7/100 Signal level:-87 dBm Noise level:-83 dBm
Encryption key:on
Bit Rates:18 Mb/s
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : CCMP TKIP
Authentication Suites (1) : PSK
Cell 03 - Address: 00:11:24:02:5B:27
Protocol:802.11b/g
ESSID:"alanet"
Mode:Managed
Channel:6
Quality:7/100 Signal level:-87 dBm Noise level:-83 dBm
Encryption key:off
Bit Rates:11 Mb/s
thanks
]]>/edit: if you could give me the output of iwlist wlan0 scan that'd help too.
]]>I followed the instructions in the first post but when I try to use it in the openbox menu, it always return 'no networks found'.
So then I tried executing the script on the terminal and this is the result:
lowie ~ $ sudo ~/.config/openbox/wifi-pipe wlan0
awk: cmd. line:3: (FILENAME=- FNR=14) fatal: division by zero attempted
<openbox_pipe_menu>
<item label="no networks found." />
</openbox_pipe_menu>
having an issue connecting to networks that have a space in the essid, how would you fix? my home network has no spaces but they do at the workplace
hmmm... i thought the part that i took from wifi-select already dealt with that; i'll definitely look into this, but probably not until after the holidays.
next time you come up on a network with a space in the essid, do me a favor:
make sure no profile currently exists...
try to connect (i'm assuming it'll fail)...
post here the profile that should've been dynamically created for it.
if there's a line like ESSID="The Essid with Spaces", then the problems not with me but with netcfg.
otherwise, it'll point us towards a fix.
thanks,
pat
set up a profile in /etc/network.d with the proper ESSID and it will (or should) be used when you connect. is this not the case?
i do the same thing, my at-home LAN shows up, i click it, the script checks for the existence of /etc/network.d/whatever with a matching ESSID entry and uses it, static IP and all.
only the created-on-the-fly profiles will get dhcp because it makes more sense than having some 'default' static ip setup.
EDIT: here is the code so you can see:
connect() {
# check for an existing profile
PROFILE_FILE="$(grep -REl "ESSID=[\"']?$ESSID[\"']?" "$PROFILE_DIR" | grep -v '~$' | head -n1)"
# if found use it, else create a new profile
if [ -n "$PROFILE_FILE" ]; then
PROFILE=$(basename "$PROFILE_FILE")
...
so you can see, if you have something in your $PROFILE_DIR that matches the $ESSID you're connecting to, it will use that setup.
]]>CONNECTION="wireless"
ESSID="router"
INTERFACE="wlan0"
DESCRIPTION="router"
SCAN="yes"
TIMEOUT="10"
SECURITY="wpa"
KEY="arch"
IP="static"
ADDR="192.168.0.189"
Am I missing something?
]]>@stefanwilkens: here's some output from my machine for comparison:
//susan/0/~ sudo iwlist $INTERFACE scan 2>/dev/null | grep Quality
Password:
Quality=33/70 Signal level=-77 dBm
Quality=16/70 Signal level=-94 dBm
Quality=22/70 Signal level=-88 dBm
Quality=7/70 Signal level=-103 dBm
Quality=22/70 Signal level=-88 dBm
Quality=14/70 Signal level=-96 dBm
//susan/0/~ sudo iwlist $INTERFACE scan 2>/dev/null | awk -f /usr/lib/network/parse-iwlist.awk | sort -t= -nrk3
atkins1=wpa=33
kalyn=wpa=19
Buffalo=wpa=19
tres=wep=18
BMD9=wpa=18
JShadrach=wpa=10
belkin54g=wep=10
sashankerismell=wep=9
NETGEAR=none=6
you can see the name=security=signal_strength is found, parsed, and printed no problem here. can you check the contents of /usr/lib/network/parse-iwlist.awk?
//susan/0/~ cat /usr/lib/network/parse-iwlist.awk
BEGIN { FS=":"; OFS="="; }
/\<Cell/ { if (essid) print essid, security, quality[2]; security="none" }
/\<ESSID:/ { essid=substr($2, 2, length($2) - 2) } # discard quotes
/\<Quality=/ { split($1, quality, "[=/]") }
/\<Encryption key:on/ { security="wep" }
/\<IE:.*WPA.*/ { security="wpa" }
END { if (essid) print essid, security, quality[2] }
probably a lie to call it percent as it simply prints the number between 'Quality=' and '/' rather than actually doing the math. maybe i'll fix that some time...
EDIT: i updated the OP with a new version. please try that one out.
EDIT2: AHA! stefan, you're not getting the percent b/c my iwlistscan shows Quality=N/M and yours is printing Quality:N/M. odd. you can either find out why that is and fix it or simply adjust PARSER in the new version of the script to this:
PARSER='
BEGIN { FS=":"; OFS="="; }
/\<Cell/ { if (essid) print essid, security, quality[2]/quality[3]*100; security="none" }
/\<ESSID:/ { essid=substr($2, 2, length($2) - 2) } # discard quotes
/\<Quality:/ { split($1, quality, "[:/]") }
/\<Encryption key:on/ { security="wep" }
/\<IE:.*WPA.*/ { security="wpa" }
END { if (essid) print essid, security, quality[2]/quality[3]*100 }
'
now it'll parse for Quality: rather than Quality=
]]>#pwd && ls -l && cat menu.xml | grep wifi-pipe
/home/stefan/.config/openbox
total 44
-rw-r--r-- 1 stefan stefan 1474 2009-10-24 12:46 autostart.sh
-rw-r--r-- 1 stefan stefan 9830 2009-10-24 11:09 menu.xml
-rw-r--r-- 1 stefan stefan 22964 2009-10-24 11:41 rc.xml
-rwxr-xr-x 1 stefan stefan 3524 2009-10-24 11:10 wifi-pipe
<menu id="pipe-wifi" label="Wifi" execute="sudo /home/stefan/.config/openbox/wifi-pipe eth0" />
Have a look at the wpa_supplicant_scan_info function in the netcfg git code. There is an example of it's use in the function before, "list_networks". wpa_supplicant should prove much more reliable than iwlist, and you get better, easier to parse output from it. Dealing with networks with unusual names should be easier. By default it's sorted by signal strength which is nice.
]]>try putting the wifi entry towards the bottom of your root menu, then don't mouse over it when you open the menu and see if the delay still exists.
if the wifi entry is first in the menu, right click puts your mouse right on it to begin with and a wait-for-scan is probably unavoidable.
]]>