This is an updated version of the guide to using Sonofon Mobile Broadband with Ubuntu that I made in May 2008.

The modem provided by Sonofon is an USB stick marked as an Option Icon 225 HSDPA and is by default detected as an USB CD-ROM (which holds the Windows drivers).

Installing the driver

First you need to compile and install the drivers needed to use the modem:

First make sure that your build environment is set up

$ sudo apt-get install build-essential linux-headers-$(uname -r)

Download and unpack Ozerocdoff, then install it

$ tar zxvf udev.tar.gz
$ cd udev
$ ~/udev 
$ sudo make install

then reload the udev rules to make Ozerocdoff active

$ sudo udevcontrol reload_rules

Add the mainstream “option” kernel module to the blacklist and unload it

$ echo "blacklist option" | sudo tee -a /etc/modprobe.d/blacklist
$ sudo modprobe -r option

Now unpack the HSO driver and install it

$ tar zxvf hso-1.6.tar.gz
$ cd hso-1.6
$ make
...
$ sudo make install
$ sudo find /lib/modules -name hso.ko -exec rm {} ;

The driver is now ready for use – Test it by inserting the modem and wath the kernel log

Dec 27 12:20:34 farscape kernel: [  387.392589] usb 4-2: new full speed USB device using uhci_hcd and address 2
Dec 27 12:20:34 farscape kernel: [  387.551563] usb 4-2: configuration #1 chosen from 1 choice
Dec 27 12:20:36 farscape kernel: [  388.788461] usb 4-2: USB disconnect, address 2
Dec 27 12:20:37 farscape kernel: [  390.265139] usb 4-2: new full speed USB device using uhci_hcd and address 3
Dec 27 12:20:37 farscape kernel: [  390.428090] usb 4-2: configuration #1 chosen from 1 choice
Dec 27 12:20:37 farscape kernel: [  390.643070] usbcore: registered new interface driver libusual
Dec 27 12:20:37 farscape kernel: [  390.680170] hso: /home/alj/dev/hso-1.6/hso.c: 1.6-Option Option Wireless
Dec 27 12:20:37 farscape kernel: [  390.680980] usbcore: registered new interface driver hso

Hopefully you now have the needed devices

$ ls -l /dev/ttyHS*
crw-rw---- 1 root dialout 251, 0 2008-12-27 12:20 /dev/ttyHS0
crw-rw---- 1 root dialout 251, 1 2008-12-27 12:20 /dev/ttyHS1
crw-rw---- 1 root dialout 251, 2 2008-12-27 12:20 /dev/ttyHS2
crw-rw---- 1 root dialout 251, 3 2008-12-27 12:20 /dev/ttyHS3

Using the modem

There are at least three ways of getting online using the modem

  1. HSOconnect
  2. NetworkManager
  3. wvdial

There a number of graphical frontends to pppd that I haven’t looked at since I do not need them.

HSOconnect

Download HSOconnect and HSOlink, then install them both

$ sudo dpkg -i hso*.deb

then either start it from the Network menu or run

$ python -mhsoc

after entering the PIN code, select Copy Connection Profile and create a new one called Sonfon, then edit the profile:

Connection: Sonofon
APN: internet
Username: <empty>
Password: <empty>

HSOconnect

After connecting you have a network interface called hso0

NetworkManager

If you have NetworkManager newer than version 0.70 (which is included in Ubuntu 8.10) it includes support for HSO modems and Sonofon (as well as a lot other ISPs). After inserting the modem simply click on the NetworkManager tray icon, select Sonofon and with in a couple of seconds you should be connected

Since NetworkManager uses pppd to do the actual connection you will have a ppp0 interface after connecting.

wvdial

Sometimes using a graphical interface for the dialing is not possible.

The answer is: wvdial.

To avoid later headaches I recommend disabling the PIN for as long as you are going to use the modem with wvdial – The easist way of doing this is connecting the modem to a Windows machine and then use the Windows-software to disable the PIN code.

Install wvdial

$ sudo apt-get install wvdial

Edit /etc/wvdial.conf like this

[Modem0]
Modem = /dev/wmodem0
Baud = 460800
SetVolume = 0
Dial Command = ATD
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = ATM0
FlowControl = CRTSCTS

[Dialer sonofon]
Username = sonofon
Password = sonofon
Phone = *99***1#
Stupid Mode = 1
Init1 = ATH
Init2 = ATE1
Init3 = AT+CGDCONT=1,"IP","internet","",0,0
Inherits = Modem0

Try connecting

$ wvdial sonofon
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATH
ATH
OK
--> Sending: ATE1
ATE1
OK
--> Sending: AT+CGDCONT=1,"IP","internet","",0,0
AT+CGDCONT=1,"IP","internet","",0,0
OK
--> Modem initialized.
--> Sending: ATD*99***1#
--> Waiting for carrier.
ATD*99***1#
CONNECT 7200000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Mon Dec 29 15:46:01 2008
--> Warning: Could not modify /etc/ppp/pap-secrets: Permission
denied
--> --> PAP (Password Authentication Protocol) may be flaky.
--> Warning: Could not modify /etc/ppp/chap-secrets: Permission
denied
--> --> CHAP (Challenge Handshake) may be flaky.
--> Pid of pppd: 6519
--> Using interface ppp0
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> local  IP address 10.221.123.230
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> remote IP address 10.64.64.64
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> primary   DNS address 212.88.64.14
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]
--> secondary DNS address 212.242.40.3
--> pppd: ðš[06][08][10]©[06][08]| š[06][08]

It works.

In my case I needed to use the new ppp0 interface as the default gateway while still being connected to my internal network. Unfortunately wvdial will not overwrite an existing default
route.

To get around this I created this script:

#!/bin/bash

DEF_GW=$(route -n | awk '{ if ($1=="0.0.0.0") print "route add default gw " $2 " dev " $8 }')
route del default

wvdial sonofon

$DEF_GW