Thursday, March 12, 2009

Dell 5530/Ericsson f3507g on Linux

A few months back I posted a howto guide on getting this mobile broadband card working with Linux, what I failed to mention was I continued to work on these scripts. I feel it is appropriate to post a status update on what I use now especially given there appears to be no further updates on the NetworkManager front.

I no longer use UMTSMon as I found it relied on AT+CSQ for the signal quality and during UMTS and HSPA connections, the f3507g/dell 5530 returns either the previous GPRS value or 99,99 which UMTSMon considers as no connection available.

I've used a simplified wvdial.conf scripts and now do the rest of the radio work using python.

wvdial.conf

# Author: Barry John Williams
# Creative Commons Attribute-Share Alike 2.5 UK:Scotland Licence

[Dialer defaults]
New PPPD = yes
Stupid Mode = 1
Modem Type = ACM Modem
Modem = /dev/ttyACM1
Init1 = AT
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"ip","internet"
Baud = 460800
ISDN = 0
Phone = *99***1#
Password = web
Username = web


You will need to update the Init3 command for your own provider and the password and username for your service. In this case it is set up for Vodafone UK.

To dial up to the web I currently use ppptray which is a python app and displays an icon in your notification area which you click to toggle connectivity. Behind the scenes it calls pon and poff which in turn use wvdial to enable the connection.

I modify my pon and poff scripts to just call the default wvdial configuration. You can find pon and poff in /usr/bin.

pon

#!/bin/sh

# Author: Barry John Williams
# Creative Commons Attribute-Share Alike 2.5 UK:Scotland Licence

PATH=/bin:/usr/bin:/usr/sbin:/sbin
wvdial >> /var/log/ppp.log 2>&1


poff

#!/bin/sh

# Author: Barry John Williams
# Creative Commons Attribute-Share Alike 2.5 UK:Scotland Licence

PATH=/bin:/usr/bin:/usr/sbin:/sbin
kill `lsof /dev/ttyACM1 | grep wvdial | awk '{print $2}'`


I have written a python program (dell5530_mon.py) which monitors the broadband card on /dev/ttyACM0. It polls the card every few seconds requesting the current network provider, access type and signal quality (even for UMTS connections). This information is made available in the /tmp directory:











MB_NETWORKThe current network provider (e.g. Vodafone UK)
MB_SIGNALThe current signal strength represented using characters from the 'PizzaDude Bullet' font (downloadable from dafont.com)
MB_TYPEThe current network access type (GPRS, 3G, 3G+, NONE)


These files are only updated if there is a change from the previous value, additionally my /tmp folder is on a ramdisk to save SSD writes so you may want to either do this or move the files to another volatile location.

dell5530_mon.py also uses pynotify to display a notification if the network provider changes or the connection type changes. This is useful if you are travelling through different signal areas, you are notified when the signal is lost or moves from 3G to 3G+ for example.

I run the monitor on startup automatically switching the radio on, it also enables the radio whenever I resume my machine from standby, this just leaves clicking the ppptray button to go online. I intend to bring this functionality within dell5530_mon.py but haven't done so yet. My goal is to automatically connect to the web if no other connection is available and provide the signal strength in the notification area (with ability to toggle radio and connection states from a context menu).

In the meantime, I use conky to read the values stored in the /tmp directory to display the current network operator, connection type and signal quality in addition to receiving the notifications.

I hope people find this useful, all the code is made available under a creative commons licence and can be downloaded below:

Dell 5530 Python Monitor (dell5530_mon.py)

Note this also comes with a radio.py library which can be used as a standaline program to get the status of the radio and enable/disable it. At the moment I've configured dell5530_mon.py to enable the radio in 3G only mode (since mine kept falling back to a GPRS signal despite 3G being available). If you want it to connect to both types of networks, you will need to change a line in dell5530_mon.py from radio.on(ser,radio.UMTS) to radio.on(ser,radio.PREFER).

Once the monitor has detected a network operator, it tries to enable the GPS functionality on /dev/ttyACM2. However, this appears to be a bit hit and miss...

Useful Links:

Labels: , , , , , ,


// posted by Barry @ 08:28 13 Comments Links to this post

Monday, December 01, 2008

Howto: Ubuntu 8.10, Dell 5530, 3G/WWan and GPS

There is an updated howto on the Dell 5530 using my own python based monitoring tool at http://www.bjw.me.uk/2009/03/dell-5530ericsson-f3507g-on-linux.html

Introduction

Here is a Howto document for getting the Dell 5530 wwan card working along with the onboard GPS under Ubuntu 8.10. This card does not work conveniently with the bundled Network Manager software, but replacing NetworkManager with other utilities will give the ability to get online using a pretty GUI and not have to resort to using wvdial and the command line...

It should also work with the Ericsson f3507g as I believe the Dell 5530 is a rebadged version of this module.

Check Hardware

First you need to check the modem is detected correctly. On my computer, the modem is detected out of the box by the cdc_acm module and exposes three serial ports (/dev/ttyACM[0,1,2]) for communication. Check by running:

dmesg | grep ACM

Mine shows the following:


[ 34.385302] cdc_acm 1-6:1.1: ttyACM0: USB ACM device
[ 34.390039] cdc_acm 1-6:1.3: ttyACM1: USB ACM device
[ 34.401983] cdc_acm 1-6:1.9: ttyACM2: USB ACM device


