tensixtyone

Rants of Andrew Williams / Nik_Doof

Archive for the ‘huawei’ tag

Howto: Send SMS using a Huawei E160G and Debian

with 2 comments

People who use their Huawei E160G on Three will know that in the Windows client you can send and receive SMS, this will come at some minor cost of £0.10 per SMS, and you can add bundles onto your mobile broadband account to make this cheaper.

Similar functionality can be achieved in Linux, and it’s very useful if your like me and want to drop someone a message when you don’t have your phone around.

For this we’ll be using Gammu, which is a toolset for managing phones via the AT GSM command set. It was originally forked from Gnokii, which was a similar toolset for Nokia handsets. As the E160G opens a serial port with access to the AT command set this is a relatively easy tool to setup.

First of all, we need to grab the packages. As these are standard Debian packages you should have no issues.

# sudo apt-get install gammu

Next, we need to configure Gammu to pickup the correct device. Check your dmesg for the serial port:

$ dmesg|grep tty
[12321.308078] usb 5-3: GSM modem (1-port) converter now attached to ttyUSB0
[12321.308275] usb 5-3: GSM modem (1-port) converter now attached to ttyUSB1

Edit ~/.gammurc, or run gammu-config to change the device settings. Your ~/.gammurc file should look similar to:

[gammu]
port = /dev/ttyUSB0
model =
connection = at19200
synchronizetime = yes
logfile =
logformat = nothing
use_locking =
gammuloc =

Give it a test by getting all the SMS from the device:

# gammu getallsms

This should bring back all the SMS currently stored on the stick, which should include your login details for the Three website (unless you’ve deleted them). To send a SMS use the “sendsms” command:

$ gammu sendsms text 07874454543
Enter message text and press ^D:
Test Message!!!!!1!
Sending SMS 1/1....waiting for network answer..OK, message reference=2

Gammu has a lot more tools and options to explore, now you have the basic config you can setup a SMSD, which can expose the ability to send SMS to a network. Also, Gammu has a python interface so you can possibly build your own frontend client for sending SMS. For more details explore the Gammu Wiki.

Written by Andrew Williams

October 17th, 2008 at 11:53 am

Howto: Debian Lenny & Huawei E160G

with 12 comments

So, in my last post I described how it was using the E160G with Debian. All in all it’s very good and i’ve not experienced any major issues, bar a few minor apt-get and NetworkManager issues. So, heres a quick rundown of how to get it on your machine.

So first, you need to get the hardware to work correctly under Debian. Plug in your E160G and check dmesg to see if the device recognises correctly. If you see ttyUSB0/ttyUSB1 appear you can skip this step.

First, you need to download USB_Modeswitch:

# wget http://www.draisberghof.de/usb_modeswitch/usb_modeswitch-0.9.4.tar.bz2
# tar jxvf usb_modeswitch-0.9.4.tar.bz2
# cd usb_modeswitch-0.9.4/
# ./compile.sh

Now you have the usb_modeswitch program, as this will be executed by udev it needs to be in a sensible location, personally i’d copy it to /usr/local/sbin/

# cp usb_modeswitch /usr/local/sbin/

Also, you need to grab the latest config file from the usb_modeswitch website and put it into /etc

# wget http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.conf
# sudo mv usb_modeswitch.conf /etc/

Now, by default the config file comes with the section commented out, so edit the file and uncomment the section for the E220 (which is essentially the same device).

# sudo $EDITOR /etc/usb_modeswitch.conf

One last step, you need to add a small configuration file to udev to detect the E160G and run usb_modeswitch, put this file in you /etc/udev/rules.d/ folder:

SUBSYSTEM=="usb", SYSFS{idProduct}=="1003", SYSFS{idVendor}=="12d1",
  RUN+="/usr/local/sbin/usb_modeswitch"

Restart udev, and plug in your E160G…

sudo /etc/init.d/udev restart

and you should see something similar to:

[   16.085904] usb 5-3: GSM modem (1-port) converter now attached to ttyUSB0
[   16.086033] usb 5-3: GSM modem (1-port) converter now attached to ttyUSB1

So, the device is detected and you have your USB ports, first a quick overview. The E160G shows two serial ports, one is a data port, the other is for control signals. NetworkManager only makes use of one of these ports but the Vodafone Connection Manager uses both. Now you have a choice, install Network Manager 0.7 to gain native GPRS/UMTS data support or use another package. I went for Network Manager, while it’s still in beta and i’ve had a few run-ins in the past with it I decided to give it a go.

So, it was a simple case of adding the 0.7 repositories to /etc/apt/sources.list, updating, then installing the needed packages.

# echo "deb http://debs.michaelbiebl.de/ unstable main" >> /etc/apt/sources.list
# apt-get update
# apt-get -t unstable install network-manager

You might need to remove any old Network Manager packages before you do this, as network-manager-openvpn collides with the new package.

Hopefully thats give you the overview you needed, and you should be up and running!

Written by Andrew Williams

August 7th, 2008 at 11:08 pm