3 ms·
I recently finished a project to customize Ubuntu to add support for some USB 3G modems. For the ones supported out of the box, the Ubuntu tools "just work". Su
by lmz 17y ago
I recently finished a project to customize Ubuntu to add support for some USB 3G modems. For the ones supported out of the box, the Ubuntu tools "just work". Supporting additional modems was rather complicated by the multiple layers in between the modem and NetworkManager.
First, when you plug in the modem, it rarely shows up as a modem. Sometimes it shows up as a CD drive containing drivers for Windows and OS X. To turn it into a modem, a special USB sequence needs to be sent. The program we used was usb_modeswitch (http://www.draisberghof.de/usb_modeswitch/ http://www.draisberghof.de/usb_modeswitch/). The ubuntu package is rather nice in that it automatically sets up udev rules to switch the modems when they are plugged in. Some types of modems are also detected and automatically switched by the driver in the kernel.
After the device is switched to "modem mode", it doesn't mean there's a /dev/ttyUSB* device ready. A lot of these 3g modems don't expose a standard CDC ACM interface (why that is I don't know), requiring manual invocations of "modprobe usbserial vendor=0x1234 product=0x5678" so the generic USB serial driver can be used. The generic USB serial driver has the additional suckiness of only being able to hold one vendor/product ID pair at a time. Some HOWTOs on the net guide the user towards recompiling the option.ko kernel module to add the relevant vendor/product IDs.
After there is a /dev/ttyUSB* device, doesn't mean that it will show up in NetworkManager. NetworkManager actually installs a udev rule that runs a probe command (nm-modem-probe) to make sure that the device is indeed a modem. The nm-modem-probe command sends AT-command queries, parses the answers, and exports variables like ID_NM_MODEM_PROBED=1 and ID_NM_MODEM_IS707_A=1 (for a CDMA/EVDO modem). If nm-modem-probe doesn't think your device is a modem, it won't show up in NetworkManager. Fortunately we can run our own commands after nm-modem-probe to override the variables for modems that we support.
Fortunately the modems we tried all had no problems with NetworkManager's hardcoded, unconfigurable init string. If this had not been the case we might have been forced to use gnome-ppp which is a wvdial frontend.
This is why wvdial is still recommended in this day and age. People can just say "modprobe usbserial vendor=0x... product=0x...", "copy this file to /etc/wvdial.conf", "run wvdial" and for the most part, it works well enough for a personal user that just has that one modem.