Using the builtin GPS in a Thinkpad X200 under Linux

Introduction
I recently purchased a Lenovo Thinkpad X200 laptop with a builtin Ericsson F3507g mini-pci card. This card supports both 3G networks and even more interestingly GPS. I have no use for the 3G functionality at the moment so I haven’t signed up for any service. I did however have a old SIM card laying around and that is all that is needed to get the GPS up and running. The SIM card is no longer active but the GPS in the F3507g card will not work if the SIM card is not present.

Installing the SIM card
The SIM card is installed underneath the battery on the computer
simkort

Getting data from the GPS
The Ericsson F3507g appears to Ubuntu as a USB device and can be accessed be a series of pseudo terminals using programs as “cu”, see reference 1 and 2. This approach is however much more complicated than what is really needed. By using wvdial all the needed commands can be written in the /etc/wvdial.conf config file.

root@euler:~# cat /etc/wvdial.conf
[Dialer Defaults]
New PPPD = yes
Stupid Mode = 1
Modem Type = USB Modem
 
[Dialer on]
Modem = /dev/ttyACM0
Init1 = AT+CFUN=1
 
[Dialer off]
Modem = /dev/ttyACM0
Init1 = AT+CFUN=4
 
[Dialer gps]
Modem = /dev/ttyACM1
Init1 = AT*E2GPSCTL=1,5,1
Init2 = AT*E2GPSNPD

Notice that this config file is stripped of anything not needed for gps. In the GPS section the most interesting thing is the number 5 which indicates the frequency the card emits the GPS data.

Notice: In some of the references I found while creating this article I read that the /dev/ttyACM2 terminal was used in gps section but this didn’t work for me so I tried to use /dev/ttyACM1 instead which worked.

Once /etc/wvdial.conf have been created the card can be turned on by writing

tjansson@euler:~$wvdial on
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.                    
--> Sending: AT+CFUN=1                     
AT+CFUN=1                                  
OK                                         
--> Modem initialized.                     
--> Configuration does not specify a valid phone number.
--> Configuration does not specify a valid login name.  
--> Configuration does not specify a valid password.

and the gps is started with

tjansson@euler:~$wvdial gps
--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: AT*E2GPSCTL=1,5,1
AT*E2GPSCTL=1,5,1
OK
--> Sending: AT*E2GPSNPD
AT*E2GPSNPD
$GPGGA,,,,,,0,00,5.0,,M,-0.288049,M,0.0040199,0130*58
$GPRMC,134527.89,V,,,,,,,030136,,,N*7D
$GPGSV,1,1,01,11,,,35,,,,,,,,,,,,*7E
$GPGSA,A,1,,,,,,,,,,,,,11.2,5.0,10.0*36

The data from the card is rather difficult to interpret for normal humans, so I installed gpsd

root@euler:~# aptitude install gpsd

and told gpsd to listen to the /dev/ttyACM1 device

tjansson@euler:~$gpsd /dev/ttyACM1

Using the GPS data – maps
At this point the gpsd daemon is providing position data and all the following programs connects to the gpsd daemon to get GPS data. The first program worth mentioning is xgps which is included in the gpsd Ubuntu package. This program shows which satellites are seen by the GPS receiver in the computer and provides the position in raw numbers. The is a great information to have but most people like to see their position in a map as well and this is where tangoGPS comes into the picture.

tangoGPS is not in the Ubuntu repositories but is licensed under GPLv2 and source and install files for most Linux flavors are available from their website: http://www.tangogps.org. In this screenshot I have both xgps and tangoGPS running
workinggps

A alternative to tangoGPS exists in the Ubuntu repositories and is called gpsdrive

root@euler:~# aptitude install gpsdrive

From my very first impressions tangoGPS seems more friendly with better maps but gpsdrive might more features.

Automating everything
Being a Linux user I hate to do repetitive work, so I have created a small script to start the card and the appropriate programs and shutdown when I am done.

#!/bin/bash
# Thomas R. N. Jansson 2009
 
select COMPONENT in Start Stop Quit
do
    case $COMPONENT in
 
        Start)
        wvdial on
        sleep 2
        wvdial gps &
        sleep 2
        gpsd /dev/ttyACM1
        xgps &
        tangogps &
        ;;
 
        Stop)
        gpsdpid=`ps -ef | grep 'gpsd /dev/ttyACM1' | awk {'print $2'} | head -1`
        kill $gpsdpid
        wvdial off
        ;;
 
        Quit)
        break ;;
 
        *)
        echo "Invalid choice, $REPLY" ;;
 
    esac
done

Sources
1. www.thinkwiki.org/wiki/Ericsson_F3507g_….

2. www.nabble.com/X301-Ericsson-Modul-f3507g…

3. www.tangogps.org

4. redmonk.com/sogrady/2008/12/07/how-to-use…

5. redmonk.com/sogrady/2008/10/20/apone_intrepid/

6. ubuntuforums.org/showthread.php?t=934013&page=3

This entry was posted in Articles, Computer. Bookmark the permalink.

