mei 07, 2018

Adding drivers for extra hardware (Part 1)

About a year ago, a French Karotz owner called "Slash" contacted me. Slash is a Linux expert for 15 years, and has a Home Automation System with his Karotz completely integrated into it.

Slash wrote that he is using a wired connection and succeeded in building (cross-compiling) a driver for his hardware. He is using an Edimax EU-4230 USB to LAN adapter. This device also has a three port USB hub, so it will give him three extra USB ports. However, our Karotz has no out-of-the-box support for the Asix-chipset this device is using.

So Slash had to (cross)compile a driver, and he managed to add it to the Karotz using INSMOD. Insmod is a program to insert a module into the Linux kernel. This can be done during boot, anywhere in the boot process, as long as it is done before the hardware is actually needed. So for example, when we need a network module, we can insert it into the kernel just before we bring the network interface up. 

After Slash explained to me how he did this, he send me his compiled driver. I also wanted to try this, but his Edimax device was not sold anymore. So I bought a device with the same chipset. It is a Trendnet TU2-ET100 V4.0R. The appearance of this device is rather similar to many other devices with the same Asix-chipset (AX8817X). 

This is what I did to get it working: I booted using WIFI with the build-in network device. After booting, I uploaded the driver (asix.ko) to directory /usr/karotz/firmware/ on the Karotz, using FTP (I use Windows and the program WinSCP for my FTP connections). This directory is on the part of the flash-memory that doesn't get erased after boot, so the driver file will stay there, even if you turn your Karotz off and on or disconnect it from its powersource.

After uploading, I started a telnet connection. I then loaded the asix.ko driver using insmod:

/sbin/insmod /usr/karotz/firmware/asix.ko

Then, I inserted the Trendnet device and looked at dmesg. These lines were added:

usbcore: registered new interface driver asix
hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0004
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 5
usb 1-1.2: ep0 maxpacket = 8
usb 1-1.2: default language 0x0409
usb 1-1.2: uevent
usb 1-1.2: usb_probe_device
usb 1-1.2: configuration #1 chosen from 1 choice
usb 1-1.2: adding 1-1.2:1.0 (config #1, interface 0)
usb 1-1.2:1.0: uevent
usbserial_generic 1-1.2:1.0: usb_probe_interface
usbserial_generic 1-1.2:1.0: usb_probe_interface - got id
asix 1-1.2:1.0: usb_probe_interface
asix 1-1.2:1.0: usb_probe_interface - got id
eth0: register 'asix' at usb-s3c24xx-1.2, ASIX AX88772 USB 2.0 Ethernet, d8:eb:97:bf:f4:f4
drivers/usb/core/inode.c: creating file '005'
usb 1-1.2: New USB device found, idVendor=0b95, idProduct=7720
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2: Product: AX88x72A
usb 1-1.2: Manufacturer: ASIX Elec. Corp.
usb 1-1.2: SerialNumber: BFF4F4
hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0004
eth0: link down
-bash-4.1#

I added the commands to get ETH0 up, and assigned network settings (IP, netmask).

/sbin/ifconfig eth0 up
/sbin/ifconfig eth0 192.168.178.137 netmask 255.255.255.0

I then connected the LAN cable and tried to ping the new IP-address, with success. I finally disabled WLAN0, disconnected from Telnet and connected again using the new IP-address. Checking network with ifconfig:

eth0 Link encap:Ethernet HWaddr D8:EB:97:BF:F4:F4
inet addr:192.168.178.137 Bcast:192.168.178.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1266 errors:0 dropped:0 overruns:0 frame:0
TX packets:180 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:285652 (278.9 KiB) TX bytes:34882 (34.0 KiB)

And there it is, a fully working (wired) network connection using a device that isn't supported out-of-the-box by Karotz.

If you want to try out yourself, buying a new device, these devices might work with the asix.ko driver, because they use the same chipset:

  • Linksys USB200M
  • Netgear FA120
  • DLink DUB-E100
  • Intellinet, ST Lab USB Ethernet
  • Hawking UF200, TrendNet TU2-ET100
  • Billionton Systems, USB2AR
  • ATEN UC210T
  • Buffalo LUA-U2-KTX
  • Sitecom LN-029 "USB 2.0 10/100 Ethernet adapter"
  • Corega FEther USB2-TX
  • Surecom EP-1427X-2
  • goodway corp usb gwusb2e
  • JVC MP-PRX1 Port Replicator
  • ASIX AX88772 10/10
  • ASIX AX88178 10/100/1000
  • Linksys USB200M Rev 2
  • 0Q0 cable ethernet
  • DLink DUB-E100 H/W Ver B1
  • DLink DUB-E100 H/W Ver B1 Alternate
  • Linksys USB1000
  • IO-DATA ETG-US2
  • Belkin F5D5055
  • Apple USB Ethernet Adapter
  • Cables-to-Go USB Ethernet Adapter

You can download the driver (asix.ko) in a ZIP file from here.

We can add more hardware this way, even Wireless USB dongles, which will finally solve the problems caused by the "ARP bug" with the build-in WIFI adapter and driver of Karotz.

In part two of this blog, I will explain how Slash provided me with a cross-compiled Realtek driver and we managed to get a TP Link wireless USB adapter up-and-running.

Images

Karotz-Slash.jpg

Karotz of Slash, with the Edimax USB to LAN adapter.

Trendnet-Karotz.jpg

Karotz and the TRENDnet USB to LAN adapter.

Trendnet-manual.jpg

Karotz and the TRENDnet adapter attached.

Trendnet-box.jpg

Box of the TRENDnet TU2-ET100 V4.0R Adapter.

Leave a message