# ifconfig wlan0 scan does not show any results.



## bhargava (Mar 3, 2011)

Hi,

I just now did a fresh install of FreeBSD.

```
$ uname -a
FreeBSD mybox.hsd1.ca.comcast.net. 8.2-RELEASE [B]FreeBSD 8.2-RELEASE[/B] #0: Fri Feb 18 02:24:46 UTC 2011     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
```


```
$ pciconf -lv
...
 vendor     = 'Broadcom Corporation'
    device     = 'Broadcom Corporation Dell Wireless 1390 WLAN Mini-PCI Card (BCM4311)'
    class      = network
```

I installed the bwn firmware from the ports net/bwn-firmware-kmod.  

But when I try to scan for the available networks: 
	
	



```
ifconfig wlan0 up scan
```
 , but it just returns empty results. Does not show any available networks. I tried installing wpa_gui also but does not work. Below are the files and their contents that I think might be useful. Please let me know if any other information is needed. 

Here is the /etc/rc.conf file:

```
$ cat /etc/rc.conf 

# -- sysinstall generated deltas -- # Thu Mar  3 06:55:32 2011
# Created: Thu Mar  3 06:55:32 2011
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
hostname="mybox.hsd1.ca.comcast.net."
ifconfig_nfe0="DHCP"
inetd_enable="NO"
ipv6_enable="YES"
keymap="us.iso"
moused_enable="YES"
saver="fire"
hald_enable="YES"
dbus_enable="YES"
gdm_enable="YES"
wlans_bwn0="wlan0"
ifconfig_wlan0="WPA DHCP"
```

Here is the /boot/loader.conf file:

```
$ cat /boot/loader.conf 
nvidia_load="YES"
if_bwn_load="YES"
bwn_u4_ucode_load="YES"
wlan_scan_ap_load="YES"
wlan_scan_sta_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

Here is the /etc/wpa_supplicant.conf

```
$ cat /etc/wpa_supplicant.conf 
network={
	ssid="Espresso"
	psk="************"
}

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
```

How do I fix this and connect to a network?

Thank you.


----------



## wblock@ (Mar 3, 2011)

First, use
`# ifconfig wlan0 up list scan`

bwn(4) requires installing net/bwn-firmware-kmod and loading the firmware before use.  If you've already done that, please show the output of
`% ifconfig`

You may want to change the PSK, now that you've shown it to the world.


----------



## bhargava (Mar 3, 2011)

wblock said:
			
		

> First, use
> `# ifconfig wlan0 up list scan`
> 
> bwn(4) requires installing net/bwn-firmware-kmod and loading the firmware before use.  If you've already done that, please show the output of
> `% ifconfig`



I already installed it. Here is the output:

```
$ ifconfig 
fwe0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:24:1b:33:40:00
	ch 1 dma -1
fwip0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	lladdr 0.24.1b.0.95.33.40.0.a.2.ff.fe.0.0.0.0
nfe0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=82008<VLAN_MTU,WOL_MAGIC,LINKSTATE>
	ether 00:1b:24:74:c6:1c
	inet6 fe80::21b:24ff:fe74:c61c%nfe0 prefixlen 64 scopeid 0x3 
	inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
bwn0: flags=8803<UP,BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 00:1a:73:98:8c:94
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet 127.0.0.1 netmask 0xff000000 
	inet6 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
wlan0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 00:1a:73:98:8c:94
	inet6 fe80::21a:73ff:fe98:8c94%wlan0 prefixlen 64 scopeid 0x6 
	inet 208.68.139.38 netmask 0xffffff00 broadcast 208.68.139.255
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	status: no carrier
	ssid "" channel 1 (2412 MHz 11b)
	country US authmode WPA1+WPA2/802.11i privacy OFF txpower 30 bmiss 7
	scanvalid 60 bgscan bgscanintvl 300 bgscanidle 250 roam:rssi 7
	roam:rate 1 wme bintval 0
```



			
				wblock said:
			
		

> You may want to change the PSK, now that you've shown it to the world.


 I forgot to change this when I posted this. Thanks for letting me know. 

Thank you.


----------



## cheme (Mar 3, 2011)

Hello,

Try rearranging your /etc/wpa_supplicant.conf.  Change it to match mine and give it a try.  


