Please note: A new version of this driver is available that does not require patching. This driver is also GPL-licensed, making it suitable for eventual inclusion in the kernel. These instructions are now obsolete.  Download the updated driver source from Via Arena.

We’ve been carrying the VIA VNT6656G6A40 USB WiFi module for some time now. This is a nice, compact USB wireless module that is ideal for some applications due to the fact that it ships without the bulky plastic case and external USB connector that most consumer USB network devices do. Instead, you can simply wire it directly to an internal USB header and mount the circuit board wherever it fits inside the chassis.

The device is based on the VIA VT6656 802.11b/g chip. VIA has released several driver packages for this chip. If you run an ancient version of Fedora, you may be able to use one of the binary packages distributed with the Windows driver package; however, most users will instead need to compile the driver from source (and, in fact, you’ll also need to patch the source first).

That may sound intimidating to some users because many devices are supported by modern Linux distributions out-of-the-box. Sadly, VIA has chosen not to include a license with the VT6656 driver archive. Consequently, this device currently has no chance of being supported by popular Linux distributions due to the legal ambiguity surrounding the driver source code.

However, if you feel comfortable at the command-line prompt and are up for a little bit of work to get your device functioning, read on.

Fetching & Unpacking the Source

I’ll be building this driver on a machine running Ubuntu 7.04 (Feisty). First, create a temporary directory to work in and fetch the source archive from the VIA Arena distribution page:

$ mkdir vt6656
$ cd vt6656
$ wget 'http://www.viaarena.com/Driver/vt6656-linux-x86-src-v113.rar'

After you’ve downloaded the archive, unpack it:

$ unrar -y x vt6656-linux-x86-src-v113.rar
UNRAR 3.70 beta 3 freeware      Copyright (c) 1993-2007 Alexander Roshal

Extracting from vt6656-linux-x86-src-v113.rar

Creating    VT6656-Linux-x86-src-v113                                 OK
Extracting  VT6656-Linux-x86-src-v113/linux.txt                       OK
Extracting  VT6656-Linux-x86-src-v113/VT6656-Linux-x86-113-src-CPUPlatfrom.rar  OK
All OK
$ ls
VT6656-Linux-x86-src-v113  vt6656-linux-x86-src-v113.rar
$ cd VT6656-Linux-x86-src-v113

If you do not have the unrar program on your machine, install it:

$ sudo apt-get install unrar

This archive is a little unusual. The source files are inside another RAR archive, so we’ll need to unpack the inner archive as well:

$ ls
linux.txt  VT6656-Linux-x86-113-src-CPUPlatfrom.rar
$ unrar -y x VT6656-Linux-x86-113-src-CPUPlatfrom.rar
UNRAR 3.70 beta 3 freeware      Copyright (c) 1993-2007 Alexander Roshal
...
$ ls
driver   linux.txt  remove    utility                                   wpa_supplicant
include  Makefile   sta.wlan  VT6656-Linux-x86-113-src-CPUPlatfrom.rar

The included documentation file (linux.txt) appears to be grossly out of date, and is quite useless. Ignore it.

Preparing the System to Build Kernel Modules

Our next step is to build the driver. Like all kernel modules, you must have your kernel source (or a reasonable substitute, like the kernel headers package provided by Debian and Ubuntu) present on the machine in order to build. Many users will find that the Debian/Ubuntu-specific program module-assistant provides an easy way to prepare the machine for building kernel modules:

$ sudo apt-get install module-assistant
...
$ sudo module-assistant prepare
...

module-assistant installs the necessary linux-headers-* package, and creates a /usr/src/linux symlink to the correct directory. If you’d rather do this by hand, it’s easy enough:

$ sudo apt-get install linux-headers-$(uname -r)
$ ( cd /usr/src && sudo ln -s linux-headers-$(uname -r) linux )

Once that is done, you’re ready to build the driver.

Building

$ ls
driver   linux.txt  remove    utility                                   wpa_supplicant
include  Makefile   sta.wlan  VT6656-Linux-x86-113-src-CPUPlatfrom.rar
$ cd driver
$ make

After typing “make” and pressing enter, some text will scroll by on the screen. It may look like this:

