High-speed cellular wireless modems (e.g. EVDO, HSPDA) in Ubuntu GNU/Linux 6.10

[inline:novatel-s720.gif]

Note: If you are running Ubuntu 7.04 or greater, this article is no longer relevant. Your EVDO modem should be detected and run at a higher speed automatically.

I’ve been raving about cellular wireless modems/data cards for a while now. While they’ve been available for a long while, they’ve finally become practical with networks such as EVDO and HSPDA that offer broadband-like speeds. I personally own a Novatel Merlin S720 that I use with Sprint’s Mobile Broadband service.

Most of these datacards are easy to get running in Linux—I actually setup mine in Linux faster than I did in Microsoft Windows. However, due to some shortcomings in the kernel used by Ubuntu GNU/Linux 6.10, you cannot take advantage of the speeds that these modern wireless networks offer.

This article talks about some of the problems of the often-used usbserial driver, and how to use the better-performing airprime driver instead.

Using the usbserial vs airprime drivers

Many instructions on the Internet that detail how to use these modems in Linux talk about using the usbserial driver, often having to pass custom vendor and device IDs to the driver so that it recognizes the device. While this does work, the usbserial driver was not made to handle high-speed devices like EVDO and HSPDA modems. It has some small I/O buffers, and with these small buffers you will not be able to get transfer speeds greater than 60 KB/sec. There are patches available to increase usbserial’s buffer size, but with the airprime driver, this is not needed.

The Linux airprime driver can operate these modems at full-speed, after support for larger buffers was added in 2.6.18. Unfortunately, the driver has to be patched to recognize any kind of new device.

This doesn’t help me using since I am Linux 2.6.17 on Ubuntu 6.10, and I’ve also no desire to deviate far from the distribution-provided kernel. 2.6.17’s airprime driver does not have the support for large buffers, nor does it contain the driver IDs so that the driver takes control of the device.

I took Andy Gay’s airprime improvement patches and backported them (“backport” is a misnomer since it was so easy), also adding the device IDs from 2.6.20 and a few other popular wireless modem devices (Note: I’ve not personally tested anything but the Novatel Merlin S720).

You can get the patch against Ubuntu’s 2.6.17 kernel, or simply download the entire patched airprime.c file. The patch contains device IDs for:

Kernel and driver setup

Install the minimum build environment, Linux sources, and Linux headers for your currently-running kernel: apt-get install build-essential linux-headers linux-source

Go into /usr/src/ and uncompress the kernel source code: cd /usr/src tar xjvf linux-source-2.6.17.tar.bz2

Enter the directory containing the airprime driver:

cd linux-source-2.6.17/drivers/usb/serial

Now, either apply the patch, or replace airprime.c with the pre-patched version (see above for download links).

If patching:

patch -p0 < airprime-sjain-012807.patch

If replacing (not recommended, patching is safer):

mv airprime.c airprime.c.bak mv airprime-sjain-012807.c airprime.c Normally, to patch a driver, you have to recompile the entire kernel tree and replace all the kernel modules as well as the core kernel image itself. But since we are using Ubuntu’s sources, we can only compile the driver’s that we need and overwrite the old ones.

To compile only the airprime dirver (this actually compiles all drivers in the directory): make -C /lib/modules/uname -r/build M=pwd

Then, install it (you need root privileges to overwrite the existing driver) and update module dependencies: sudo cp airprime.ko /lib/modules/uname -r/kernel/drivers/usb/serial/airprime.ko sudo depmod -a

You can either remove and reinsert the driver, or take the easy way out and reboot. Your device should now be recognized by the airprime driver, and a new device node /dev/ttyUSB0 created.

Some ending notes…

The above installs files outside the knowledge of Ubuntu’s package manager. If your kernel ever gets upgraded, dpkg will happily overwrite your custom driver, and you will have to go through the above procedure again. To prevent this happening at an inopportune time, set your kernel’s package status to “hold” to prevent automatic upgrades.

If you’re using Sprint’s Mobile Broadband service as I am, you may want to look the sister article I’ve written, Sprint’s Mobile Broadband on Ubuntu GNU/Linux 6.10.

Comments

Comments powered by Disqus