# ndisgen vs TP-Link TL-WN727N V3



## vatson (Dec 12, 2013)

I'm trying to get the TP-Link TL-WN727N V3 USB WiFi adapter working with FreeBSD 9.2-STABLE amd64. Native support for this adapter was recently added to -CURRENT, but I'd prefer not to update my system to -CURRENT. So I'm trying to generate a driver using `ndisgen` and the Windows driver.

The Windows driver that I downloaded from the TP-Link website (zip file) contains 64-bit drivers for Windows XP, Vista, 7 and 8. Using `ndisgen` on the Windows XP driver results in ndiscvt coredumping without any other error messages, and of course no driver generated. Windows Vista, 7 and 8 drivers are successfully converted by ndisgen and I can load the resulting kernel module, other necessary modules are loaded automatically:

```
# kldstat
Id Refs Address            Size     Name
 1   24 0xffffffff80200000 9fc610   kernel
11    1 0xffffffff80e12000 20f4d5   netr28ux_sys.ko
12    2 0xffffffff81022000 145d3    ndis.ko
13    1 0xffffffff81037000 7342     if_ndis.ko
14    1 0xffffffff8103f000 300c6    wlan.ko
15    1 0xffffffff81070000 891f     pccard.ko
```

However, the adapter is still not recognized. When I plug it in, the following is listed in /var/log/messages:

```
Dec 12 20:43:26 tu-134 root: Unknown USB device: vendor 0x148f product 0x5370 bus uhub2
Dec 12 20:43:26 tu-134 kernel: ugen2.2: <TPlink> at usbus2
```

The .inf file seems to contain relevant vendor and product IDs:

```
# grep 5370 netr28ux.inf 
%Generic.DeviceDesc%            = OS61_RTWLANR.ndi,         USB\VID_148F&PID_5370
```

Some things that I have tried and that haven't helped:

When ndisgen prompts for firmware files, I tried to list all files that exist in the driver download other than the .inf and .sys file. I have no idea whether any of them are actually firmware files.
I copied the aforementioned files to /compat/ndis.
`kldload runfw`
None of that improves the situation.

Documentation for ndisgen that I have seen (also the built-in help) recommends to use Windows XP or 2003 drivers. Is it really the case that drivers for newer Windows versions are not supported or can there be some other reason why I can't generate a working driver? Such as that I had to modify ndisgen to use GNU grep instead of BSD grep to get ndisgen to recognize any Unicode-format .inf files at all?


----------

