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:

13 comments:

Anonymous said...

Hi there and thanks for the research. Facing a related problem I'd like to ask if you had any ideas. The problem is the same Ericsson modem, but built into a LG x110 netbook (which is essentially a relabeled MSI Wind), and I am using opensuse 11.1 not ubuntu, relying on network manager for the uplink. Have you got any ideas on how to make that configuration work? Other suggestions?

Thanks!

Barry said...

NetworkManager doesn't support the f3507g (yet). It is down to a single command, NM is attempting to send 'ATZ' to reset the cards assuming every modem in the world supports this. For some reason, Ericsson left the command out and NM doesn't work. If you have the source for NM you could change the AT command from "ATZ" to "AT" and it would work for you. Otherwise, you will have to use something else instead.

In my case that is using Wicd for WiFi and wvdial/dell5530_mon.py/ppptray for the mobile broadband connection.

Whilst this howto was written with Ubuntu in mind, it should apply to any Linux distribution.

Hope this helps!

Anonymous said...

Hi Barry and thanks for the suggestion! Looking some further, I found that opensuse's Yast configuration tool does see the modem, identifies it correctly and accepts configurations. So I changed the ATZ in the configuration, entered *99# as phone number, 3G as username, 3G as password (my provider being Telia), and tried to start it. Network manager doesn't see the modem. Kinternet does. trying to start a connection, I got the following log:


SuSE Meta pppd (smpppd-ifcfg), Version 1.59_SVN31 on linux-gyak.
Status is: disconnected
trying to connect to smpppd
connect to smpppd
Status is: disconnected
Status is: connecting
pppd[0]: Plugin passwordfd.so loaded.
pppd[0]: speed 480000000 not supported
pppd[0]: --> WvDial: Internet dialer version 1.60
pppd[0]: --> Initializing modem.
pppd[0]: --> Sending: AT
pppd[0]: AT
pppd[0]: OK
pppd[0]: --> Sending: AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
pppd[0]: AT Q0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
pppd[0]: OK
pppd[0]: --> Sending: ATM1
pppd[0]: ATM1
pppd[0]: OK
pppd[0]: --> Modem initialized.
pppd[0]: --> Sending: ATDT*99#
pppd[0]: --> Waiting for carrier.
pppd[0]: ATDT*99#
pppd[0]: ~[7f]}#@!}!}!} }9}#}%B#}%}(}"}'}"}"}&} } } } }%}&"8kMXV~
pppd[0]: CONNECT
pppd[0]: --> Carrier detected. Chatmode finished.
pppd[0]: Script /usr/bin/wvdial --chat --no-syslog --config /var/run/smpppd/chat-modem0.conf smpppd finished (pid 24973), status = 0x0
pppd[0]: Serial connection established.
pppd[0]: speed 480000000 not supported
pppd[0]: Renamed interface ppp0 to modem0
pppd[0]: Using interface modem0
Status is: connecting
pppd[0]: Connect: modem0 <--> /dev/ttyACM0
pppd[0]: CHAP authentication succeeded: Congratulations!
pppd[0]: CHAP authentication succeeded
pppd[0]: LCP terminated by peer
pppd[0]: Hangup (SIGHUP)
pppd[0]: Modem hangup
pppd[0]: Connection terminated.
Status is: disconnected
pppd[0] died: A modem hung up the phone (exit code 16)


So the modem can be activated and it builds up a connection. And then it hangs up again. Why? One thing I noted is that I found no way to enter the PIN, which the SIM module requires. Neither could I enter the provider (there are several on air here). Ideas?

wintermute000 said...

Hi barry

I'm trying to follow your guide and have gotten as far as wvdial dialing and getting the famous error below

"The PPP daemon has died: A modem hung up the phone (exit code = 16)"

When I look at /var/log/messages, I see that CHAP succeeds, then there is some kind of LCP error and the far end disconnects.