16 Responses to Using the builtin GPS in a Thinkpad X200 under Linux

  1. Hi

    Interestng about your test with GPS under Linux on the Thinkpad X200. The problem especially in China is that there is hardly any support for Linux. I did have a quick look at the X200 today and then checked on the internet for Linux on the X200 and as usual I find even that companies like emperorlinux note that the fingerprint lock don’t work with Linux on the X200 everything else seem to work however. It is strange that Lenovo can not come up with a fully Linux compatible X200. As for 3G USB sticks they usually don’t work with Linux in China. Well, I am currently using two X31 Thinkpads but one just broke down. The X200 seem interesting but unless I can get guarantee from Lenovo it is fully Linux compatible I will hold off buying any new Laptop. I am considering Fujuitsu as well. GPS with Linux is of interest to me and so are maps and GPRS and 3G. By the way, I am from Sweden but live in China.

    Best regards,

    Peter

  2. My version of the X200 does not have the fingerprint reader, so I can’t help you to whether or not it is working. That said I am not all to impressed with fingerprint readers out there and most of my friends having such a device ends up not using them after the novelty wears off. The built quality of Thinkpads is what makes me come back every time.

  3. Lorenz says:

    Hi Thomas,

    I also have a X200 and it also have a SIM card slit like shown on your photo. However there is no device like ttyACMx. Is it possible that there is only the SIM card holder actually without a modem? How can I find out about that, or the device adress? I hope you can help.
    cheers,
    Lorenz

  4. Hi Lorenz

    It’s been a while since I played around with it but I remember that if I used a the server kernel of Ubuntu, which was PAE enabled, I noticed that devices didn’t have the same names. Try to look in /var/log/messages or using “dmesg” to see what the new device name is. I think it should work if you have the SIM card slot.

  5. Niklas Allroggen says:

    He,
    thanks a lot for your nice tutorial.. Its very strange to find guy having nearly the same interests and hobbies as myself. I’m also am geophysicist at the University Bremen. 2007/2008 I haNallroggen@web.deve been at Unis and off-course I really like Linux!!
    Thanks again! I wish you the best…

  6. a_petrov303 says:

    many thanks for this great tutorial – I will try it myself!!!

    regarding the question on sim card slot – most of X200 came WWAN upgradeble, so all the wiring and antennas (including the slot) does exist, but the card (GPS+WWAN) is a paid for option.

  7. a_petrov303 says:

    I have installed TangoGPS following your instructions – many thanks!
    But how do I tell tangoGPS where to take gps data from?

    As you can see from the attached picture, the gps is working in the terminal, but I feel I need to edit the gpsd host info, no?

    Please help

    BTW, in Ubuntu 10.4, TangoGPS is available already through Synaptic package manager.

  8. starenka says:

    Hi, im having problems w/ turning gps on. The string seems to be okay (the .conf is 1:1 copy of yours – also tried to generate one w/ wvdialconf and merge it). Any idea? (thanks)

    root@kosmik1:/home/starenka# wvdial on
    --> WvDial: Internet dialer version 1.60
    --> Cannot get information for serial port.
    --> Initializing modem.
    --> Sending: AT+CFUN=1
    AT+CFUN=1
    OK
    --> Modem initialized.
    --> Configuration does not specify a valid phone number.
    --> Configuration does not specify a valid login name.
    --> Configuration does not specify a valid password.
    root@kosmik1:/home/starenka# wvdial gps
    --> WvDial: Internet dialer version 1.60
    --> Cannot get information for serial port.
    --> Initializing modem.
    --> Sending: AT*E2GPSCTL=1,5,1
    AT*E2GPSCTL=1,5,1
    ERROR
    --> Bad init string.
    --> Cannot get information for serial port.
    --> Initializing modem.
    --> Sending: AT*E2GPSCTL=1,5,1
    AT*E2GPSCTL=1,5,1
    ERROR
    --> Bad init string.
    --> Cannot get information for serial port.
    --> Initializing modem.
    --> Sending: AT*E2GPSCTL=1,5,1
    AT*E2GPSCTL=1,5,1
    ERROR
    --> Bad init string.
    
  9. a_petrov303: Since I wrote the article I have done a few reinstalls of Ubuntu and furthermore I don’t really use the built-in GPS anymore as my Android phone does that for me.

    Once this is said I gpsd should be running in the background while TangoGPS is started. TangoGPS will then try to connect to the gpsd daemon and get the data from the daemon. I can’t see any attached photo but if you have the gpsd daemon running in a shell and it outputs data looking like coordinates then starting tangogps with gpsd running should work. As you can see in my control script I first start gpsd and then wait 15 seconds before starting xgps and tangogps.

    starenka: Hmm It seems that gps starts to do something but when it answers “OK”, but I don’t why it reports errors later. I must admit that I haven’t played around with this for a year or so, so I can’t remember any debugging to this. 🙂

  10. starenka says:

    thomas: okay, will try to strugle for a while 😀 Thanks for your ply & and the post as well.

    Cheers. starenka

  11. Eruk says:

    hej and tak for the article –

    not dual booting anymore – any idea if this will work in Win7 (x200t)

  12. Eruk: No haven’t used Windows on the Laptop for years, but I imagine that the GPS will work if you have something in the SIM-slot. On the software side I can’t help unfortunately.
    Kind regards Thomas

  13. Pingback: Insert a GPS module to my ThinkPad , possible?

  14. Pingback: Sven Seeberg-Elverfeldt » Using GPS of Ericsson F5521gw in Ubuntu with gpsd

  15. Ben says:

    2015 – Just got a x220T with the same Ericsson gps recorder. Thank you so much for your tutorial. It took me a day to figure out all details. In the end it was just my supdity. Thank you!!!
    Greets from Cologne, DE
    Ben

  16. Pingback: GPS na karcie WWAN Ericsson F5521GW – Linux i systemd – Prywatny blog globalbusa

Leave a Reply