juni 27, 2018
Adding drivers for extra hardware (Part 2)
This post is a follow-up from the previous one, where I learned all about adding drivers to Karotz.
A few months ago, my Karotz friend from the UK contacted me. He changed his WIFI-router, and since then, his Karotz dropped out of the WIFI-network and didn't came back. First I thought this could be caused by the ARP-bug, but it seemed that his Karotz dropped out completely, and the connection was lost, so it seemed to be another bug.
This is, of course, not that strange. Karotz is running on older hardware and because routers are running newer protocols, things can go wrong. So, a solution might be upgrading Karotz with a newer WIFI-network-adapter, and that's what we did.
I contacted Slash some time before and asked him if he could create a driver for the TP-Link 150Mbps Wireless N Nano USB Adapter (TL-WN725N). This is a tiny USB adapter to connect a laptop or computer with a USB port to the internet. Slash sent me a driver, and this would finally be the time to test it. Unfortunately, the driver wouldn't load. I contacted Slash again and he cross-compiled a new version, which loaded. After inserting the TP-Link USB Adapter and bringing it up, Karotz was connected to WIFI with its new adapter.
So let me explain what we did to get it up and running. First, I uploaded the driver to Karotz using its build-in FTP-server with WinSCP on my Windows PC. I placed the driver in /tmp, but if you want it to keep it after a reboot, place it somewhere else. I then added the driver to the kernel using the following command:
This gives you the following lines in DMESG:
RTL871X: rtl8188eu v4.3.0.8_13968.20150417
RTL871X: build time: Apr 21 2018 23:11:46
usbcore: registered new interface driver rtl8188eu
RTL871X: module init ret=0
I then inserted the TP-Link adapter into the USB port on the back of Karotz and took a look at DMESG again:
hub 1-1:1.0: port 2, status 0101, change 0001, 12 Mb/s
hub 1-1:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
usb 1-1.2: new full speed USB device using s3c2410-ohci and address 4
...
rtl8188eu 1-1.2:1.0: usb_probe_interface
rtl8188eu 1-1.2:1.0: usb_probe_interface - got id
RTL871X:
...
RTL871X: rtw_ndev_init(wlan1)
RTL871X: _rtw_drv_register_netdev, MAC Address (if1) = 50:3e:aa:40:12:45
drivers/usb/core/inode.c: creating file '004'
usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8179
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2: Product: 802.11n NIC
usb 1-1.2: Manufacturer: Realtek
usb 1-1.2: SerialNumber: 00E04C0001
hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0004
This looks good, we have a new WLAN interface called "wlan1".
Let's bring the interface up and take a look using the following commands:
ifconfig
And we see:
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:904 (904.0 B) TX bytes:904 (904.0 B)
wlan0 Link encap:Ethernet HWaddr 00:0E:8E:2C:D4:11
inet addr:192.168.178.130 Bcast:192.168.178.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1073 errors:0 dropped:0 overruns:0 frame:0
TX packets:565 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1258549 (1.2 MiB) TX bytes:65541 (64.0 KiB)
wlan1 Link encap:Ethernet HWaddr 50:3E:AA:40:12:45
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wmaster0 Link encap:UNSPEC HWaddr 00-0E-8E-2C-D4-11-00-00-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
We see two WIFI interfaces, wlan0 is the build-in one which we use to connect right now. Wlan1 is the new one, but it doesn't have an IP-address. Lets give it to him:
ifconfig
The second command will list the networkinterfaces again, and we will now see an IP-address for wlan1, which is the TP-Link adapter.
Let's start WLAN1:
This will give a warning, which I ignored.
I pinged the IP-address of WLAN1, and it answered successfully. So I disabled WLAN0, the build in network adapter. Because this will lose routing, I added it again:
route add default gw 192.168.178.1
And we have an internet connected Karotz :-)
I created a network-startup script to use with FROS, our Free Karotz OS. When you put the TP-link driver into /usr/karotz/firmware/, and put the script into /usr/scripts as "waitfornetwork.sh", overwriting the current file, it should connect to WIFI using the TP-Link adapter after boot. Don't forget to change the values in the lines below the comments (line 7-12) with your own network values.
My Karotz friend from the UK also bought the TP-Link adapter and is running happily for a few months now, without network drops.
Hope this will also help you connecting your Karotz to newer routers. Tell us all your stories and Karotz-adventures. And of course, many many thanks to Slash for providing the drivers.
You can download the driver (8188eu.ko) in a ZIP file from here.
Images
Karotz with the TP-Link WIFI Nano USB Adapter.
Karotz with the TP-Link WIFI Nano USB Adapter.
The TL-WN725N WIFI Nano USB Adapter from TP-Link.
The TL-WN725N WIFI Nano USB Adapter from TP-Link.