Vodafone 3G setup

From The World according to Vissie
Jump to navigation Jump to search

OK, so I just setup my new Vodafone Huawei 3g HSPA+ USB (K4505-Z) device. And it was easy in the end!

So under Gentoo Linux I just needed usb_modeswitch. It is masked so fist step is to unmask it

echo "sys-apps/usb_modeswitch ~x86" >> /etc/portage/package.keywords

Then install it....

emerge -av sys-apps/usb_modeswitch 

That was it. With usb_modeswich installed, it auto switches. So I just unplugged and re plugged it to work.

I also got gammu to work. See : http://tensixtyone.com/perma/howto-send-sms-using-a-huawei-e160g-and-debian

echo "boo" | gammu --sendsms TEXT [recipient mobile number]
ssh -p1234 192.168.1.123 "echo "HEEE HAAAA" | gammu --sendsms TEXT 0123456789"

To send from another PC on the LAN, I simply used ssh as a start. Worked great! I did get a "Error opening device, you don't have permissions" in the beginning. I fixed that by changing the owner on the port that I use on my router:

chmod +rw /dev/ttyUSB0

Next I will have to setup a sms gateway: http://polos-online.blogspot.com/2009/11/sms-gateway-with-gammu-on-linux.html

  1. How to send SMS's
  2. How to setup wvDial
  1. UMTSmon
  2. SMS over 3G and Bluetooth from Python
import serial
def SendVia3G():
     ser = serial.Serial(’/dev/ttyUSB2′, 115200, timeout=1)
     ser.write(’ATZ\r’)
     ser.write(’AT+CMGF=1\r’)
     ser.write(’AT+CMGS=”+353868276XXX”\r’)
     ser.write(’SMS over 3G but from Python\n’)
     ser.write(chr(26))
     line = ser.readline()   #read a ‘\n’ terminated line
     print line
     ser.close()

Signal levels as reported by command

at+csq
comgt
 Trying list of devices
 SIM ready
 Waiting for Registration..(120 sec max)
 Registered on Home network: "23203",2
 Signal Quality: 17,99
sudo comgt -d /dev/ttyUSB0 info
sudo comgt -d /dev/ttyUSB0 sig

Signal Quality: 21,99

comgt -d /dev/ttyUSB0 reg Waiting for Registration Registered on Home network: "T-Mobile",0

sudo comgt help

For a sms gateway, I use gammu This seems to be a sms answering pc

vim: /etc/wvdial.conf
[Dialer Defaults]

[Dialer vodafone]
Phone = *99***1#
Username = vodafone
Password = vodafone
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyUSB0
Baud = 460800
Init2 = ATZ
# Init3 = ATE0V1&D2&C1S0=0+IFC=2,2
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init4= at+cops=3,2
ISDN = 0
Modem Type = Analog Modem
Init5 = AT+CGDCONT=1,"IP","internet";

[Dialer nokia]
Phone = *99***1#
Username = mtn
Password = mtn
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyACM0
Baud = 460800
Init2 = ATZ
Init3 = ATE0V1&D2&C1S0=0+IFC=2,2
ISDN = 0
Modem Type = USB Modem
Init5 = AT+CGDCONT=1,"IP","internet";

[Dialer nokia2]
Phone = *99***1#
Password = 0836805557
Username = 12345
Stupid Mode = 1
Dial Command = ATDT
AT+CPIN=08008
Modem = /dev/ttyACM0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
Init4 = AT+CGDCONT=1,"IP","mymtn","",0,0;