Niels Horn's Blog

Random thoughts, tips & tricks about Slackware-Linux, Lego and Star Wars

Using a Nokia CS-10 GSM modem on Slackware

Today I received my new GSM Modem, a Nokia Internet Stick CS-10. It had the size of an overweight pen-drive and can connect (depending on your service-provider) at speeds up to 7.2Mbps (my contract only goes to 2Mbps).
Here is a picture of the modem, taken from the Nokia site:
nokia-cs10
As was to be expected, it comes with software only for Windows and Mac, nothing for Linux. But, then again, who needs software on Linux to use a modem? :) With a bit of knowledge on how Linux works with USB devices, we can do everything by configuring our system the right way.

I have configured several other USB modems on my Slackware systems, so I was sure I could get this one to work as well. I did it in about 20 minutes and here are the basic steps:

1) Switching from “drive” to modem
Many of these USB modems first present themselves as “media”, so that Windows users can install the built-in software from them. Then the installed driver “ejects” the media and the modem presents its real identity as a modem.
On Linux, we have to “eject” the media as well by software, and for this we can use a udev rule.
When plugged in the first time, we can check the ID of the media / modem in a terminal window with lsusb. The result included the following line:

Bus 001 Device 005: ID 0421:060c Nokia Mobile Phones

So this is the ID of the modem presenting itself as removable media.

Now we need a udev rule to “eject” the media. This is what I wrote, based on some previous experience and this guide on writing udev rules:

SUBSYSTEMS=="usb", SYSFS{idVendor}=="0421", SYSFS{idProduct}=="060c", ACTION=="add", RUN+="/usr/bin/eject -s %k", OPTIONS+="last_rule"

Now let’s analyze this rule:

  • SUBSYSTEMS=="usb" – speaks for itself: we are handling a USB device
  • SYSFS{idVendor}=="0421", SYSFS{idProduct}=="060c" – this identifies our Nokia modem
  • ACTION=="add" – means that this rule is only for when the device is added
  • RUN+="/usr/bin/eject -s %k" – calls the “eject” program with the parameters -s (a “SCSI” device, like /dev/s??) and %k (the device name the kernel gave it, like /dev/sdb0 or whatever the “media” is named)
  • OPTIONS+="last_rule" – make sure that later rules for this device have no effect

Save this rule as 91-nokiacs10.rules in /etc/udev/rules.d/
This is the directory where we save all our “custom” rules, as opposed to the standard rules that stay in /lib/udev/rules.d where we should not mess around (as they will be overwritten with the next update of udev).

So now, pull out the modem and plug it in again. If everything is fine, after a short time you can check your usb devices again with lsusb and now the line should be:

Bus 001 Device 005: ID 0421:060e Nokia Mobile Phones

Check that the Product ID has changed from 060c to 060e

2) Check your modem device
Now check your devices with ls /dev/tty* and you should see in the list ttyACM0 and ttyACM1.
Use ttyACM0 in your favorite dialer to connect to your internet provider. I use pppd, but it should work with kpppd or whatever you prefer!

3) Next steps
I actually use a second script that automatically “dials” my provider and connects me to the internet. This is done by creating a second rule in the same file, but this time for the 060e device, starting a small shell script.
This script checks if the ttyACM0 device is available, calls pppd, checks ifconfig if the ppp0 device is up and creates an entry in the routing table.
Since my script is very ugly, I won’t put it here, but it was not that difficult to write, so I’ll leave this as an exercise! :)

Bookmark and Share

This entry was posted on Tuesday, February 23rd, 2010 at 0:09 and is filed under configuration, shell scripting, udev. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Using a Nokia CS-10 GSM modem on Slackware”

  1. Paulo Prado Says:

    I got my Modem working with this instructions. Thank You,
    For Ubuntu 10.04 – I also used the Network manager configurator to setup the dial number and strings for my 3G conetion – BR telco providers already pre-loaded.

  2. Niels Horn Says:

    Glad to be of help!
    I need to take a look at NetworkManager. It does not come with Slackware, but there is a build script for it.

Leave a Reply



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

It may take some time for your comment to appear, it is not necessary to submit it again.