The Linux Page

ASIX Electronics Corp. AX88178 -- not working with default module

My Story

First of all, if I got this device it is because my two integrated NIC Card on my P55A-UD4P died. One of them does not even light up. Completely dead! When connected to my modem, the light on the modem doesn't come up either. Weird! That's the first NIC that broke on me like this. I plugged my cable in the other NIC, just in case, and the light came up. Hurra? Not really. Ain't working either. It connects, but when trying to send a ping, it goes really fast meaning that the hardware doesn't know what's happening and is most certainly generating a flood of interrupts. Just in case, I tested with the BIOS advanced chipset system. eth0 (LAN1) blocks the whole BIOS. Although I could still hit reset.

As a note: this happened while I was testing a new installation doing many reboot & reset of the computer. Although... to my point of view, that should NOT have happened!

In search of a new NIC

That was a surprise: I heard of USB network systems that work with Wireless, but not as an actual replacement of a wired network card (NIC). Well... found out today that you could get one of those. It's kind of cool, it works on a USB port, can reach 1000 Mpbs (not useful for me as my D-Link 16 ports is only a 10/100, but that switch has been working for me since 2000, so I ain't complain! Before that I had a small hub, 4 ports, but that was definitively not enough when you get 5 or more computers...)

So! Plugged that new thing in, and automatically Linux tells me: There is an ASIX Ethernet on your system assigned to the eth3 port. Cool. Now trying to make it work... nothing does it. ifdown, ifup, ifconfig to see the result, looks good, ping this, ping that. My D-Link does not do anything meaning that it does not receive the pings... Trying with the graphical interface too. Hmmm... lost it! Unplug, re-plug, got back. Check the interface again and this time it says "Connected". Good. But still no traffic.

Search on the Internet, find many different posts about things related, but not specific enough to this USB adapter. Searching a little harder... Yo! I finally get to this page:

Help With USB Ethernet - 10.04

The guy describes his problem as the same as mine. Cool! Then he himself (argh!) gives the solution. The driver that comes with Ubuntu is not 100% compatible with newer models. (However, it looks like it is backward compatible.)

Solution

1. Download the newest version of the drive directly from ASIX

http://www.asix.com.tw/download.php

(you have to initiate a search)

I downloaded v3.5.0 as that one looked best (i.e. no other choice actually!)

2. Create a folder and extract the archive into it

I suggest a sub-folder inside your home folder.

3. You may want to read the readme file to make sure my instructions still apply (!)
4. Patch the driver to avoid excessive output

Driver version 3.5.0 includes a printk() call for debugging purposes that can be removed. It can be deleted altogether, although since the drive does not always kick in properly, having it once is still a good idea. So I changed the code in this way on my end:

  static int ax8817x_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
  {
      struct usbnet *dev = netdev_priv(net);
  {
  static int debug_ioctl = 0;
  if(debug_ioctl == 0) {
  debug_ioctl = 1;
  printk ("ax8817x_ioctl() ready\n");
  }
  }
      return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
  }

The following is the patch to actually remove the line:

--- asix_orig.c
+++ asix.c
@@ -767,7 +767,6 @@
 static int ax8817x_ioctl (struct net_device *net, struct ifreq *rq, int cmd)
 {
        struct usbnet *dev = netdev_priv(net);
-printk ("ax8817x_ioctl\n");
        return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
 }
 

The default code in asix.c only includes the printk(). So, edit asix.c, search for the ax8817x_ioctl() function and delete that line or add my code. Note that the default doesn't hurt too much, it will just litter your kernel logs with thousands of ax8817x_ioctl() entries.

5. Type 'make' to build this newer module

Note: you will need to have the Linux headers installed (you do not need to have all the sources.) If you have Debian or Ubuntu, try this one:

  apt-get install linux-headers-2.6.32-26-server

(replace the version numbers with yours)

