# Lenovo X220 with Realtek RTL8188CE WIFI



## staus (Feb 19, 2017)

FreeBSD 11 on a Lenovo X220 works very well for my purpose, except for the Realtek RTL8188CE wireless card. I always wondered why wifi downloads were very slow, but when it trashes the wifi network I needed to try for a fix.

I downloaded the latest win 7 x86 driver from Realtek, and extracted the .sys and .inf files.
Using ndisgen I created a new driver - rtl8192ce_sys.ko.
This was moved to /boot/modules along with ndis.ko from the /boot/kernel directory.
My /boot/loader.conf was edited with ndis_load="YES" and rtl8192ce_sys_load="YES".
My /etc/rc.conf was edited with wlans_ndis0="wlan0" (not sure if this is correct).

But, wifi does not show up after rebooting. dmesg shows the original rtwn0 devices,
even if I edit /boot/loader.conf with if_rtwn_load="NO", rtwn-rtl8192cfwU_load="NO",
and rtwn-rtl8192cfwU_B_load="NO".
kldstat shows ndis.ko and rtl8192ce_sys.ko loaded. ifconfig shows no wireless device.

How can I get FreeBSD to recognize the new ndis driver? I'm not sure a this driver will resolve
the problem, but it's worth a try. Otherwise, I guess I'll need a USB wifi adapter.


----------



## nickednamed (Feb 19, 2017)

This doesn't really answer your question, but I can recommend two other options:

1. Get a FreeBSD-supported card on the Lenovo X220 whitelist EG Intel Centrino Advanced 6205N (although you must run it in 802.11g mode)
2. Flash the BIOS with an unnoficial BIOS (no whitelist) and use any card you want


----------



## staus (Feb 20, 2017)

Thanks. I'm not sure what to do with this laptop. Probably dump win 10 back on, as that works OK with the wifi card installed.
I think linux distros may have the same problem of slowing the network down for all users. My wife couldn't use wifi whenever I was downloading with freebsd (also by wifi).
I thought the ndis program would use the windows driver. I just today tried using the realtek .inf and .sys files from win 10, and I still can't get ifconfig to show the card.


----------



## nickednamed (Feb 20, 2017)

Could it be that you need to use a Windows XP driver?

That's what the handbook says, although the ndisgen(8)() manual makes no mention of specific Windows versions.


----------



## staus (Feb 20, 2017)

I tried the latest win 10 drivers because the older ones for xp/7/8 had a bug that caused a lot of slow connections/dropouts on various laptops. I'm getting closer and closer to giving up.
Thanks for your input.


----------



## nickednamed (Feb 21, 2017)

The X220 is a great laptop though - I have one and FreeBSD 11 works pretty well on it.

For me, almost everything just works (although I've yet to try Bluetooth or my 3G modem). If you are serious about using FreeBSD on it, I'd update the BIOS and get a supported wireless card. It takes just a few minutes.


----------



## staus (Feb 21, 2017)

I really like the laptop, but like I wrote, my wifi kills our home network. Can you let me know what card you are using?
Trying to research for FreeBSD supported cards is daunting. I spend enough time googling.


----------



## nickednamed (Feb 21, 2017)

I'm using the Intel Centrino Advanced-N 6205. Like I wrote earlier, it has a few problems with dropped connectivity (see here, here, and here, etc...), regardless of OS.

The solution / workaround on FreeBSD is to disable 802.11n in etc/rc.conf like this:


```
wlans_iwn0="wlan0"
ifconfig_wlan0="-ht WPA DHCP"
```
Not the "-ht". Somewhat cryptically, this is how you disable 802.11n. From ifconfig() manual:


```
ht      Enable use of High Throughput (HT) when using 802.11n (default).
             The 802.11n specification includes mechanisms for operation on
             20MHz and 40MHz wide channels using different signalling
             mechanisms than specified in 802.11b, 802.11g, and 802.11a.
             Stations negotiate use of these facilities, termed HT20 and HT40,
             when they associate.  To disable all use of 802.11n use -ht.  To
             disable use of HT20 (e.g., to force only HT40 use) use -ht20.  To
             disable use of HT40 use -ht40.
```

After adding that to my /etc/rc.conf the card is solid. No dropped connections or problems finding access points.

I don't know anything about any other cards, other than Atheros cards seem to be well supported.


----------



## jrm@ (Feb 21, 2017)

I have the 6205 card in my X220 and I don't ever recall a dropped connection from our WPA2 network at home.  The WPA-EAP connection at work used to be unusable because of frequent drops, but for some time (since 11.0?) it also works well (although I don't use it daily like I do at home, so I'm  not as confident making this statement).

Added: I don't disable 802.11n.  I'll check details when I return home.


----------



## nickednamed (Feb 21, 2017)

Strange. I remember after upgrading to FreeBSD 11-RELEASE I was still getting dropped connections. 

I remember clearly because I'd forgotten to back up my etc/rc.conf and was having trouble remembering the right flags to disable 802.11n, and when I looked for it on the internet (I missed it in the manual), I kept getting those annoying dropped connections.

Perhaps not all 6205 suffer from the dropped connections..?


----------



## jrm@ (Feb 22, 2017)

Not sure.  Maybe there is something different with our access points?  This is what I see at home.

```
ifconfig | grep 802
        media: IEEE 802.11 Wireless Ethernet MCS mode 11na
        regdomain FCC country US authmode WPA2/802.11i privacy ON
```


----------



## Deleted member 48958 (Feb 22, 2017)

Maybe someone doesn't know,
there is a nice app in ports tree (originated from GhostBSD) that manages ethernet and wi-fi connections very well. Also it works good on my Lenovo T420. BTW I had some problems too with Realtek card on FreeBSD…
net-mgmt/networkmgr






To use it:
1. install it `# pkg ins networkmgr`
2. create /usr/local/etc/doas.conf with following content:

```
permit nopass keepenv :wheel cmd netcardmgr
permit nopass keepenv :wheel cmd detect-nics
permit nopass keepenv :wheel cmd detect-wifi
permit nopass keepenv :wheel cmd ifconfig
permit nopass keepenv :wheel cmd service
permit nopass keepenv :wheel cmd wpa_supplicant
```
3. your user shoud be in a wheel group.


----------



## staus (Feb 22, 2017)

Thanks. I'll give the -ht flag a try as well as the networkmgr program.


----------



## nickednamed (Feb 22, 2017)

jrm@ said:


> Not sure.  Maybe there is something different with our access points?  This is what I see at home.
> 
> ```
> ifconfig | grep 802
> ...



And here is mine:

```
ifconfig | grep 802
   media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
   regdomain FCC country US authmode WPA2/802.11i privacy ON
```
I'm not going to pretend I know what "OFDM" means yet.


----------

