This modem uses the 450 MHz band for wireless internet access. In Scandinavia this mobile internet access network is operated by ice.net. 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/d50-chdev.py" # second rule SYSFS{idVendor}=="16d8", SYSFS{idProduct}=="680a", mode="666", \ RUN="/usr/local/sbin/d50-call" LABEL="d50_end"
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 programd50-chdev.py.
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:
d50-chdev.py: #!/usr/bin/python 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): try: #print "try" fd= open("/dev/d50ms", "rw") break except IOError: #print "except" time.sleep(1) if i >= 9: #print "device /dev/d50ms did not appear" exit(1) # 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)
and
d50-call: #!/bin/sh 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
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.