Install and Configure wvdial

Next, you need to ensure you can get online using the terminal and wvdial - you will only need to use wvdial to switch the radio on and off - something that can easily be added to Ubuntu's Gnome menu.

Using apt, install wvdial:

sudo apt-get install wvdial

I have written a wvdial script which uses /dev/ttyACM0 for reading the signal quality and switching the device on and off. /dev/ttyACM1 is used exclusively for ppp and /dev/ttyACM2 is used exclusively for the GPS.


[Dialer Defaults]
New PPPD = yes
Stupid Mode = 1
Modem Type = USB Modem

#[Dialer PIN]
#Init1 = AT+CPIN=

[Dialer signal]
Modem = /dev/ttyACM0
Init1 = AT+CSQ
Init2 = AT+COPS?

[Dialer gps]
Modem = /dev/ttyACM2
Init1 = AT*E2GPSCTL=1,2,1
Init2 = AT*E2GPSNPD

[Dialer on]
Modem = /dev/ttyACM0
Init1 = AT+CFUN=1

[Dialer off]
Modem = /dev/ttyACM0
Init1 = AT+CFUN=4

[Dialer connect]
Modem = /dev/ttyACM1
Init1 = AT
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Baud = 460800
ISDN = 0
Phone = *99***1#
Password = web
Username = web


This script allows the following commands to be run:






wvdial onSwitch Radio On
wvdial offSwitch Radio Off
wvdial signalShow signal quality, network provider and signal connection (HSPA/3g/GPRS)
wvdial connectConnects to the mobile network
wvdial gpsEnables GPS NMEA message output on /dev/ttyACM2 outputting a new message every 2 seconds


Make sure you can switch your radio on and connect to the internet. If so, you should also be able to switch the GPS on without effecting your network connection. As a final check, run wvdial signal and you should get information about the signal strength - this is crucial that you can get this information whilst the connection is open as it will help later with UMTSMon.

If you find you cannot connect to the network with wvdial connect without being root or using sudo. Ensure you are in the 'dip' group. You can do this through the "Users and Groups" application in the the Adminstration menu, make sure you unlock to get superuser privileges, highlight your login and press the "Properties" button. In the "User Privileges" tab you can tick the box next to "Use Modems", I also clicked a few more like "Dial out using a modem" which I think adds you to the 'dialout' group which appears to be completely irrelevant to pppd and I presume NetworkManager since it's unchecked by default - WTF?

You might need to logout and back in again or re-source your shell. Check you can dial out using wvdial. This is important so you don't need to run UMTSMon as sudo.

Install UMTSMon

Download a pre-built binary of UMTSMon for Debian from the following page:
http://people.debian.org/~winnie/umtsmon/. Note I had to use dpkg to install this file, the graphical gdebi failed for some reason.

sudo dpkg -i umtsmon_0.9-1_i386.deb

Once it is installed it should appear in your "Internet" Gnome application sub-menu.

Before you run umtsmon, switch your radio on using wvdial on.

I initially ran umtsmon from the command line so run it using umtsmon. During first run it will setup an rc file in your home directory at ~/.umtsmon/umtsmonrc. You may have to add a profile for your network provider - I use Vodafone and found the information I needed online. Once you have the information you need, add it using the Connection>Manage Profiles... menu item. Add a new profile and fill in the information you need. Additionally you can set usage limits for this profile on this page.

Hopefully you will see signal strength in the umtsmon window, but don't click connect just yet as you want to ensure wvdial and umtsmon are compatible. This is so you can switch the radio off, use GPS and view signal strength whilst connected. The first time I used UMTSMon, it used the same serial port for everything and I couldn't see signal strength or switch the card off once online. Close UMTSMon and in the command line edit the following file ~/.umtsmon/umtsmonrc using your favourite editor! Ensure the device section entries for ATPortName and PPPPortName looks like this:


ATPortName=/dev/ttyACM0
PPPPortName=/dev/ttyACM1


This ensures the UMTSMon config is compatible with wvdial.

Add the following entries to your Gnome menu:


wvdial on
wvdial off
wvdial gps


All with options to run in the terminal. The last GPS option will hold onto the terminal for the moment, but once you kill it, the GPS will continue to write NMEA statements for read on /dev/ttyACM2.

GPS

You will need to install gpsd using apt, then run using gpsd /dev/ttyACM2.

I used tangoGPS which I installed from their website at http://www.tangogps.org. Tango can also be configured to use Google Maps data in addition to OpenStreetMap.

NetworkManager alternative

To stop the NetworkManager applet nagging you about the new card it can't use, get rid of it and try Wicd - a much cleaner and faster utility for accessing WiFi networks.
http://wicd.sourceforge.net/

Credits

http://ubuntu-virginia.ubuntuforums.org/showthread.php?t=941079
http://ubuntuforums.org/showthread.php?t=979587
http://www.nabble.com/X301-Ericsson-Modul-f3507g-AT-Command-reference-td20152955.html
http://www.pharscape.org/vodafone-3g-umts-how-to.html#_Toc83808170

Labels: , , , , ,


// posted by Barry @ 21:16 27 Comments Links to this post

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]