# My FreeBSD is unable to recognize a WiFi card



## takeda (Dec 2, 2012)

I have a PCI NIC card which I believe is D-Link DWL-G520. I had it in a very old box that I set up to act as an access point. The box was running FreeBSD 8.2 or 8.3. In any case, it is using AR5212 chip.

Everything worked fine, but today the machine gave its last breath and died.

I decided to move the NIC to another box that is more recent and is already running FreeBSD. The version is 9.1 RC3.

The problem here is that the card is not recognized, and by not recognized I mean I don't see it anywhere in pciconf output:


```
chinatsu :: ~ Â» pciconf -lv
hostb0@pci0:0:0:0:      class=0x060000 card=0x50001458 chip=0x01508086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Ivy Bridge DRAM Controller'
    class      = bridge
    subclass   = HOST-PCI
vgapci0@pci0:0:2:0:     class=0x030000 card=0xd0001458 chip=0x01528086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Ivy Bridge Graphics Controller'
    class      = display
    subclass   = VGA
xhci0@pci0:0:20:0:      class=0x0c0330 card=0x50071458 chip=0x1e318086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point USB xHCI Host Controller'
    class      = serial bus
    subclass   = USB
none0@pci0:0:22:0:      class=0x078000 card=0x1c3a1458 chip=0x1e3a8086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point MEI Controller'
    class      = simple comms
ehci0@pci0:0:26:0:      class=0x0c0320 card=0x50061458 chip=0x1e2d8086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point USB Enhanced Host Controller'
    class      = serial bus
    subclass   = USB
none1@pci0:0:27:0:      class=0x040300 card=0xa0021458 chip=0x1e208086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point High Definition Audio Controller'
    class      = multimedia
    subclass   = HDA
pcib1@pci0:0:28:0:      class=0x060400 card=0x50011458 chip=0x1e108086 rev=0xc4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Panther Point PCI Express Root Port 1'
    class      = bridge
    subclass   = PCI-PCI
pcib2@pci0:0:28:2:      class=0x060400 card=0x50011458 chip=0x1e148086 rev=0xc4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Panther Point PCI Express Root Port 3'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:28:3:      class=0x060401 card=0x50011458 chip=0x244e8086 rev=0xc4 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801 PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
ehci1@pci0:0:29:0:      class=0x0c0320 card=0x50061458 chip=0x1e268086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point USB Enhanced Host Controller'
    class      = serial bus
    subclass   = USB
isab0@pci0:0:31:0:      class=0x060100 card=0x50011458 chip=0x1e4a8086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point LPC Controller'
    class      = bridge
    subclass   = PCI-ISA
ahci0@pci0:0:31:2:      class=0x010601 card=0xb0051458 chip=0x1e028086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point 6 port SATA AHCI Controller'
    class      = mass storage
    subclass   = SATA
none2@pci0:0:31:3:      class=0x0c0500 card=0x50011458 chip=0x1e228086 rev=0x04 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Panther Point SMBus Controller'
    class      = serial bus
    subclass   = SMBus
alc0@pci0:2:0:0:        class=0x020000 card=0xe0001458 chip=0x10831969 rev=0xc0 hdr=0x00
    vendor     = 'Atheros Communications'
    device     = 'AR8151 v2.0 Gigabit Ethernet'
    class      = network
    subclass   = ethernet
pcib4@pci0:3:0:0:       class=0x060401 card=0x88921458 chip=0x244e8086 rev=0x41 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801 PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
none3@pci0:4:0:0:       class=0x020000 card=0x3a131186 chip=0x00130000 rev=0x01 hdr=0x00
    class      = network
    subclass   = ethernet
em0@pci0:4:1:0: class=0x020000 card=0x13768086 chip=0x107c8086 rev=0x05 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82541PI Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```
The machine's motherboard is Gigabyte GA-H77-DS3H, which has built in Atheros NIC (unlike the old box it is 64bit). I tried to compile various options, but no luck, here are relevant fragments of my config:


```
[...]
# Wireless NIC cards
device          wlan            # 802.11 support
options         IEEE80211_DEBUG # enable debug msgs
options         IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's
options         IEEE80211_SUPPORT_MESH  # enable 802.11s draft support
device          wlan_wep        # 802.11 WEP support
device          wlan_ccmp       # 802.11 CCMP support
device          wlan_tkip       # 802.11 TKIP support
device          wlan_amrr       # AMRR transmit rate control algorithm
#$device                an              # Aironet 4500/4800 802.11 wireless NICs.
device          ath             # Atheros NIC's
device          ath_pci         # Atheros pci/cardbus glue
device          ath_hal         # pci/cardbus chip support
options         AH_SUPPORT_AR5416       # enable AR5416 tx/rx descriptors
device          ath_rate_sample # SampleRate tx rate control for ath
#device         bwi             # Broadcom BCM430x/BCM431x wireless NICs.
#device         bwn             # Broadcom BCM43xx wireless NICs.
#$device                ipw             # Intel 2100 wireless NICs.
#$device                iwi             # Intel 2200BG/2225BG/2915ABG wireless NICs.
#$device                iwn             # Intel 4965/1000/5000/6000 wireless NICs.
#$device                malo            # Marvell Libertas wireless NICs.
#$device                mwl             # Marvell 88W8363 802.11n wireless NICs.
#$device                ral             # Ralink Technology RT2500 wireless NICs.
#$device                wi              # WaveLAN/Intersil/Symbol 802.11 wireless NICs.
#$device                wpi             # Intel 3945ABG wireless NICs.
[...]
# WiFi
device          wlan_xauth
device          wlan_acl
device          ath_ar5212
[...]
```

I'm running out of ideas what the problem could be. Please help.

Thanks,
Derek


----------



## nslay (Dec 2, 2012)

Here's a similar post:
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/current/2009-05/msg00518.html

The only difference is

```
chip=0x0013168c
```

I'm not sure how the various fields in pciconf are used to extract vendor and chip id in the driver (I know nothing about the ath driver), however I noticed that 0x168c is the Atheros vendor id and your chip id is missing that last 0x168c (yours shows 0x0000). I'm guessing the high order bytes 0x0013 correspond to AR5212 (the same as the link I provided and in ah_devid.h). Anyway, if something like vendor and chip id don't match up, then ath would never attach. Does it try to attach? (can you show dmesg?).

I checked ah_devid.h in /usr/src/sys/dev/ath/ath_hal.


----------



## takeda (Dec 2, 2012)

The output of dmesg is attached.

The last line showed up due to me calling: 
	
	



```
kldload ath_pci
```


----------



## nslay (Dec 2, 2012)

takeda said:
			
		

> The output of dmesg is attached.
> 
> The last line showed up due to me calling:
> 
> ...



You can probably force the attach by changing the atheros vendor ID to 0x0000 ... though I'm not sure if this has consequences. I would comment out the lines for ath* in your kernel config and build them as modules instead to experiment.

You probably should file a PR. I know Adrian is very quick to respond. I have submitted PRs about ath(4) before and he responds fast.


----------



## takeda (Dec 4, 2012)

Hey, I just wanted to follow up and thank you for your help.

After contacting Adrian and following his suggestion by trying to check whether it works on Linux (it wasn't) after many experiments (I won't bore you with useless details, but if you really want it is archived here) it turned out that the connection was dirty, and application of isopropyl alcohol solved the issue 

It's interesting that the card was partially recognized.

Anyway, thank you again for your help.


----------

