Friday, October 21, 2011

Getting a USB GSM modem working on Ubuntu (part I)

I have the USB GSM modem working on a MAC, and have been using it to send SMS. Now I need to get the same modem working on a Ubuntu 10.04.


When I first plug the modem into the USB port, the modem is detected as a CD-ROM device. A CD-ROM icon appears on the desktop. Ubuntu also detects the modem as a storage device, as I can tell, from issuing a few commands.
  • the device appears as /dev/sr# (# is number which varies), a byte stream device
  • the command "lsusb" output shows the device as "Bus 002 Device 005: ID 1c9e:f000." From what I read on the Internet, "f000" indicates it is a memory device.
  • the command "ls /dev/disk" shows there is disk "by-label" of "Modem", and "by-id" of usb-USBModem_Disk_1234567890ABCDEF-0:0.
So all evidences show the modem isn't detected as a modem. Via Google search, I found out it is the effect of the ZeroCD feature that the modem manufacturers have been putting in the modem. Here is a wiki description on it. Essentially, the USB modem has a bit flash storage which stores the driver of the modem. When the modem is plugged into a Windows or MAC machine, it first runs as a storage device which auto-installs the driver, the driver then switches the modem out of the storage mode into the modem mode. On a Ubuntu, the driver doesn't run and install, therefore the modem remains as a storage device.

To switch the USB modem from the storage mode and to the modem mode, I found the Sakis3G script. It is easy to run and works very well.

$ gunzip sakis3g.zip

$ sudo cp sakis3g /usr/bin

$ cd /usr/bin

$ ls -l sakis3g
-rw-r--r-- 1 root root 214619 2011-10-18 17:58 sakis3g

Change the group of sakis4g to "dialout" which has all the users who are allowed to access the modem
$ sudo chown root:dialout sakis3g

$ ls -l sakis3g
-rw-r--r-- 1 root dialout 214619 2011-10-18 17:58 sakis3g

$ sudo chmod 750 sakis3g

$ ls -l sakis3g
-rwxr-x--- 1 root dialout 214619 2011-10-18 17:58 sakis3g

I have to install a few dependencies in order to run Sakis3G
$ sudo apt-get install ppp sharutils xterm 9menu xosd-bin wget

I create a Sakis3G configuration file under /ect/sakis3g.conf, contained the following switches
--console
--sudo
--debug

These switches configures Sakis3G to run in terminal console, as root, and with detailed debug messages.

To run Sakis3G
$ sakis3g switchonly

Sakis3G spills out lots of debug messages. At the end, there should be a message like this

Modem switched to 1c9e:9603

In addition, the CD-Rom icon disappears from the desktop. Running the same set of commands again to verify the mode of the mode shows

  • the path /dev/sr1 has disappeared, and /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2, which are character stream devices, have appear. (Note sometimes, the numbering may be USB1, USB2, and USB3)
  • the command "lsusb" shows the device as "Bus 002 Device 006: ID 1c9e:9603." The device ID has changed from 1c9e:f000 to 1c9e:9603
  • the command "ls /dev/disk/by-id" still shows the disk usb-USBModem_Disk_1234567890ABCDEF-0:0, but the path "/dev/disk/by-label" no longer exists


So voila, the USB GSM modem has been successfully switched to the modem mode!

Each time the USB modem is power-cycled due to the system reboots or wakes up from hibernation, the modem returns to the initial storage mode. So the Sakis3G script must be run again to switch the mode.


Here are the model of the modem and the version of Ubuntu that I'm using:
GSM modem: Zoom 4595 3G tri-band USB modem
Ubuntu: 10.04.3 LTS

Now that the modem is running as a modem under Ubuntu, the next step is to control it and send SMS via it. That'll be Part II.

No comments:

Post a Comment