Auto dial for C-motech D-50 modem

This modem uses the 450 MHz band for wireless internet access. In Scandinavia this mobile internet access network is operated by The following rules and scripts constitute an auto-dialer: when the USB modem is inserted the system automatically connects to the network.

The USB modem acts as a memory stick when first inserted into the PC. The device may then be switched into a modem mode. The connection with the network server is via the PPP-protocol, so uses standard localhost pppd server.

I use the following scripts and rules to achieve this on my Kubuntu laptop.

I use one udev rule for acting when the modem is first inserted. This rule triggers a program that switch over from mass memory to modem mode.A second rule is triggered when the modem appears, this rule startsthe ppp dæmon via wvdial.

The rules are contained in the/etc/udev/rules.d/10-d50.rules file. Each rule must be aone-liner without any line breaks

SUBSYSTEM!="usb_device", ACTION!="add", GOTO="d50_end"

# C-motech modem

# First rule
SYSFS{idVendor}=="16d8", SYSFS{idProduct}=="6803", mode="666", \
SYMLINK="d50ms" RUN="/usr/local/sbin/"

# second rule
SYSFS{idVendor}=="16d8", SYSFS{idProduct}=="680a", mode="666", \


When the modem is inserted it enumerates with the given vendor and product ID. The mass storage is linked to /dev/d50ms by the udev system, given all users read/write access and starting the

This program switches the device into a modem with another product ID. After the new enumeration the second rule starts another programd50-call. The modem driver also creates the /dev/ttyACM0modem device.

So the first step to get a working automatic dial-up for this modem is to create the rule file as given above.

The next step is to create the two programs:

import os
import struct
import fcntl
import time

def findusb(prod):
    return os.system("lsusb |grep -i 16d8:%s >/dev/null"%prod)
for i in range(0, 10):
       #print "try"
       fd= open("/dev/d50ms", "rw")
    except IOError:
       #print "except"
       if i >= 9:
          #print "device /dev/d50ms did not appear"

# we have the opened device, now change it into a modem

inlen= 9
outlen= 0
data= 0xff
datastr= "RDEVCHG1"
sic= struct.pack('IIB8sB', inlen, outlen, data, datastr,0)
fcntl.ioctl(fd, 1, sic)



wvdial --config /etc/ppp/d-50config &

Now, generate the configuration file by running, as root:

echo "--> D-50 Linux Connection\n"
rm -rf /tmp/D-50config tmp/wvdialconf_log
wvdialconf /tmp/D-50config > /tmp/wvdialconf_log
echo "Carrier Check= no\nStupid Mode= yes" >> /tmp/D-50config
echo "Phone = #777\nUsername = cdma\nPassword = cdma" >> /tmp/D-50config
rm -rf /tmp/wvdialconf_log

and copy /tmp/D-50config to /etc/ppp.In my case this file contains:

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB ModemISDN = 0
Init1 = ATZModem = /dev/ttyACM0
Baud = 460800
Carrier Check= no
Stupid Mode= yes
Phone = #777
Username = cdma ; the same for all users
Password = cdma ; the same for all users

As always when editing or copying files into the /dev and /etc you must have root permission, use sudo.

Now, if everything work you will see the /dev/d50ms and/dev/ttyACM0 files, and you should see the ppp-network when doing a

cat /proc/net/dev

1 Response to “Auto dial for C-motech D-50 modem”

  • Hi,
    I think there is a typo in line 4 on /etc/ppp:

    4: Init1 = ATZModem = /dev/ttyACM0

    This is actually
    Init1 = ATZ
    Modem = /dev/ttyACM0
    I guess.

Leave a Reply