make[1]: Entering directory `/usr/src/linux-headers-2.6.20-16-generic'
  CC [M]  /home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/main_usb.o
  CC [M]  /home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/card.o
...
  LD [M]  /home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/vntwusb.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/vntwusb.mod.o
  LD [M]  /home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/vntwusb.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-16-generic'

…but, then again, it may not. If you see text like that shown above, you’ve successfully compiled the driver. However, you may see some error messages instead. I’ve seen some of these:

Makefile:22: *** Linux kernel source not found.  Stop.

This means that the kernel source/headers are not installed and configured correctly.

make -C /lib/modules/2.6.20-16-generic/build SUBDIRS=/home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.20-16-generic'
  CC [M]  /home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/main_usb.o
/home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/main_usb.c: In function ‘vntwusb_found1’:
/home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/main_usb.c:801: error: ‘struct net_device’ has no member named ‘get_wireless_stats’
make[2]: *** [/home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver/main_usb.o] Error 1
make[1]: *** [_module_/home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-16-generic'
make: *** [default] Error 2

The above error is a telling sign that the driver source is out of date with your kernel, a common problem for vendor-maintained source drivers. If your kernel is from the 2.6.20 series, you can use this trivial patch for the driver source. Apply it to your driver source thusly:

$ wget -O- '//www.onlogic.com/pub/vt6656-compile-with-2.6.20.patch' | patch -p2
--13:10:15--  //www.onlogic.com/pub/vt6656-compile-with-2.6.20.patch
           => `-'
Resolving www.onlogic.com... 72.3.249.30
Connecting to www.onlogic.com|72.3.249.30|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 565 [text/plain]

100%[========================================================================>] 565           --.--K/s

13:10:16 (313.72 KB/s) - `-' saved [565/565]
patching file main_usb.c

The patch introduces two new lines of code. I’m not much of a kernel hacker, so I can’t say with certainty that the fix is correct, but it did seem to work on the system I tested with.

Note that this fix is kernel-specific. I tested the same patch on an Ubuntu 7.10 (Gutsy) system (kernel version 2.6.22-14-generic), and the module failed to build. Time permitting, I’ll try to prepare a patch for this kernel version as well. The only permanent solution is for VIA to re-release the driver and include the missing license file, allowing distribution and kernel developers to maintain and ship the driver properly.

Testing & Installing

Linux kernel modules are binary files with a .ko extension. Once the driver has been built successfully, you can insert it with the insmod tool:

$ ls *.ko
vntwusb.ko
$ sudo insmod vntwusb.ko

However, you’ll probably want to install it so that it gets loaded at boot time:

$ sudo make install
make -C /lib/modules/2.6.20-16-generic/build SUBDIRS=/home/forest.bond/vt6656/VT6656-Linux-x86-src-v113/driver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.20-16-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-16-generic'
mkdir -p /lib/modules/2.6.20-16-generic/kernel/drivers/net
install -m 644 -o root vntwusb.ko /lib/modules/2.6.20-16-generic/kernel/drivers/net
/sbin/depmod -a || true

If you need to, you can un-install the driver like this:

$ sudo make uninstall
rm -f /lib/modules/2.6.20-16-generic/kernel/drivers/net/vntwusb.ko
/sbin/depmod -a

You may prefer to keep locally-built drivers like this one separate from those shipped with your distribution. If that is the case, you can do that like this:

$ sudo mkdir /lib/modules/$(uname -r)/kernel/local
$ sudo install -m 644 -o root vntwusb.ko /lib/modules/$(uname -r)/kernel/local
$ sudo depmod -a

Once the module has been installed, it can be loaded with modprobe (rather than using insmod):

$ sudo modprobe vntwusb

If the module is installed correctly, your system should automatically detect and load it at boot time. Once it has been loaded, you should be able to use the usual tools provided by the distribution to configure it (NetworkManager on Ubuntu).

Caveats & Conclusion

The VIA source package also includes a patched version of wpa-supplicant. I have not used this; I assume that the device driver does not behave like most other wireless drivers, making the patched version of wpa-supplicant necessary.

Compiling and using wpa-supplicant is not something I’ll cover here. Do be aware that WPA security may not be functional without this patched version.

I hope this post is helpful to folks trying to get this device working on their Linux machines.

Further Reading

LEARN MORE ABOUT
OS DEVELOPMENT