The fact that CHAP succeeds suggests that its not username/pw issue and the SIM does not have a PIN (I don't have to enter one to use it in windows).

Do you have any suggestions? I'm using the init strings you suggested plus the third line suggested by the last blogger on your previous article.

Barry said...

I had the same problem you shortly after sniffing out the AT commands from Ericsson's software in windows.

At that time I wasn't using the AT+CGDCONT command which is included in this latest wvdial.conf. Once I added it PPP received an IP address.

You will need to change the setting to that of your own network. On Vodafone UK the APN is 'internet', so you will need to change this text to suit your own network. Similarly you will need to change the username and password used for your own network this is normally provided along with the APN setting.

Dash Raven said...

Hi There

So, I've created the wvdial like you have, but I can't use the dell5530_mon.py and radio.py. How do you use it?

I just decompressed the file, and when I try to run, no luck...

Also how to manage the gps and turn the radio on?

I understood the first tutorial but not this one...

Barry said...

Can you post the error returned when you run dell5530_mon.py? It could be a missing library or a file the script can't find.

Taff said...

Barry,
This is very cool! I have a Dell D420 on Windoze for which the f3507g isn't supported - the manager won't install. Do you know of an alternative manager for XP that would control it? The drivers load without error. I can't find a generic Ericsson WWAN manager.
Otherwise I'll have to downgrade to the old Option PC Card.
Regards,
Taff

slavko321 said...

I have the f3507g in a t400 and before i can use it i have to turn it on - send AT+CFUN=1. Without this the modem is visible to the OS and i can run wvdial, but it just disconnects after trying to connect.

So i added this to the wvdial.conf as an init string.

AT+CFUN=4 disconnects from the network.

Sebastian said...

Hello @all, Hello Barry,

this blog is the only one I can found in relation to use onboad UMTS f3507g on Linux. How to set up is descripted very easy, but I haven't got this running yet.

I'm using a Lenovo T400 with OpenSuse 11.1 and kernel 2.6.27.42-0.1-pae.

The script's from Barry I have implemented as followed. Also I have considered the comment from slavko321 to add the init string: "AT+CFUN=1".

Further I have tried different baud rates and APN's. The Username and Password named below is correct and checked in a Windows environment with a manually umts connection.

The PIN of SIM card is disabled and I'm very wondering why I can't get a connection.

In /var/log/ppp.log I see the same error message as posted already:
The PPP daemon has died: A modem hung up the phone (exit code = 16)

Also I see the related error: "LCP terminated by peer" in /var/log/messages.

Maybe you can check my configation, the scripts and logs posted below. And anyone has an idea to get this under control.

Many thanks in advance for your support

Greetings

Seb

# cat pon.sh
##################################################
#!/bin/ksh
PATH=/bin:/usr/bin:/usr/sbin:/sbin
wvdial --config=/home/slu/wvdial.conf >> /var/log/ppp.log 2>&1

# cat poff.sh
##################################################
#!/bin/ksh
PATH=/bin:/usr/bin:/usr/sbin:/sbin
kill `lsof /dev/ttyACM1 | grep wvdial | awk '{print $2}'`

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

# tail -f /var/log/ppp.log
##################################################
--> Initializing modem.
--> Sending: AT+CFUN=1
AT+CFUN=1
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"ip","t-mobile"
AT+CGDCONT=1,"ip","t-mobile"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
~[7f]}#@!}!}!} }9}#}%B#}%}(}"}'}"}"}&} } } } }%}&}<_Y_o&~
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Wed Feb 10 23:59:44 2010
--> Pid of pppd: 6221
--> Using interface ppp0
--> pppd: x�[06][08] �[06][08]��[06][08]
--> pppd: x�[06][08] �[06][08]��[06][08]
--> pppd: x�[06][08] �[06][08]��[06][08]
--> pppd: x�[06][08] �[06][08]��[06][08]
--> pppd: x�[06][08] �[06][08]��[06][08]
--> pppd: x�[06][08] �[06][08]��[06][08]
--> pppd: x�[06][08] �[06][08]��[06][08]
--> Disconnecting at Wed Feb 10 23:59:44 2010
--> The PPP daemon has died: A modem hung up the phone (exit code = 16)
--> man pppd explains pppd error codes in more detail.
--> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
--> Auto Reconnect will be attempted in 20 seconds

# tail -f /var/log/messages
##################################################
Feb 10 23:59:32 linux-slu pppd[6214]: Plugin passwordfd.so loaded.
Feb 10 23:59:32 linux-slu pppd[6214]: pppd 2.4.5 started by root, uid 0
Feb 10 23:59:32 linux-slu pppd[6214]: Using interface ppp0
Feb 10 23:59:32 linux-slu pppd[6214]: Connect: ppp0 <--> /dev/ttyACM1
Feb 10 23:59:32 linux-slu pppd[6214]: CHAP authentication succeeded: Congratulations!
Feb 10 23:59:32 linux-slu pppd[6214]: CHAP authentication succeeded
Feb 10 23:59:32 linux-slu pppd[6214]: LCP terminated by peer
Feb 10 23:59:32 linux-slu pppd[6214]: Modem hangup
Feb 10 23:59:32 linux-slu pppd[6214]: Connection terminated.
Feb 10 23:59:32 linux-slu pppd[6214]: Exit.

Barry said...

Hi Sebastian,

It could be your APN (which you have as
't-mobile') or username and password is wrong, though I'm not sure.

If you can install it, try NetworkManager, this now supports this modem and also includes APNs, usernames and passwords for lots of operators out there. It handles everything seamlessly behind the seams. Only thing it doesn't include is the signal strength which the dell5530_mon tool I've written will indicate in the notification area.

Sorry I can't be of more help, but your wvdial script looks fine to me. That is why I suspect it is your APN or username and password. Note some operators have different APNs and credential depending on whether you are on contract or pay as you go so it might be worth checking this out too.

Alexander said...

Hey Barry,
first of all thanks for your great work you saved my day;-) as I was about to give up on my 5530! But with the recent change of month I noticed a problem with the current_bandwidth.sh script. The output of the used command date "+%b '%y is locale dependent but the output of vnstat -m is not. Therefore the grep fails. A workaround would be to use:
DATE=`LANG=en_US.UTF-8 date "+%b '%y" as the English locale is used by vnstat and should be installed on almost every linux machine.

Hope this helps somebody with a locale which uses umlaute (äüö) ;-)

Keep up the good work!

Alex

Barry said...

Hi Alexander,

I hadn't thought of that! Thankyou very much for your suggestion, I've added it to my script and I will create a new download shortly.

Thanks!

Barry