Building the VT6656 Linux Driver for Ubuntu

Building the VT6656 Linux Driver for Ubuntu

Building the VT6656 Linux Driver for Ubuntu

Building the VT6656 Linux Driver for Ubuntu

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.logicsupply.com/pub/vt6656-compile-with-2.6.20.patch' | patch -p2
--13:10:15--  //www.logicsupply.com/pub/vt6656-compile-with-2.6.20.patch
           => `-'
Resolving www.logicsupply.com... 72.3.249.30
Connecting to www.logicsupply.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

Comments (40)

  1. Forest Bond
    Forest
    January 4, 2008

    Just a reminder to anyone following these instructions:

    We’re only building in the “driver” subdirectory; be sure not to miss the “cd driver” command just before “make”, above.

  2. Forest Bond
    Forest
    January 7, 2008

    I’ve heard complaints from some users that they are unable to successfully connect to a network using this driver, despite success scanning for local networks (using iwlist).

    I did successfully connect to an open 802.11b/g network, and was able to transfer data without problems, however, users should be aware that this driver may not necessarily be completely bug-free, and may have problems with certain network environments. In particular, radio interference and slightly odd network parameters may play a role in determining success.

  3. Joao
    January 16, 2008

    I have tried to compile the driver for VT6655 in Feisty using the same technique described, but I’m not skilled enough to patch the source code and fix the errors.

    Can you help?

  4. Forest Bond
    Forest
    January 16, 2008

    Hi Joao,

    What issues are you seeing?

  5. max
    January 27, 2008

    Hi,

    any news about the gutsy patch?
    🙂

  6. Forest Bond
    Forest
    January 28, 2008

    Hi max,

    Sorry, I don’t have anything ready yet. We’ve been busy around here 🙂

    I’ll see what I can come up with a little later in the week.

  7. Forest Bond
    Forest
    February 4, 2008

    The following patch does make the driver compile with the gutsy kernel (2.6.22-14-generic). I haven’t actually tested the functionality, though.

    http://www.logicsupply.com/pub/vt6656.gutsy.patch

  8. Joao
    February 5, 2008

    I have dropped Feisty and installed Gutsy…

    These is what I get when trying to compile the VT6655 driver:

    make -C /lib/modules/2.6.22-14-generic/build SUBDIRS=/vt6655/VT6655-Linux-117-src-CPUPlatform-SAE/VT6655-Linux-117-src-CPUPlatform-SAE/viawget/driver modules
    make[1]: Entering directory `/usr/src/linux-headers-2.6.22-14-generic’
    […]

  9. Forest Bond
    Forest
    February 5, 2008

    Hi Joao,

    I trimmed your post way down; I hope you don’t mind.

    It looks like this driver also has some API incompatibilities. That means that it needs to be patched to compile.

    I’ll try to get a patch put together at some point. Due to time limitations, however, this may not be possible until next week.

  10. Joao
    February 5, 2008

    Hi

    Of course not.

    I would appreciate any help, thanks in advance!

  11. Chris
    March 3, 2008

    I have patched the VT6655 driver for use on ubuntu 7.10 (kernel 2.6.22 [and up?])

    Forest, please email me for the patch, clean/fix it up, and post it here!

  12. […] process to the one described previously for the VT6656. You should follow the instructions from my previous post, but use the following commands to fetch, unpack, patch, and build the driver […]

  13. Riadh
    March 17, 2008

    when i execute the command #insmod vntwusb.ko
    i get the following:
    “vntwusb: version magic ‘2.6.16.29-xen SMP 686 REGPARAM gcc-4.0’ should be ‘2.6.16.29-xen SMP 686 REGPARAM gcc-3.4’ ‘”

    i d’ont know what to do.. please help

  14. Forest Bond
    Forest
    March 17, 2008

    Hi Riadh,

    Which distribution are you on? The kernel you are running is not a standard kernel for either Ubuntu 7.04 or Ubuntu 7.10. Perhaps you compiled it yourself?

    The problem that you are seeing is that the default gcc version on your system (the one that is being used to compile the driver) is not the same version that was used to compile the kernel. Kernel modules must be compiled with the same gcc version that was used to compile the kernel itself.

    You may have luck by editing the Makefile and changing this:

    ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
    CC := kgcc gcc cc
    else
    CC := gcc cc
    endif

    test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
    CC := $(foreach cc, $(CC), $(test_cc))
    CC := $(firstword $(CC))

    To this:

    CC = gcc-4.0

    Be sure that you have gcc-4.0 installed (apt-get install gcc-4.0).

    Hope this helps.

    -Forest

  15. May 14, 2008

    Hi to all,
    I have problems with this driver because my pc seems not to be able to get a IP address from wifi router even if it has DHCP on…

  16. Forest Bond
    Forest
    May 15, 2008

    Hi Mirko,

    Your report is the second I’ve seen that indicates issues with this driver. I suspect the driver has some quirks that prevent it from functioning correctly in some network environments. Unfortunately, there may not be much that can be done about this, except to notify VIA of the issue.

  17. Josue
    May 22, 2008

    Hi there,

    I’m also trying to install VT6655 WiFi on my MicroClient. I’m using ndiswrapper (v.1.45) on a Xubuntu 7.10. Initially it seems everything is working perfectly but I’m experiencing some problems when connecting remotelly to my MicroClient. To do so I’m using openSSH.

    Well, the problem is that the openSSH connection goes down very often. To test what’s happening I perform an infinite ping from any computer to my MicroClient, with this result:

    Respuesta desde 10.1.10.17: bytes=32 tiempo=6ms TTL=63
    Respuesta desde 10.1.10.17: bytes=32 tiempo=3ms TTL=63
    Respuesta desde 10.1.10.246: Host de destino inaccesible.
    Respuesta desde 10.1.10.246: Host de destino inaccesible.
    Respuesta desde 10.1.10.17: bytes=32 tiempo=23ms TTL=63
    Tiempo de espera agotado para esta solicitud.
    Respuesta desde 10.1.10.17: bytes=32 tiempo=12ms TTL=63
    Tiempo de espera agotado para esta solicitud.

    So the point is that my MicroClient’s WiFi is working descontinuosly and this is a huge problem if working with openSSH as after some seconds of inactivity the connection is lost.

    Do you know if the problem can be related to ndiswrapper? Do you think installing the proper linux drivers would it work better?

    Thank you in advance!
    Josué

    (I’ll post this also in the microclient’s group in google)

  18. ni_lus
    June 20, 2008

    Does anyone here got a compiled one for Ubuntu 8.04 (Hardy Heron)?

    I’ve tried the hardy heron patch for it but I’m still having problems. I will try it again but if anyone has a compiled one, please share…thanks in advance.

  19. El Flavio
    June 21, 2008

    Any chance of a Deb file comming out for this driver? It could make it a lot more easier for installing the driver.

  20. Forest Bond
    Forest
    June 24, 2008

    ni_lus, El Flavio:

    Unfortunately, there is no license for these drivers, and thus distribution of binaries is not permitted. If you are dissatisfied with this situation, do feel free to let VIA know.

  21. Anthony
    July 7, 2008

    Thanks for the instructions, got it working with debian 4 without much trouble, just had to unplug the usb a couple times for it to be recognized. Now all I need is to compile wpa_supplicant to go with it.

  22. ni_lus
    July 22, 2008

    Thanks anyways. I tried this before but haven’t had much luck. I guess I’ll just try again, maybe there’s something I did wrong before.

  23. Okko
    July 26, 2008

    Hi,

    anyone had success in Ubuntu 8.04 (Hardy Heron)?

    First issue I encoutered was in make:

    scripts/Makefile.build:46: *** CFLAGS was changed in “Makefile”. Fix it to use EXTRA_CFLAGS. Stop.

    I was able to fix this with these steps:

    1) Search & replace “CFLAGS” with “EXTRA_CFLAGS” until you find the line

    $(CC) $(CFLAGS) -o $@ $<

    Replace that line with:
    $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $<

    I then applied the gutsy.patch, but compiling fails with this error message:

    driver/main_usb.c: In function ‘vntwusb_found1’:
    driver/main_usb.c:784: error: implicit declaration of function ‘SET_MODULE_OWNER’

    so probably an updated patch for 8.04 is needed.
    VIA hasn’t updated their source for quite some time so it is starting to look like they won’t.

  24. Forest Bond
    Forest
    July 28, 2008

    ni_lus: You are trying to compile the driver for Ubuntu 8.04. As Okko notes, a new patch is necessary to make that work. The patch that I originally provided was for Ubuntu 7.10.

    If time permits, we may be able to distribute a patch for Ubuntu 8.04. However, the API differences between VIA’s driver and current kernel versions continue to grow, and, as such, so does the work involved with resolving those differences and producing new patches.

  25. Okko
    August 10, 2008

    VIA has updated the driver on August 8th 2008. It is available in the VIA Arena distribution page linked in the original post by Forest and appears to compile on Ubuntu 8.04 with the most recent kernel. There are a couple of warnings, though:

    WARNING: modpost: GPL-incompatible module vntwusb.ko uses future GPL-only symbol ‘usb_deregister’
    WARNING: modpost: GPL-incompatible module vntwusb.ko uses future GPL-only symbol ‘usb_register_driver’

    VIA’s package’s linux.txt says “please don’t worry about it”. Maybe it’s a sign they are planning to GPLize their driver.

  26. Okko
    August 10, 2008

    PS. You can contact VIA using the form at:

    http://www.via.com.tw/en/support/contact_us/

    I asked them to release the driver with a license that allows inclusion in the standard kernel and encourage others to do the same, politely.

  27. Forest Bond
    Forest
    August 11, 2008

    Okko,

    Thanks for the update and for providing feedback to VIA regarding the driver license. It is important that VIA hears from its users about what is and isn’t working for them.

    Thanks,
    Forest

  28. macs
    November 5, 2008

    Hi,

    there are new drivers available on VIA Arena. They say that “supports Fedora Core 2, 3, 4, 5, 6, 7, Ubuntu 6.06, 7.04, 7.10, 8.04, Debian 3.0 & 4.0 and SuSE 10.1 & 10.3”.

    I installed them but I wasn’t able to install wpa_supplicant.

    Any help is welcome. 🙂

  29. Forest Bond
    Forest
    November 6, 2008

    Hi macs,

    Sorry, I haven’t had a look at the modified wpa_supplicant shipped with the driver. I probably won’t have time to take a look anytime soon.

    We’re now carrying WiFi modules with Realtek chips on them. The following module is supported by most modern distributions out of the box:

    http://www.logicsupply.com/products/lr802ukg

    I know that doesn’t help with compiling wpa_supplicant, but if you don’t have any luck, you might want to consider replacing the VIA part.

    Hope this helps.

    Thanks,
    Forest

  30. Muzammil Peer
    March 7, 2009

    After almost 28 hours, I’ve finally got it working. Thank you sooooo much!

  31. joaquin
    March 11, 2009

    @ Muzammil
    Can you please tell me which Linux distro you are using. and how you got it working.

    Thanks.

  32. Muzammil
    March 17, 2009

    Hi Joaquin,

    I have tried it on gOS, Ubuntu 8.04 and 8.10

    To be honest everything went great up till this stage:

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

    I had a few errors there. So what I did was to download the driver from viaarena (http://www.viaarena.com/default.aspx?PageID=420&OSID=45&CatID=3160&SubCatID=176), extracted it, then continue from the building stage with these files.

    I have been experimenting with linux and I have installed this wireless driver at least 7 times over the last week alone. It is possible!

  33. Muzammil
    March 17, 2009

    Hi Joaquin,

    To make it clearer to you these are what I did.

    1. Follow the above instructions up till just before ‘BUILDING’

    2. Download the driver from viaarena http://www.viaarena.com/default.aspx?PageID=420&OSID=45&CatID=3160&SubCatID=176

    3. Extract it and put it in somewhere

    4. Go to terminal and locate the folder should be VT6656_WLAN_Linux_V118

    Replace “BUILDING” with this:

    cd VT6656_WLAN_Linux_V118
    make

    5. Then continue with the rest of the steps dilligently.

    Hope it works for you.

  34. Forest Bond
    Forest
    March 17, 2009

    @Muzammil

    I haven’t tested it, but it sounds like VIA may have published a newer driver that does not require patching. You may be able to save some time by just downloading the newer driver and skipping the patch step.

  35. Forest Bond
    Forest
    March 19, 2009

    Update: new driver source available is GPL-licensed and does not require patching.

  36. Flohack
    July 20, 2009

    Guys,

    the location of the driver seems changed, I found it after a while (and boring redirections to the start page) here: http://www.viaarena.com/displaydrivers.aspx?PageID=1&OSID=25&CatID=2590&SubCatID=176

  37. flohack
    July 23, 2009

    Aditionally, I have issues with several APs. I cannot join them with the repeating message “WLAN_AUTHENTICATE_WAIT:wait x times!!” in the logs, where x goes from 1 to 5. Is this reception-related (too weak), or some other source of troubles? Any ideas?

  38. flohack
    December 24, 2009

    UPDATE: VIA has release a new Version (1.20.03) which works for me also with Ubuntu 9.10, despite they claim its only for 9.04. Link is the same as I have already posted here in July.

  39. Sim
    September 24, 2012

    Has anyone gotten the drivers working with Ubuntu 12.04? I am trying to install v1.20.03 and get an error right away:

    $ make
    Makefile:116: *** Linux kernel source not configured – missing config.h. Stop.

  40. Elmer
    May 25, 2013

    This WiFi card used to work, until i made a mistake of upgrading to 12.04 (my previous 9.xx isn’t supported anymore).
    Now it’s been 4 days since i’ve started looking for a solution and i’m still unable to fix the driver issue.
    If anyone reading this had success installing this card for 12.04 please let me know.

    Thanks!

Leave a Comment

Your email address will not be published.