Linux & Broadband Modems 1/2: D-Link DWM-156

The D-Link DWM-156 is a USB broadband modem that supports HSUPA.

It’s a composite device that appears first as a USB storage device with Windows and Mac drivers, USB ID 0x07d1:0xa800. After driver installation there is a “personality” change and it presents a new USB ID 0x07d1:0x3e02 (alas, not PnP CDC_ACM). Why don’t manufacturers stick to good ol’ CDC_ACM??

The device is too recent to have usb_modeswitch support.

However, bizarro, I found a trick on a web page (in Mandarin):

#in Ubuntu the USB storage device is automatically mounted as /media/CONNMGR
touch /media/CONNMGR/wcdma.cfg

Just creating this file causes USB mode switch. The new device can be driven by usbserial.ko or option.ko:

modprobe usbserial vendor=0x07d1 product=0x3e02
modprobe option
echo -n "07d1 3e02" > /sys/bus/usb-serial/drivers/option1/new_id 

Four device files: /dev/ttyUSB0-3 are created. The data device is /dev/ttyUSB0. When all is well you should see:

modem-manager: (Generic): GSM modem /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-3 claimed port ttyUSB0
modem-manager: Added modem /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-3
modem-manager: Exported modem /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-3 as /org/freedesktop/ModemManager/Modems/1
NetworkManager:   (ttyUSB0): new GSM device (driver: 'generic')
NetworkManager:   (ttyUSB0): exported as /org/freedesktop/NetworkManager/Devices/3
NetworkManager:   (ttyUSB0): now managed

Unfortunately, ttyUSB2 and ttyUSB3 also respond to the MM probes and may be mistakenly identified as the data device. There is a race condition – whichever port answers first gets exported as the modem!

FIXME: How can I fix this? I want ModemManager’s generic modem prober to restrict itself to ttyUSB0??

TODO: figure out udev or usb_modeswitch to do mode switching on plugin, then get MM to identify only /dev/ttyUSB0 as the data port …

TODO: Find out the chipset and AT command set so that I can get signal strength and other cool meta-information on the connection …


One Response

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: