CMTS info

Helpful linux and DOCSIS/CMTS howtos and tips

Getting GSM USB modems to work on Linux

1) Getting the right device(idProduct)

Some(all new) modems have drivers and card reader combined in one chip. Getting the modem to work requires either: disabling all other modes or getting it to switch to modem mode.

With AT commands

First solution is acomplished by AT command sent directly to the modem from windows. List of common AT commands are at the end of the howto.

These don't work well on all modems. On some like ZTE MF636 virtual CD is permamently disabled, and on others like HuaweE3131s-2 there are only disabled for windows.

With usb_modeswitch

Second solution requires either upgrading to latest usb_modeswitch or googlig your idVendor and idProduct obtained through lsusb command. You shoul end up with file similar to this:

DefaultVendor=  0x12d1
DefaultProduct= 0x14fe

TargetVendor=  0x12d1
TargetProduct= 0x1506

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

Save that file as /etc/usb_modeswitch.d/idVendor:idProduct where idVendor and idProduct are those currently appearing. In this example file would be called /etc/usb_modeswitch.d/12d1:14fe .

Next add

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14fe",RUN+="usb_modeswitch '%b/%k'"

line to /lib/udev/rules.d/40-usb_modeswitch.rules

2) Getting your device to appear as a serial port

This step involves loading usbserial or option module and setting correct vendor and product IDs for the module in question.

WARINING: when messing with udev rules always write absolute file pathes, ie /sbin/modprobe is all right, but modprobe is not!

To debug udev execute: udevadm control --log-priority=debug

Using usbserial module

This is not recommended as there are some shortcomings to the usbserial module. However it's simpel to set up and works in most cases.

Code below is from /etc/udev/rules.d/90-some_rule_name file. It loads usbserial module with vendor=0x19d2 product=0x0033 options set

ACTION!="add", GOTO="ZTE_End"
SUBSYSTEM=="usb", SYSFS{idProduct}=="0033", SYSFS{idVendor}=="19d2", GOTO="ZTE_Modem"
GOTO="ZTE_End"

LABEL="ZTE_Modem"
RUN+="/sbin/modprobe usbserial vendor=0x19d2 product=0x0033", MODE="660", GROUP="network"
LABEL="ZTE_End"
Using option module

This is the prefered method. To compile option module both CONFIG_USB_SERIAL_WWAN AND CONFIG_USB_SERIAL_OPTION must be set.

Insted of specifying command to run direclty I've used a wrapper script in this case: /scripts/run_modem with following contents:

#!/bin/bash
/sbin/modprobe option
/usr/bin/echo '12d1 1506' > /sys/bus/usb-serial/drivers/option1/new_id

It's executed with following udev rule:

ACTION!="add", GOTO="ZTE_End"
SUBSYSTEM=="usb", SYSFS{idProduct}=="1506", SYSFS{idVendor}=="12d1", GOTO="ZTE_Modem"
GOTO="ZTE_End"

LABEL="ZTE_Modem"
RUN+="/scripts/run_modem", MODE="660"

LABEL="ZTE_End"
3) Setting PPP connection
x) AT COMMANDS

ZTE - WORKs!

AT+ZCDRUN=8 //disables virtual CD and card reader
AT+ZCDRUN=9 //reenables

Template: designsbydarren.com on license
All trademarks belong to their respective owners. All materials presented here for informational purposes only.