Bug 123765 - Scanning isn't consistant with `sudo iwlist eth1 scanning`, even when launched as root.
Summary: Scanning isn't consistant with `sudo iwlist eth1 scanning`, even when launche...
Status: RESOLVED FIXED
Alias: None
Product: kwifimanager
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Stefan Winter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-17 03:15 UTC by Arthur B.
Modified: 2006-08-06 14:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
proposed patch for all issues (2.19 KB, patch)
2006-03-26 13:47 UTC, Stefan Winter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur B. 2006-03-17 03:15:28 UTC
Version:           3.5.1 (using KDE 3.5.1, Kubuntu Package 4:3.5.1-0ubuntu11 dapper)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-18-386

I launch kwifimanager using
kdesu kwifimanager
It works, if I manually set my configuration I can connect everything etc, so it does detect the card.

If I click on Scan, I see a total of 2 access points
If I run in console
sudo iwclist eth1 scanning
I see 5 access points
( the first two are displayed by kwifimanager but no more)

My network card is:
0000:02:03.0 Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)
(from a Dell Latitude X1)

Expected behavior:
A full list of access points relevant with iwconfig.


Sidenote:
Looks like Kwifimanager tries to do the work itself, that's weird, why not rely on the command line tool and provide a simple gui rather than redo the work...
Comment 1 Stefan Winter 2006-03-17 06:31:01 UTC
Hi,

are you *really* *positively* *sure* that you are using 3.5.1? Exactly this 
behaviour was fixed a few days before the KDE 3.5.1 release, see the big 
change mentioned in

http://websvn.kde.org/tags/KDE/3.5.1/kdenetwork/wifi/interface_wireless_wirelessextensions.cpp?rev=500400&view=log

Maybe your distro used a snapshot of 3.5.1 short before this fix was 
introduced and falsely identifies itself as "the real thing"? You know, I 
explicitly changed scanning to use the command-line so what you describe here 
just doesn't seem to fit the version you are referring to.

To be absolutely sure, I would have to recommend compiling kdenetwork/wifi and 
see if that makes a difference.

Greetings,

Stefan Winter
Comment 2 Arthur B. 2006-03-19 22:55:47 UTC
I am using the latest package from ubuntu dapper, you can take a look at source package on their repository and diff it with your source to see if there's any difference.. pool/main/k/kdenetwork/kwifimanager_3.5.1-0ubuntu2_i386.deb

N.B I also have another bug, sometimes it displays the ssid I'm connected on, sometimes not, and when it's displayed, it says WEP is 'on' although it's not.
Comment 3 Stefan Winter 2006-03-20 18:06:17 UTC
Please don't expect other people to have in-depth knowledge about your distribution's packaging. At least a full URL would have been nice.
According to their sources, it's the final 3.5.1 with a few patches. None of those patches changes the scanning behaviour.
I'm tempted to think that you are wrong about "doing the stuff itself". If you are using the Ubuntu version, you have the new iwlist-parsing behaviour.
To verify, please start kwifimanager from the command-line and send me the debug output.
Also, are you aware that iwconfig output itself differs from time to time, even when you are not moving? So, do you *consistently* get fewer networks in the GUI than in the command-line or is that just occasionally?
For the other bug you mentioned: also WPA and WPA2 encrypted networks are treated like WEP (this requires an update, I know). For the sometimes-ssid-sometimes-not: I haven't ever heard of that before. Is your network connection working reliably, i.e. could it be that you are close to the edge of coverage and you might really drop out at times?
Comment 4 Arthur B. 2006-03-21 06:24:51 UTC
Sorry about failing to link you directly to the proper source package.
Here is some debug output, I did a few scans:
arthurb@coin:~$ kdesu kwifimanager
kbuildsycoca running...
QGVector::remove: Index 542708012 out of range
QGVector::insert: Index 542708012 out of range
QGVector::remove: Index 542708013 out of range
QGVector::insert: Index 542708013 out of range
QGVector::remove: Index 542708015 out of range
QGVector::insert: Index 542708015 out of range
QGVector::remove: Index 542708016 out of range
QGVector::insert: Index 542708016 out of range
QGVector::remove: Index 542708017 out of range
QGVector::insert: Index 542708017 out of range
QGVector::remove: Index 542708019 out of range
QGVector::insert: Index 542708019 out of range
QGVector::remove: Index -2139062147 out of range
QGVector::insert: Index -2139062147 out of range
QGVector::remove: Index -2139062145 out of range
QGVector::insert: Index -2139062145 out of range
QGVector::remove: Index -2139062144 out of range
QGVector::insert: Index -2139062144 out of range
QGVector::remove: Index -2139062143 out of range
QGVector::insert: Index -2139062143 out of range
QGVector::remove: Index -2139062141 out of range
QGVector::insert: Index -2139062141 out of range
QGVector::remove: Index -2139062140 out of range
QGVector::insert: Index -2139062140 out of range
QGVector::remove: Index -2139062139 out of range
QGVector::insert: Index -2139062139 out of range
etc etc