When the make functions, you get no errors, however, you still will get some output. In my case, I got something like this:

  make -C /lib/modules/2.6.32-26-server/build SUBDIRS=/home/alexis/tools/asix-driver modules
  make[1]: Entering directory `/usr/src/linux-headers-2.6.32-26-server'
    CC [M]  /home/alexis/tools/asix-driver/asix.o
    Building modules, stage 2.
    MODPOST 1 modules
    CC      /home/alexis/tools/asix-driver/asix.mod.o
    LD [M]  /home/alexis/tools/asix-driver/asix.ko
  make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-26-server'

As you may notice, it uses make -C to change directory to your Linux header files. Once there, it builds everything and saves the results in the directory where you extracted the asix driver.

IMPORTANT: You do not need be root to do this.

6. Continue only if step 5 did NOT generate an error, if you get an error, you will have to resolve that first. On my end I got no errors at all.
7. Check whether you already have the default asix module loaded, if so you must first unload it to not risk crashing your system. To do so, run lsmod
  lsmod

This command lists all the currently loaded modules. Search for asix. If you want, pipe that through grep:

  lsmod | grep asix

Found the module? Then you need to remove it with rmmod as in:

  sudo rmmod asix
8. Save the existing module

The kernel USB Network drivers are under /lib/modules/#.#.#-#-server/kernel/drivers/net/usb/asix.ko where the # represent your current kernel version since version 2.6.21 (older version had them inverted under usb/usbnet/... see the readme file that tells you such details.)

To copy the existing file, do this:

  cp /lib/modules/#.#.#-#-server/kernel/drivers/net/usb/asix.ko \
        /lib/modules/#.#.#-#-server/kernel/drivers/net/usb/asix.ko.orig

In case it doesn't work right, you can then copy the files the other way around to restore the original.

9. Copy the new module in the kernel module area

The new file, asix.ko, should be in the current directory after you ran make. This is the new version of the module that you want to copy to the kernel area with:

  cp asix.ko /lib/modules/#.#.#-#-server/kernel/drivers/net/usb/asix.ko
10. Load the newly compiled module
  insmod /lib/modules/#.#.#-#-server/kernel/drivers/net/usb/asix.ko

Note that the whole path is required. You could also load the module in the folder where you just compiled it. But I don't recommend you doing so. (in case you try to re-compile, etc.)

Next step will be to reboot to see whether everything gets detected automatically then and assigned the correct IP, etc.

Make sure it works on a reboot

Somehow, the version I have still doesn't work on a reboot. That is, if I shut down and restart the computer, the ASIX driver is started before something else is available and the initialization fails. The driver is then totally useless.

To remediate to this problem, I wrote a small script that I placed in my /etc/rc2.d/... folder. There it is run on each reboot, after many other things are up and running so actually making it even safer network wise. The script runs step 7 and 10:

  rmmod asix
  insmod /lib/modules/#.#.#-#-server/kernel/drivers/net/usb/asix.ko

As far as I can tell, there is no need for a pause between those two instructions.

Kernel Updates

One thing you want to remember. Each time your kernel is updated, you'll have to recompile the code. It is specific to a kernel (it includes kernel headers) so it is required to do that work each time the kernel changes.

Note that as far as I know, the simple compile process presented here only works with the kernel you booted on. In other words, the process of updating for a kernel becomes:

1. Do your Linux updates

On Ubuntu or Debian use: sudo apt-get dist-upgrade

2. Reboot your server

When you reboot, the USB NIC will not be working since it will use the default ASIX device offered with the kernel.

3. Follow the same steps to recompile & install the driver

Once you recompiled for the new Linux kernel and you installed the new version of the ASIX driver, then you'll be up and running. No need to reboot once more (although if you want to make sure that it will also work on a reboot...)

Note that if you use the same folder as before to recompile, you probably want to run a make clean first.

  make clean

Logitec LAN-GTJ/U2A USB Gigabit Ethernet adapter

The Logitec LAN-GTJ/U2A is also supported by this driver since it uses the same chip. However, the drive doesn't recognize that adapter by default since it is not defined in the list of supported hardware. (although it is the same chipset, Logitec puts its own device reference numbers, which is customary in the hardware world.)

The following is the patch you want to use to add this support:

@@ -3275,6 +3274,10 @@
        USB_DEVICE (0x0b95, 0x1780),
        .driver_info =  (unsigned long) &ax88178_info,
 }, {
+       // Logitec LAN-GTJ/U2A
+       USB_DEVICE (0x0789, 0x0160),
+       .driver_info =  (unsigned long) &ax88178_info,
+}, {
        // 88178 for billianton linksys
        USB_DEVICE (0x077b, 0x2226),
        .driver_info =  (unsigned long) &ax88178_info,

See the addition of LAN-GTJ/U2A in the middle.

Source: LAN-GTJ/U2A USB 2.0 to Gigabit Ethernet adapter on Linux

Pingback

[...] ASIX Electronics Corp. AX88178 -- not working with default module | The Linux Page linux.m2osw.com/asix-electronics-ax88178-driver – view page – cached Getting the ASIX Electronics Corp. AX88178 to work on your Linux system. [...]

Pingback

[...] ASIX Electronics Corp. AX88178 -- not working with default module ... [...]

Pingback

[...] Read the original post: ASIX Electronics Corp. AX88178 — not working with default module … [...]

Pingback

[...] ASIX Electronics Corp. AX88178 — not working with default module … [...]

Pingback

[...] ASIX Electronics Corp. AX88178 — not working with default module … [...]