```
[B]#cat /etc/wpa_supplicant.conf[/B]
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
        ssid="yourssid"
        psk="yourkey"
        }
```

Notice how the "Global Parameters" are before the "Network Block" and that there are no uncommented spaces between a line of the file.  Check out the wpa_supplicant.conf man page.  http://www.FreeBSD.org/cgi/man.cgi?query=wpa_supplicant.conf&sektion=5


----------



## wblock@ (Mar 4, 2011)

The wlan_* modules are included in the GENERIC kernel.  It's not necessary to load them unless you have a custom kernel without them.

Access point scanning does not use wpa_supplicant(8).  Does "list scan" show different results than just "scan"?

All I've ever used in wpa_supplicant.conf is a network block for each network with SSID and PSK (or a bit more for open networks).  But you only need that to connect to those networks, not scan for SSIDs.


----------



## bhargava (Mar 4, 2011)

cheme said:
			
		

> Hello,
> 
> Try rearranging your /etc/wpa_supplicant.conf.  Change it to match mine and give it a try.
> 
> ...



I tried everything it does not scan at all. 

I tried using the following command

```
[U]# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf[/U]
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
ioctl[SIOCS80211, op 103, len 128]: Device not configured
Failed to initiate AP scan.
[B][I][U]^CCTRL-EVENT-TERMINATING [/U][/I][/B]- signal 2 received
ioctl[SIOCS80211, op 26, arg 0x0]: Operation not supported
Failed to disable WPA in the driver.
ELOOP: remaining socket: sock=4 eloop_data=0x28406140 user_data=0x2840d040 handler=0x8069f90
```

It continues the output till use C-c. Anyone who see what the problem is? 

Thank you.


----------



## bhargava (Mar 4, 2011)

wblock said:
			
		

> The wlan_* modules are included in the GENERIC kernel.  It's not necessary to load them unless you have a custom kernel without them.
> 
> Access point scanning does not use wpa_supplicant(8).  Does "list scan" show different results than just "scan"?



no. The results do not change. I mean it shows no results at all.

```
mybox# ifconfig wlan0 list scan 
mybox# 

mybox# ifconfig wlan0 scan
mybox#
```

Thank you.


----------



## bhargava (Mar 4, 2011)

Hi,

I found this line in the dmesg output.

```
bwn_v4_ucode13: could not load firmware image, error 2
....
bwn0: the fw file(bwn_v4_ucode13) not found
bwn-open_v4_ucode13: could not load firmware image, error 2
bwn0: the fw file(bwn-open_v4_ucode13) not found
```

here is my kldstat:

```
# kldstat 
Id Refs Address    Size     Name
 1   18 0xc0400000 bd97b4   kernel
 2    1 0xc0fda000 37228    if_bwn.ko
 3    2 0xc1012000 a1bc     siba_bwn.ko
 4    1 0xc101d000 a4c3e0   nvidia.ko
 5    2 0xc1a6a000 2d998    linux.ko
```


I have added bwn_u4_ucode in /boot/loader.conf

```
cat /boot/loader.conf 
nvidia_load="YES"
if_bwn_load="YES"
[B][I][U]bwn_u4_ucode_load="YES"[/U][/I][/B]
wlan_scan_ap_load="YES"
wlan_scan_sta_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

But i guess it is looking for file/module named bwn-open_v4_ucode*13*

but in the /boot/modules I have:

```
# ls /boot/modules/
bwn_v4_lp_ucode.ko	cuse4bsd.ko		nvidia.ko
bwn_v4_ucode.ko		linker.hints
```
No bwn-open_v4_ucode*13*. I think this is the source of the problem (right ?). How do I fix this (if this is the problem). any suggestions. 

Thanks.


----------



## bhargava (Mar 4, 2011)

bhargava said:
			
		

> I have added bwn_u4_ucode in /boot/loader.conf
> 
> ```
> cat /boot/loader.conf
> ...



I have a typo in there. I've now corrected it and will see if this will work. I'll post back in a minute after I reboot.
Thank you.


----------



## wblock@ (Mar 4, 2011)

You may also need to "up" the wlan0 interface the first time, which is why that's usually included in instructions:
`# ifconfig wlan0 up list scan`


----------



## bhargava (Mar 4, 2011)

Hi,

ifconfig wlan0 list scan is now working. 

Thank you wblock and cheme for the answers and your time.


----------

