<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dabbler &#187; gps</title>
	<atom:link href="http://sethjust.com/tag/gps/feed/" rel="self" type="application/rss+xml" />
	<link>http://sethjust.com</link>
	<description>If it ain&#039;t broke, fix it!</description>
	<lastBuildDate>Fri, 16 Jul 2010 00:19:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>GPSd under OS X</title>
		<link>http://sethjust.com/2009/01/13/gpsd-under-os-x/</link>
		<comments>http://sethjust.com/2009/01/13/gpsd-under-os-x/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 08:52:06 +0000</pubDate>
		<dc:creator>sethjust</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://sethjust.wordpress.com/?p=47</guid>
		<description><![CDATA[So I recently picked up a cheap GPS module on Amazon. It was about $30 with shipping, and I got a neat little dongle which connects over USB to my computer and communicates with software. It didn&#8217;t come with support for OS X (although interestingly enough it shipped with Mac OS 8 and 9 drivers), [...]]]></description>
			<content:encoded><![CDATA[<p>So I recently picked up a cheap GPS module on Amazon. It was about $30 with shipping, and I got a neat little dongle which connects over USB to my computer and communicates with software. It didn&#8217;t come with support for OS X (although interestingly enough it shipped with Mac OS 8 and 9 drivers), but it promised to send generic NMEA-0183, so I wasn&#8217;t too worried.</p>
<p>When it showed up, some quick software probing revealed that it houses a usb to serial adaptor (a Prolific PL-2303, which I&#8217;ll get to in a bit) and a gps module that&#8217;s configured to send NMEA strings through the virtual serial port. This sort of information is compatible with a host of software, but most of it is commericial, and only available at a considerable price.</p>
<p>Luckily, there&#8217;s a wonderful open source project called gpsd which provides support for a wide raft of devices and protocols, and talks to an even wider assortment of software. Primarily, I wanted to be able to get my gps to talk to the network scanner Kismac, and Randall Munroe&#8217;s cyborg.py script. Both of these were built to take information from gpsd, so I was in business. However, gpsd, which is designed to play nicely with Linux, takes some coaxing under OS X. This is meant to describe how I got it all running.<span id="more-47"></span></p>
<h3>I. Hardware driver</h3>
<p>Because the gps relies on a usb-to-serial chip to talk to the computer, it needs a driver that will emulate a serial port. The chip in my gps revealed itself as a Prolific PL-2303, a common chip that I&#8217;d had previous dealings with, and so had a driver for. This enabled me to see a serial device on my system and read raw data from it:</p>
<pre>sethjust$ ls /dev/cu.*
/dev/cu.Bluetooth-Modem		/dev/cu.Bluetooth-PDA-Sync	/dev/cu.PL2303-0000101D
sethjust$ stty -f /dev/cu.usbserial ispeed 4800 &amp;&amp; cat &lt;/dev/cu.usbserial
,,,3.6,2.2,2.8*3E
$GPRMC,060645.994,A,4537.5498,N,12259.8000,W,000.0,327.4,120109,,,A*70
$GPVTG,327.4,T,,M,000.0,N,000.0,K,A*0F
$GPGGA,060646.994,4537.5498,N,12259.8000,W,1,06,2.2,137.3,M,-21.5,M,,0000*63
$GPGSA,A,3,23,25,13,04,32,20,,,,,,,3.^C</pre>
<p>This driver also played nicely with some of the commericial software demos I&#8217;d downloaded, but oddly enough it didn&#8217;t work with gpsd. Eventually, after some debugging and consulting with one of gpsd&#8217;s developers via IRC, I replaced the driver I had (an open source replacement for proprietary driver) with the driver from Prolific&#8217;s website. Supposedly the open-source PL-2303 driver doesn&#8217;t play nicely with gpsd, and so they recommend using Prolific&#8217;s.</p>
<h3>II. gpsd and gpsdrive</h3>
<p>The gpsd package comes with several useful support utilities, but one that it doesn&#8217;t include is gpsdrive, a wonderful program that supports mapping and live data from gps. Getting both running under OS X is a little difficult, but I found a great document <a href="http://lists.gpsdrivers.org/pipermail/gpsdrive/2007-June/000136.html">here</a> that explains the process. A little has changed, so here&#8217;s how I got it working (though I never did get xgps or xgpsspeed to compile&#8230;):<br />
1) Install fink if you haven&#8217;t already.<br />
2) Install gpsdrive through fink:</p>
<pre>$ fink install gpsdrive</pre>
<p>3) Rename /sw/bin/gpsd to gpsd-1.06b:</p>
<pre>$ sudo mv /sw/bin/gpsd /sw/bin/gpsd-1.06b</pre>
<p>4) Download the latest source for gpsd. I used the latest RC for their upcoming 2.38 release and have had no problems.<br />
5) In the gpsd source directory, run ./configure with whatever options you&#8217;d like. The earlier document had some suggestions on getting it to see X11 libraries, but I haven&#8217;t been able to make them work. I ended up using</p>
<pre>$ ./configure --bindir=/usr/local/bin -without-x</pre>
<p>6) Compile the software by typing &#8220;make&#8221;. You can then either install it with &#8220;sudo make install&#8221; or test it before installing:</p>
<pre>$ ./gpsd -n /dev/cu.usbserial
$ ./cgps</pre>
<p>In my case /dev/cu.usbserial is the device representing the PL-2303. You should replace this with your own.</p>
<p>Running cgps should show a live summary of the information that gpsd is getting, along with a running log of the raw data coming from the gps. You can also test gpsd by telnetting to localhost:2947, typing w and hitting enter. You should see NMEA strings from the gps.</p>
<h3>III. Kismac and cyborg.py</h3>
<p>The original reason that I embarked on this gps adventure was to use two programs: Kismac and Randall Munroe&#8217;s cyborg.py. Kismac is easy to get running with gpsd – once you have gpsd running (e.g. gpsd -n /dev/cu.usbserial), open Kismac and set it to use gpsd for map coordinates. It should display your location on the map screen, and associate coordinates with APs.</p>
<p>cyborg.py is a little harder to get running. It&#8217;s dirty (though entirely functional) code that isn&#8217;t fully mac compatible. Notably, it uses two programs (flite and figlet) that are iffy under OS X. I patched that up, replacing flite with OS X&#8217;s built-in &#8220;say&#8221; command, and commenting out the figlet bits (which display large text) in favor of the terminal output the script gives. The modified script works beautifully, although I didn&#8217;t clean up the code at all. You can get it <a href="http://people.reed.edu/~justs/cyborg.py">here</a>.</p>
<h3>IV. Links</h3>
<ul>
<li> <a href="http://gpsd.berlios.de/">gpsd</a></li>
<li><a href="http://www.gpsdrive.de/">gpsdrive</a></li>
<li><a href="http://trac.kismac-ng.org/">Kismac</a></li>
<li><a href="http://blag.xkcd.com/2008/05/20/gps-cyborg-implant/">Randall Munroe&#8217;s cyborg.py</a></li>
<li><a href="http://lists.gpsdrivers.org/pipermail/gpsdrive/2007-June/000136.html">Post by Hashim on the gpsdrive mailing list</a></li>
<li><a href="http://www.prolific.com.tw/eng/Products.asp?ID=59">Prolific PL-2303</a> and <a href="http://www.prolific.com.tw/eng/downloads.asp?ID=31">driver</a></li>
<li><a href="http://osx-pl2303.sourceforge.net/">PL-2303 Alternative Driver</a></li>
<li><a href="http://apps.sourceforge.net/mediawiki/gpsdrive/index.php?title=Creating_maps">Getting maps in gpsdrive</a></li>
<li><a href="http://www.canmore.com.tw/product.aspx?id=12">My gps</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sethjust.com/2009/01/13/gpsd-under-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