The problems I am experiencing are very consistants. Although the connexion is somewhat jumpy, there are always many many wifi networks available through iwlist and something like 2 or 3 appearing in kwifimanager. (at the moment, 6 from command line, two in kwifi's popup)
When the network I am connected  on appears, it is stated has having wep on, this is not true. ( iwlist says Encryption key: off )
Comment 5 Arthur B. 2006-03-21 06:29:26 UTC
/!\ Could this be a display bug... I just noticed that the number of rows in the scan window varies, and it always has empty rows. It is supposed to have empty rows ? I also forgot to mention that the quality column is always empty.

Clicking many times on Scan pops up different windows with 3 networks on each, not the same... the union of all theses give me approximately the same list as iwlist. I am really suspecting a display bug.
Comment 6 Arthur B. 2006-03-23 05:49:28 UTC
Hi,
I recompiled from source and got some better debug output. It looks like iwlist gives the good result but somehow they fail to be displayed correctly...

--begin debug output--
arthurb@coin:~$ kdesu kwifimanager
kwifimanager: No Asus WLAN LED found, disabling LED updates
kwifimanager: Autodetecting...
kwifimanager: [ lo ]
kwifimanager: [ eth0 ]
kwifimanager: [ eth1 ]
kwifimanager: activating wireless device eth1
kwifimanager: [ sit0 ]
kwifimanager: Log file is /root/share/apps/kwifimanager/kwifimanager.log
kwifimanager: iwlist: eth1      Scan completed :
kwifimanager: iwlist:           Cell 01 - Address: 00:11:24:05:4C:17
kwifimanager: iwlist:                     ESSID:"Apple Network 054c17"
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
k
wifimanager: iwlist:                     Mode:Master
kwifimanager: iwlist:                     Channel:1
kwifimanager: iwlist:                     Encryption key:on
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:
            Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=51/100  Signal level=-70 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 186ms ago
kwifimanager: iwlist:           Cel
l 02 - Address: 00:11:24:5F:B4:F7
kwifimanager: iwlist:                     ESSID:"AirDude Network"
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
kwifimanager: iwlist:
      Channel:1
kwifimanager: iwlist:                     Encryption key:on
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:
                    Quality=33/100  Signal level=-80 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 242ms ago
kwifimanager: iwlist:           Cell 03 - Address: 00:13:10:3D:EA:10
kwifimanager: iwlist:                     ESSID:"Oscar"

QGVector::remove: Index -573338500 out of range
QGVector::insert: Index -573338500 out of range
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -573338499 out
of range
QGVector::insert: Index -573338499 out of range
kwifimanager: iwlist:                     Channel:6
kwifimanager: iwlist:                     Encryption key:off
QGVector::remove: Index -573338497 out of range
QGVector::insert: Index -573338497 ou
t of range
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=64/100  Signal level=-62 dBm
kwifim
anager: iwlist:                     Extra: Last beacon: 56ms ago
kwifimanager: iwlist:           Cell 04 - Address: 00:00:94:D3:91:29
kwifimanager: iwlist:                     ESSID:"Village"
QGVector::remove: Index -573338496 out of range
QGVector::inser
t: Index -573338496 out of range
kwifimanager: iwlist:                     Protocol:IEEE 802.11b
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -573338495 out of range
QGVector::insert: Index -573338495 out of range
kwifiman
ager: iwlist:                     Channel:7
kwifimanager: iwlist:                     Encryption key:off
QGVector::remove: Index -573338493 out of range
QGVector::insert: Index -573338493 out of range
kwifimanager: iwlist:                     Bit Rates:11
 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 11
kwifimanager: iwlist:                     Quality=48/100  Signal level=-72 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 11ms ago
kwifimanager: iwlist:
          Cell 05 - Address: 00:14:BF:29:08:0B
kwifimanager: iwlist:                     ESSID:"Team Spain"
QGVector::remove: Index -573338492 out of range
QGVector::insert: Index -573338492 out of range
kwifimanager: iwlist:                     Protocol:
IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -573338491 out of range
QGVector::insert: Index -573338491 out of range
kwifimanager: iwlist:                     Channel:6
kwifimanager: iwlist:
   Encryption key:on
QGVector::remove: Index -573338489 out of range
QGVector::insert: Index -573338489 out of range
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11
12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=29/100  Signal level=-82 dBm
kwifimanager: iwlist:                     Extra:wpa_ie=dd180050f20101000050f20201000050f20201000050f2020000
kwifimanager: iwlist:                     Extra
: Last beacon: 88ms ago
kwifimanager: iwlist:           Cell 06 - Address: 00:14:BF:0B:C6:CF
kwifimanager: iwlist:                     ESSID:"Alliance"
QGVector::remove: Index -573338496 out of range
QGVector::insert: Index -573338496 out of range
kwifima
nager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -573338495 out of range
QGVector::insert: Index -573338495 out of range
kwifimanager: iwlist:                     Chann
el:6
kwifimanager: iwlist:                     Encryption key:on
QGVector::remove: Index -573338493 out of range
QGVector::insert: Index -573338493 out of range
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:
        Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=35/100  Signal level=-79 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 93ms ago
kwifimanager: iwlist:
--end debug output--

this is just running the program and clicking on scan... here is what is displayed: http://tinyurl.com/fr5yk ( only the first two... that is right before the first Index out of range error )

Comment 7 Stefan Winter 2006-03-23 06:42:38 UTC
Thanks, that helped a lot! I'm on it...
Comment 8 Arthur B. 2006-03-23 06:43:14 UTC
I recompiled with -g and did some debugging... looks like during a single call to iwlist, parseScanData is interrupted (don't know why) and restarted again, therefor countcell is 0 and it tries to access networks[-1] hence the Index -57.... out of range...
To tired to find out what's going on exactly... is it killed after a period of time, does it read a line too fast from the process and ends up with an empty line, assumes it's over and returns... but then why is it called again?
Comment 9 Stefan Winter 2006-03-23 20:26:51 UTC
Well, I think there is something wrong on your box. Thanks for that really valuable info! Now that you tell me there are some strange interrupts, lines of the sort of

kwifimanager: iwlist:                     Extra: Last beacon: 186ms ago 
kwifimanager: iwlist:           Cel 
 l 02 - Address: 00:11:24:5F:B4:F7 
kwifimanager: iwlist:                     ESSID:"AirDude Network" 
 
make me think so. The debug output grabs things line by line. So, the "Cel...l 02" line is broken in two, but by something different than a \n. That's not good, but I have no idea where it comes from. This is not supposed to happen, and it happens more than once during the scan. Of course this confuses the counter. This is something well below KWiFiManager, I think.

I assume that the lines are not broken in parts when you issue the iwlist command from a shell? Then something in Qt or KDE would be mangling things... and I would have to ask the kde-devel mailing list then, this is beyond my knowledge.

I'll also try something else. I'll set up a few test SSIDs at my workplace so that I also have a big list to show. Maybe I can reproduce it then.
Comment 10 Stefan Winter 2006-03-23 20:31:58 UTC
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg 
 k 
 wifimanager: iwlist:                     Mode:Master 

Dude, it even breaks lines in the middle of the word kwifimanager? That's deep in a call of kdDebug()... about time to ask kde-devel if someone knows what's going on there.
Comment 11 Arthur B. 2006-03-23 20:38:48 UTC
Hum I woulnd't rely on that explanation.... look I have the same things on some lines even within debug code
k
wifimanager
see....
I think my console must have been sloppy at this time. 

Look at my debug info from gdb (message #8)... a simple line break would mess things up but not that much... here the parseScanData is called multiple times during the life of the iwlist process ( so cellcount is lost ). I don't even know how that can happen but I would suspect a bug involving the use of the connect function from arts
(b.t.w I don't really get that part... why arts? isn't it just a sound server?)

Oh and here's another bug for you:

 if ( data.contains ( "Encryption key:" ) )
        {
          if ( data.contains ( "on" ) )

If data.contains("Encryption key:") then it always contains "on" doesn't it ?
encryptiON. That's why the non protected networks appear protected no?
The parseScanData function is a bit sloppy honestly... what if the ssid name is "Cellular" (not a crazy supposition)... it will break the app. the iwlist output  has more structure than that so it should be easy to parse it more cleanly with regexps.
Comment 12 Stefan Winter 2006-03-23 22:05:00 UTC
Hi,

> Look at my debug info from gdb (message #8)... a simple line break would
> mess things up but not that much... here the parseScanData is called
> multiple times during the life of the iwlist process ( so cellcount is lost
> ). I don't even know how that can happen but I would suspect a bug
> involving the use of the connect function from arts (b.t.w I don't really
> get that part... why arts? isn't it just a sound server?)


arts? Sorry, you're on the wrong track there. This is Qt's default connect() 
function. Connects a SIGNAL (event happened) with a SLOT (that reacts to the 
event).
In this case, when the KProcess for iwlist signals "there's data to read", 
parseScanData reads it. This will happen only once because the KProcess is 
called with the Block option, i.e. the start() returns only after iwlist is 
finished. That makes all the data that was collected available in *one* 
parseScanData go.
That parseScanData gets called more than once would mean that the data arrives 
in multiple chunks, which in turn would mean KProcess::Block isn't as 
blocking as it should...? Hardly thinkable.

> Oh and here's another bug for you:
>
>  if ( data.contains ( "Encryption key:" ) )
>         {
>           if ( data.contains ( "on" ) )
>
> If data.contains("Encryption key:") then it always contains "on" doesn't it
> ? encryptiON. That's why the non protected networks appear protected no?


Well... damn. That was a head-shot :-) I'll take care of that. I don't have 
any non-encrypted networks in my vicinity, that's why I didn't spot that.

> The parseScanData function is a bit sloppy honestly... what if the ssid
> name is "Cellular" (not a crazy supposition)... it will break the app. the
> iwlist output  has more structure than that so it should be easy to parse
> it more cleanly with regexps.


And this one as well. Thinking of it, in principle SSIDs are just 32 bytes. 
Not necessarily printable ones. What if someone is crazy enough to put line 
breaks into his SSID? Or a nice 0x00? Might be quite a mess.

Stefan
Comment 13 Arthur B. 2006-03-23 22:34:39 UTC
relax:
http://en.wikipedia.org/wiki/SSID 
The code consists of a maximum of 32 alphanumeric characters
                                     ------------
they are not *that* mean
Comment 14 Arthur B. 2006-03-23 22:41:41 UTC
Hum no you're actually right according to 802.11 it's 1-32 octet (byte)
I'm not even sure iw* handles it.
For the connect I was mislead by the arts include.. arts/connect.h ??
I'll add a kdebug call in front of parsedata to see what's going on.
Comment 15 Arthur B. 2006-03-23 22:57:23 UTC
Nope, iwlist doesn't handle it, plain printf %s...
not even sure iwlib does in fact... 
I think it's safe to assume no \13 \10 or \00
but "Cellular" is realistic...
According to iwlist.c it seems that it can also output an "ESSID index", not sure what it is though
if(event->u.essid.flags)
	  {
	    /* Does it have an ESSID index ? */
	    if((event->u.essid.flags & IW_ENCODE_INDEX) > 1)
	      printf("                    ESSID:\"%s\" [%d]\n", essid,
		     (event->u.essid.flags & IW_ENCODE_INDEX));
	    else
	      printf("                    ESSID:\"%s\"\n", essid);
	  }
	else
	  printf("                    ESSID:off/any\n");
Comment 16 Arthur B. 2006-03-24 04:23:47 UTC
I added the  following line in the file  interface_wireless_wirelessextensions.cpp

  int cellcount;
  kdDebug() << __LINE__ << "- going into parseScanData, just so you know..." << endl;
  while ( iwlist->readln ( data, true ) >= 0 )

I ran kwifimanager, and clicked on the "scan" button, here is the log... (no more line returns, I just messed up my copy paste last time)

arthurb@coin:/root/kdenetwork-3.5.1/wifi$ sudo kwifimanager
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kdeinit: Can't connect to the X Server.
kdeinit: Might not terminate at end of session.
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

kded: cannot connect to X server :0
DCOP aborting call from 'anonymous-26259' to 'kded'
kded: ERROR: Communication problem with kded, it probably crashed.
kwifimanager: No Asus WLAN LED found, disabling LED updates
kwifimanager: Autodetecting...
kwifimanager: [ lo ]
kwifimanager: [ eth0 ]
kwifimanager: [ eth1 ]
kwifimanager: activating wireless device eth1
kwifimanager: [ sit0 ]
kwifimanager: Log file is /root/share/apps/kwifimanager/kwifimanager.log
kwifimanager: 547- going into parseScanData, just so you know...
kwifimanager: iwlist: eth1      Scan completed :
kwifimanager: iwlist:           Cell 01 - Address: 00:11:24:05:4C:17
kwifimanager: iwlist:                     ESSID:"Apple Network 054c17"
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
kwifimanager: iwlist:                     Channel:1
kwifimanager: iwlist:                     Encryption key:on
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=53/100  Signal level=-69 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 225ms ago
kwifimanager: iwlist:           Cell 02 - Address: 00:11:24:5F:B4:F7
kwifimanager: iwlist:                     ESSID:"AirDude Network"
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
kwifimanager: iwlist:                     Channel:1
kwifimanager: iwlist:                     Encryption key:on
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=42/100  Signal level=-75 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 241ms ago
kwifimanager: iwlist:           Cell 03 - Address: 00:13:10:3D:EA:10
kwifimanager: 547- going into parseScanData, just so you know...
kwifimanager: iwlist:                     ESSID:"Oscar"
QGVector::remove: Index -572191620 out of range
QGVector::insert: Index -572191620 out of range
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -572191619 out of range
QGVector::insert: Index -572191619 out of range
kwifimanager: iwlist:                     Channel:6
kwifimanager: iwlist:                     Encryption key:off
QGVector::remove: Index -572191617 out of range
QGVector::insert: Index -572191617 out of range
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=64/100  Signal level=-62 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 113ms ago
kwifimanager: iwlist:           Cell 04 - Address: 00:00:94:D3:91:29
kwifimanager: iwlist:                     ESSID:"Village"
QGVector::remove: Index -572191616 out of range
QGVector::insert: Index -572191616 out of range
kwifimanager: iwlist:                     Protocol:IEEE 802.11b
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -572191615 out of range
QGVector::insert: Index -572191615 out of range
kwifimanager: iwlist:                     Channel:7
kwifimanager: iwlist:                     Encryption key:off
QGVector::remove: Index -572191613 out of range
QGVector::insert: Index -572191613 out of range
kwifimanager: iwlist:                     Bit Rates:11 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 11
kwifimanager: iwlist:                     Quality=51/100  Signal level=-70 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 44ms ago
kwifimanager: iwlist:           Cell 05 - Address: 00:0E:9B:C1:9E:40
kwifimanager: iwlist:                     ESSID:"6293"
QGVector::remove: Index -572191612 out of range
QGVector::insert: Index -572191612 out of range
kwifimanager: iwlist:                     Protocol:IEEE 802.11bg
kwifimanager: iwlist:                     Mode:Master
QGVector::remove: Index -572191611 out of range
QGVector::insert: Index -572191611 out of range
kwifimanager: iwlist:                     Channel:6
kwifimanager: iwlist:                     Encryption key:on
QGVector::remove: Index -572191609 out of range
QGVector::insert: Index -572191609 out of range
kwifimanager: 547- going into parseScanData, just so you know...
kwifimanager: iwlist:                     Bit Rates:54 Mb/s
kwifimanager: iwlist:                     Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 24 36 48 54
kwifimanager: iwlist:                     Quality=39/100  Signal level=-77 dBm
kwifimanager: iwlist:                     Extra: Last beacon: 106ms ago
kwifimanager: iwlist:



Is it weird or what?
Comment 17 Arthur B. 2006-03-24 04:45:47 UTC
Update:
I did a dirty fix, it works...
I just comment out the "connect" thing ( b.t.w the readready must occur multiple times ) and
call parseScanData(iwlist)
in parseScanData
call iwlist->start(KProcess::Block)
I also test for "off" instead of "on"....
( dirty hack... but I think anyway connect is not very useful )
Comment 18 Arthur B. 2006-03-24 04:58:46 UTC
Also my iwconfig outputs 
Quality=
not Quality:
fixed that too in the code
......

I checked the doc about connect.... looks like readln() never blocks in any case... so you are getting called multiple times ( strange since you don't ackRead()... is autoAck==TRUE ? )... I think if you want to keep the connect approach (IMHO not necessary) maybe you could use the cell number output by iwlist and retain it as a static variable, that works.

As for quality: vs quality= I am curious... is this a change in iwlist behavior between my and your version or just a bug... 
maybe using the iwlib.h lib would add robustness.

Here's also a feature request :) kwifimanager doesn't need to be run as root, but for scanning... so scanning - like switching network etc should prompt for su rights so that kwifimanager can be run as an unpriviledged user.
Comment 19 Stefan Winter 2006-03-24 21:46:33 UTC
Thanks again! First, the connect was a relic of early attempts to solve this in a non-blocking way (having a GUI app block, aka. freeze, is considered evil). That didn't work as I wanted it, so I changed to blocking but the connect() didn't seem to hurt.
My fix would be a little different: first call KProcess->start(), afterwards invoke parseScanData(), kicking off the connect().
I'll send you a patch with that soon, that also incorporates the other parts.

For the quality thing: welcome to the driver inconsistency hell. My iwlist output for example is:

eth2      Scan completed :
          Cell 01 - Address: 00:0F:66:A7:28:31
                    ESSID:"somessid"
                    Mode:Master
                    Encryption key:on
                    Frequency:2.412 GHz (Channel 1)
                    Quality:222/0  Signal level:-63 dBm  Noise level:-29 dBm

Note that I have the colon. The reason is that the output wants to allow to distinguish between multiple cases, depending on what the driver sends back when queried:
a) a range between 0 and a max value (your case: 51 out of 100)
b) a value, where no max or min values are known (my case: 222 out of "0")
c) a value in dBm, which is a negative value (no example at hand)
So, we might even have the same version of wireless-tools - it would still differ. I would need to get results from a driver that reports dBm and find a parser expression that matches all before commiting anything.

For the root thing: why not. Sounds reasonable. Except that you either have to enter the root pw _every time_ you scan or check the box to store the password permanently - something that I personally abhor, at least for root pws.
Comment 20 Stefan Winter 2006-03-24 21:47:47 UTC
Oh, forget that about dBm - that's only valid for signal and noise of course.
Comment 21 Arthur B. 2006-03-24 22:13:23 UTC
yeah.... that or give suid to iwlist... can't really see the implications but this should be a totally passive tool right? That's one advantage of calling the iwlist process, that + keeping up with the latest version....
Otherwise, once again, using iwlib.h (and shamelessly ripping iwlist.c) would save loads of hazardous parsing. (but then the whole thing need to be root etc)
Comment 22 Stefan Winter 2006-03-26 13:46:53 UTC
Please try the attached patch (I can't compile it right now) If it works and solves the issues, I'll commit it to the 3.5 branch.
Comment 23 Stefan Winter 2006-03-26 13:47:42 UTC
Created attachment 15315 [details]
proposed patch for all issues
Comment 24 Arthur B. 2006-03-26 22:15:15 UTC
The second chunk of the patch fails on my source...

http://archive.ubuntu.com/ubuntu/pool/main/k/kdenetwork/

kdenetwork_3.5.1.orig.tar.gz                          27-Jan-2006 06:55  9.3M  
kdenetwork_3.5.1-0ubuntu3.diff.gz                     25-Mar-2006 15:07  241K  
kdenetwork_3.5.1-0ubuntu3.dsc                         25-Mar-2006 15:07  1.3K 
Comment 25 Stefan Winter 2006-04-08 16:50:42 UTC
I did that patch against the tip of 3_5_branch. Is the difference to 3.5.1 so big that you can't manage to get the new source in?
Comment 26 Stefan Winter 2006-07-02 11:19:31 UTC
Did you get anywhere with this?
Comment 27 Stefan Winter 2006-08-06 14:04:57 UTC
No answer :-( Okay, I think I'll commit this to the branch. It's worth fixing, and maybe someone else has the time to test it before 3.5.5.
Comment 28 Stefan Winter 2006-08-06 14:09:38 UTC
SVN commit 570311 by swinter:

testing would be appreciated
BUG:123765


 M  +15 -6     interface_wireless_wirelessextensions.cpp  


--- branches/KDE/3.5/kdenetwork/wifi/interface_wireless_wirelessextensions.cpp #570310:570311
@@ -533,14 +533,17 @@
 
     *iwlist << iwlist_bin << interface_name << "scanning";
 
-    connect ( iwlist, SIGNAL ( readReady ( KProcIO * ) ), this, SLOT ( parseScanData ( KProcIO * ) ) );
+//    connect ( iwlist, SIGNAL ( readReady ( KProcIO * ) ), this, SLOT ( parseScanData ( KProcIO * ) ) );
 	    
    if ( !iwlist->start ( KProcess::Block ) )
         KMessageBox::sorry ( 0, i18n ( "Unable to perform the scan. Please make sure the executable \"iwlist\" is in your $PATH." ),
 				i18n ( "Scanning not possible" ) );
 
-    // while (iwlist->isRunning()) sleep ( 1 );
+    // this should never happen. But there was a report about Block not being as blocking as it should, so let's be safe about it
+    while (iwlist->isRunning()) sleep ( 1 );
 
+    parseScanData ( iwlist );
+   
     for (int i = 0; i<4; i++ ) networks->adjustColumn(i);
 
     return networks;
@@ -598,17 +601,23 @@
         }
       if ( !ignoreRemainingBits && data.contains ( "Encryption key:" ) )
         {
-          if ( data.contains ( "on" ) )
+          if ( data.contains ( "off" ) )
+            networks->setText ( cellcount - 1, 3, QString ( "off" ) );
+          else
             networks->setText ( cellcount - 1, 3, QString ( "on" ) );
-          else
-            networks->setText ( cellcount - 1, 3, QString ( "off" ) );
         }
       if ( !ignoreRemainingBits && data.contains ( "Quality:" ) )
         {
           QString quality = data.mid ( data.find ( ":" ) + 1, data.find ( "/" ) - data.find ( ":" ) - 1 );
           networks->setText ( cellcount - 1, 2, quality );
         }
-
+      
+      if ( !ignoreRemainingBits && data.contains ( "Quality=" ) )
+        {
+          QString quality = data.mid ( data.find ( "=" ) + 1, data.find ( "/" ) - data.find ( "=" ) - 1 );
+          networks->setText ( cellcount - 1, 2, quality );
+        }
+      
       if ( !ignoreRemainingBits && data.contains ( "wpa_ie" ) )
 	{
 	  networks->setText ( cellcount - 1, 3, QString ( "WPA" ) );