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, A newer version of the script with a Notification Area GUI is available here: http://blog.bjw.me.uk/2009/08/dell-5530-ericsson-f3507g-3g-signal.html

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: