{"id":47,"date":"2009-01-13T00:52:06","date_gmt":"2009-01-13T08:52:06","guid":{"rendered":"http:\/\/sethjust.wordpress.com\/?p=47"},"modified":"2012-02-11T18:50:01","modified_gmt":"2012-02-12T02:50:01","slug":"gpsd-under-os-x","status":"publish","type":"post","link":"https:\/\/sethjust.com\/2009\/01\/13\/gpsd-under-os-x\/","title":{"rendered":"GPSd under OS X"},"content":{"rendered":"
Update 7-13-11: <\/strong>I’ve posted an updated set of instructions on getting GPSd to compile on OS X here<\/a>; this post will remain for archival purposes. For information on installing GPSDrive, see this post<\/a>.<\/p>\n 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’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’t too worried.<\/p>\n When it showed up, some quick software probing revealed that it houses a usb to serial adaptor (a Prolific PL-2303, which I’ll get to in a bit) and a gps module that’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>\n Luckily, there’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’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.<\/p>\n 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’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>\n This driver also played nicely with some of the commericial software demos I’d downloaded, but oddly enough it didn’t work with gpsd. Eventually, after some debugging and consulting with one of gpsd’s developers via IRC, I replaced the driver I had (an open source replacement for proprietary driver) with the driver from Prolific’s website. Supposedly the open-source PL-2303 driver doesn’t play nicely with gpsd, and so they recommend using Prolific’s.<\/p>\n The gpsd package comes with several useful support utilities, but one that it doesn’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 here<\/a> that explains the process. A little has changed, so here’s how I got it working (though I never did get xgps or xgpsspeed to compile…): 3) Rename \/sw\/bin\/gpsd to gpsd-1.06b:<\/p>\n 4) Download the latest source for gpsd. I used the latest RC for their upcoming 2.38 release and have had no problems. 6) Compile the software by typing “make”. You can then either install it with “sudo make install” or test it before installing:<\/p>\n In my case \/dev\/cu.usbserial is the device representing the PL-2303. You should replace this with your own.<\/p>\n 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>\n The original reason that I embarked on this gps adventure was to use two programs: Kismac and Randall Munroe’s cyborg.py. Kismac is easy to get running with gpsd \u00e2\u20ac\u201c 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>\n cyborg.py is a little harder to get running. It’s dirty (though entirely functional) code that isn’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’s built-in “say” 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’t clean up the code at all. You can get it here<\/a>.<\/p>\n Update 7-13-11: I’ve posted an updated set of instructions on getting GPSd to compile on OS X here; this post will remain for archival purposes. For information on installing GPSDrive, see this post. So I recently picked up a cheap GPS module on Amazon. It was about $30 with shipping, and I got a neat […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[146,7],"tags":[28,29,47,59,74,77,159],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/comments?post=47"}],"version-history":[{"count":6,"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":174,"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/posts\/47\/revisions\/174"}],"wp:attachment":[{"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/media?parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/categories?post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sethjust.com\/wp-json\/wp\/v2\/tags?post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}I. Hardware driver<\/h3>\n
sethjust$ ls \/dev\/cu.*\r\n\/dev\/cu.Bluetooth-Modem\t\t\/dev\/cu.Bluetooth-PDA-Sync\t\/dev\/cu.PL2303-0000101D\r\nsethjust$ stty -f \/dev\/cu.usbserial ispeed 4800 && cat <\/dev\/cu.usbserial\r\n,,,3.6,2.2,2.8*3E\r\n$GPRMC,060645.994,A,4537.5498,N,12259.8000,W,000.0,327.4,120109,,,A*70\r\n$GPVTG,327.4,T,,M,000.0,N,000.0,K,A*0F\r\n$GPGGA,060646.994,4537.5498,N,12259.8000,W,1,06,2.2,137.3,M,-21.5,M,,0000*63\r\n$GPGSA,A,3,23,25,13,04,32,20,,,,,,,3.^C<\/pre>\n
II. gpsd and gpsdrive<\/h3>\n
\n1) Install fink if you haven’t already.
\n2) Install gpsdrive through fink:<\/p>\n$ fink install gpsdrive<\/pre>\n
$ sudo mv \/sw\/bin\/gpsd \/sw\/bin\/gpsd-1.06b<\/pre>\n
\n5) In the gpsd source directory, run .\/configure with whatever options you’d like. The earlier document had some suggestions on getting it to see X11 libraries, but I haven’t been able to make them work. I ended up using<\/p>\n$ .\/configure --bindir=\/usr\/local\/bin -without-x<\/pre>\n
$ .\/gpsd -n \/dev\/cu.usbserial\r\n$ .\/cgps<\/pre>\n
III. Kismac and cyborg.py<\/h3>\n
IV. Links<\/h3>\n
\n