Using the AirPrime PC5220 with FreeBSD

This driver works with FreeBSD 5.4 to use the AirPrime PC5220 EVDO wireless card with FreeBSD.

Status

BEWARE: As of FreeBSD 5.4, there is a bug in the kernel's handling of removable USB hubs that will crash your system if you remove the EVDO card. I repeat: DO NOT REMOVE THE CARD AFTER INSERTING IT with or without this driver! The bug has nothing to do with the driver.

I've run pings through it for a couple of days on 1xRTT and have had no problems, but I haven't done extensive testing to ensure that I didn't goof anything up.

Steve Lin reports that it works with EVDO, getting speeds of between 400-750kbps, similar to the speeds he was getting under Windows.

Todd Troutman reports that the driver works with FreeBSD 6.0, but the device is changed to /dev/cuaU0 instead of /dev/ucom0. So change your ppp.conf appropriately.

To use

Patch your kernel a bit

Apply this patch in /usr/src/sys/conf (it adds our new driver):

*** files       Wed May 11 19:13:06 2005
--- files.new   Wed May 11 08:06:18 2005
***************
*** 829,834 ****
--- 829,835 ----
  dev/usb/umodem.c      optional umodem
  dev/usb/ums.c         optional ums
  dev/usb/uplcom.c      optional uplcom ucom
+ dev/usb/ugencom.c     optional ugencom ucom
  dev/usb/urio.c                optional urio
  dev/usb/uscanner.c    optional uscanner
  dev/usb/uvisor.c      optional uvisor ucom

And apply this one in /usr/src/sys/dev/usb (it adds a definition for vendor AIRPRIME and the PC5220 card):

*** usbdevs     Wed May 11 19:15:52 2005
--- usbdevs.new Wed May 11 19:15:40 2005
***************
*** 353,358 ****
--- 353,359 ----
  vendor MSI            0x0db0  Micro Star International
  vendor HAWKING                0x0e66  Hawking Technologies
  vendor GMATE          0x0e7e  G.Mate, Inc
+ vendor AIRPRIME               0x0f3d  Airprime, Inc.
  vendor MICROTUNE      0x0f4d  Microtune, Inc.
  vendor QUALCOMM2      0x1004  Qualcomm
  vendor WESTERN                0x1058  Western Digital
***************
*** 453,458 ****
--- 454,462 ----
  product AGFA SNAPSCANE25      0x2095  SnapScan e25
  product AGFA SNAPSCANE26      0x2097  SnapScan e26
  product AGFA SNAPSCANE52      0x20fd  SnapScan e52
+ 
+ /* Airprime, Inc. products */
+ product AIRPRIME PC5220               0x0112  AirPrime CDMA Wireless EVDO card
  
  /* AKS products */
  product AKS USBHASP           0x0001  USB-HASP 0.06

Grab the file ugencom.c and put it in /usr/src/sys/dev/usb/

Add the device to your kernel configuration file:

device   ucom
device   ugencom

and rebuild / reinstall your kernel.

Configure PPP

See this sample PPP configuration. Much of the information for this PPP config was shamelessly taken from Phil Karn's guide to using the 5220 with Linux. As was the path to creating the FreeBSD driver. Thanks, Phil!

Note that if you've got EVDO, you'll want to boost the serial rate up to a megabit or so, in multiples of 115200.

Run PPP

  ppp -ddial vzw
or
  ppp -auto vzw

will do the trick nicely. I'm using this configuration in a NAT gateway based on the EVDO card (ethernet inside, EVDO outside, put your LAN on the network) using the Soekris Engineering tiny PCs. Make sure you get one with pc-card slot, like the net4521. Together with NanoBSD, it's a (relative) snap to get one of these things up & running.