# NDIS Issues



## blstuart (Oct 9, 2009)

So, I'm trying to get my Broadcom 4322 802.11 adapter working with ndisgen on 8.0-RC1.  It seems to be working up to the point where I can set the SSID and encryption key.  I can even scan for access points (at least temporarily).  The problem is that the ndis0 device is associated, but the wlan0 one reports no carrier, so dhclient reports the link is down.  I've seen reference to pretty much these symptoms, but I haven't found a resolution.  Is this a real bug or is there something I'm doing wrong?  For reference the commands I'm using look like this.  And if I don't include the chanlist command, it stays stuck on channel 1 and fails to scan.

```
sudo kldload bcmwl5_sys
sudo ifconfig wlan0 create wlandev ndis0
sudo ifconfig wlan0 ssid fubar up
sudo ifconfig wlan0 chanlist 11
sudo ifconfig wlan0 scan
sudo ifconfig wlan0 deftxkey 0x0102030405060708090a0b0c0d
sudo dhclient wlan0
```


----------



## richardpl (Oct 9, 2009)

Try with 'list scan' instead of 'scan'.
Are you shure that radio is turned on? (there should be external switch ....)


----------



## blstuart (Oct 9, 2009)

On this machine, there isn't an external switch.  And the weird part is that I am able to scan for a little while after forcing it to one channel.  This is despite wlan0 reporting no carrier, and furthermore the scan results aren't limited to channel 11.  So at least the receiver is on.  Assuming they are passive scans, then we don't know anything about the transmitter.  Then after some time.  I haven't really measured, but it's definitely in the range of minutes, any further scans hang.  Bringing the interface down and back up doesn't help, though as I'd expect, ndis0 no longer shows associated when I bring it down, but does again when I bring it up.  Basically ndis0 behaves as I would expect, but I can't directly set its ssid.  wlan0 is in the weird semi-working state.


----------



## richardpl (Oct 9, 2009)

Do as root `# sysctl debug.ndis=1`
and look in console kernel output.

Any configuration via ifconfig for ieee80211 should be done on wlanX (X = 0 in your case). ndisulator doesnt have passive scanning implemeneted, and changing channel and expecting that only APs from that channel will show up can not be expected - this is NDIS API limitation.


----------



## blstuart (Oct 10, 2009)

Well, if it doesn't have passive scanning implemented, the transmitter is also powered up at least for a while.  I tried turning on the debugging and at least to my eyes it looked ok.  Here's what I got:


```
ndis0: <Broadcom 4322AG 802.11a/b/g/draft-n Wi-Fi Adapter> mem 0xd8500000-0xd8503fff irq 18 at device 0.0 on pci2
ndis0: [ITHREAD]
ndis0: NDIS API version: 5.1
wlan0: Ethernet address: 00:26:82:09:d8:f9
Setting BSSID to xx:xx:xx:xx:xx:xx
ndis_newstate: INIT -> SCAN
ndis_newstate: SCAN -> SCAN
ndis_scan_results: 5 results
scan: bssid xx:xx:xx:xx:xx:xx chan 2437MHz (6/1152) rssi 18
scan: bssid xx:xx:xx:xx:xx:xx chan 2437MHz (6/1152) rssi 21
scan: bssid xx:xx:xx:xx:xx:xx chan 2437MHz (6/1152) rssi 23
scan: bssid xx:xx:xx:xx:xx:xx chan 2462MHz (11/1152) rssi 60
scan: bssid xx:xx:xx:xx:xx:xx chan 2462MHz (11/1152) rssi 17
```

Also I did a little more digging and found that supposedly there is a switch for the radio.  The panel where the indicator light is is supposed to be touch sensitive, and you're supposed to be able to turn the radio on and off that way.  Touching it doesn't seem to have any effect on the behavior.  (I suspect it's handled through ACPI and is really software controlled, but I'm not sure.)


----------



## richardpl (Oct 10, 2009)

Now, what is displayed when you set ssid and key? Does AP show up in scan results?

Do not use 'scan' directly because it will cancel current association.


----------



## richardpl (Oct 10, 2009)

blstuart said:
			
		

> Well, if it doesn't have passive scanning implemented, the transmitter is also powered up at least for a while.



To make things little more clear:

Passive scanning and changing channels(..) can not be (by design) controlled via NDIS, that is job for miniport driver ....


----------



## blstuart (Oct 11, 2009)

When I set the ssid, it prints:
Setting BSSID to 00:26:82:09:d8:f9
When I set the WEP key, it doesn't print anything out.  I don't know if it makes any difference, but I've got the wep support compiled into the kernel, rather than being loaded with kldload.  Is that a problem?  In answer to the question about the ap, yes, my AP does show up in the list.


----------



## blstuart (Oct 12, 2009)

I think I've got it.  The problem seemed to have been the way I was setting the wep key.  If I use the nwkey shortcut, rather than just setting dfltxkey it works.  In fact I'm typing this using it right now.


----------

