Puppy & GPSdrive?

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
edoc
Posts: 4729
Joined: Sun 07 Aug 2005, 20:16
Location: Southeast Georgia, USA
Contact:

Puppy & GPSdrive?

#1 Post by edoc »

Neat Linux app w/lots of neat features.
http://gpsdrive.kraftvoll.at/features.shtml

doc
[b]Thanks! David[/b]
[i]Home page: [/i][url]http://nevils-station.com[/url]
[i]Don't google[/i] [b]Search![/b] [url]http://duckduckgo.com[/url]
TahrPup64 & Lighthouse64-b602 & JL64-603

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

Re: Puppy & GPSdrive?

#2 Post by RobertB »

edoc wrote:Neat Linux app w/lots of neat features.
http://gpsdrive.kraftvoll.at/features.shtml

doc
Since this will be just my third time compiling a Linux program (and only one of those was successful), I'm going to document how it went here. We'll see if it's a helpful resource or a cry for help.

Here's what the FAQ says to do (I added the *s and the results):

Q: How do I install GpsDrive on a Linux box?
A: I recommend to use the source tarball. Download it from any of the mirrors (http://gpsdrive.spoiledmeat.net/ is the fastest one in Europe).

* Unpack the tarball with `tar xvzf gpsdrive-X.XX.tar.gz` where X.XX is the version number.
Dropped the .tar.gz in \ and unpacked.

* Now change into the directory gpsdrive-X.XX and run `./configure`.
Checking... checking... checking... mostly yes, a few no, so with my limited experience (not knowing what to fear) I'll push forward.

* Some people (including me, Sven) don't like the Garmin protocol. It can be easily disabled with the option `--disable-garmin`.
(I didn't do this)

* Now run `make`. Depending on your CPU power this will take something between 4 seconds and 3 minutes. An Intel Celeron 1000 takes approximately 50 seconds to have the version 1.28pre1 compiled.
Here goes... wow, they sure pass a lot of params to gcc. Does anyone else think "fi" is a strange way to end an if block? Would "endif" have been so bad? Anyway, got some compile warnings related to coding style, not compilation problems... done!

* Now do a `su`, enter your root password and continue with a final `make install`.
This is Puppy, so no su required, right? I do 'make install'... nothing seems to go badly in the many messages that scroll past.

And I run it -- gpsdrive enters "Simulation mode" and pulls up a nice little picture of the Earth. It also pops up a box warning me that "You should not start GpsDrive as user root!!!" (three exclamation points!). I ignore his kind advice and right-click on Texas. A missle is launched from northern Europe and takes a circuitous route toward me, and I have flashbacks of Missile Command. :)

I don't have a GPS unit yet, since I wanted to be sure I could do something with it, but now I'm off to buygpsnow.com to grab the Globalsat BR-355 GPS receiver -- plugs into a serial port (well, a PS2 mouse port, and I've got a PS2-9pin adapter floating around somewhere). $60 plus shipping and it looks like it's got the latest & greatest. Globalsat's site specifically mentions Linux support, though I won't need their USB driver 'cause my laptop actually has a serial port. It'll probably be too late, but if I've made a mistake with this model, please let me know!

(edit: googled for a discount code for buygpsnow.com, and to my surprise, "[censored]" saved me 3 bucks! w00t)

(further edit: It turns out that the discount code is posted at the buygpsnow.com forums, and the 5% discount is available to anyone who registers. I think that's a fair trade, and I'm getting a very prompt reply from their support folks -- details later -- so I'm removing the discount code from this post. Sorry!)

I'm now2 2-for-3 in builds from code. Happy dance!
Last edited by RobertB on Wed 12 Apr 2006, 17:51, edited 1 time in total.

User avatar
edoc
Posts: 4729
Joined: Sun 07 Aug 2005, 20:16
Location: Southeast Georgia, USA
Contact:

Re: Puppy & GPSdrive?

#3 Post by edoc »

RobertB wrote: And I run it -- gpsdrive enters "Simulation mode" and pulls up a nice little picture of the Earth. It also pops up a box warning me that "You should not start GpsDrive as user root!!!" (three exclamation points!). I ignore his kind advice and right-click on Texas. A missle is launched from northern Europe and takes a circuitous route toward me, and I have flashbacks of Missile Command. :)

I'm now2 2-for-3 in builds from code. Happy dance!
Congratulations!

So, when will you be making this into a DotPup ...
no point in hoarding the products of your genius!

Your effort is an encouragement to me to try and make
the time to do the same here ... unless you create a DotPup
first ... hint, hint, nudge, nudge!

Thanks! doc
[b]Thanks! David[/b]
[i]Home page: [/i][url]http://nevils-station.com[/url]
[i]Don't google[/i] [b]Search![/b] [url]http://duckduckgo.com[/url]
TahrPup64 & Lighthouse64-b602 & JL64-603

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

#4 Post by RobertB »

Thanks for your confidence, but let me ease into my new role as "Linux expert" -- seeing as how I wouldn't have even known why I needed ./ before "configure" until about a month ago! Although I'm already getting tempted to hack the source -- the app displays that dire warning about running as root every single time, which is rather annoying.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

dotpup creator

#5 Post by Lobster »

MU has created a dotpup creator that even I could use. 8)

Just to say well done and encourage you to Linux Mastery . . .
Where is the link for that? :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

#6 Post by RobertB »

I had to recompile -- I upgraded to 1.0.8a and didn't pay attention when it told me it was going to delete some things.

Perhaps this was my inner 1337H@XX0R setting me up. I found the code in gpsdrive.c that pops up that "user root!!!" message, and commented it out. I was originally planning to have as little impact as possible, but the way the check was coded irked me:

if (!didrootcheck)
if (getuid () == 0)
{
code to display annoying message
didrootcheck = TRUE;
}

The only time didrootcheck gets set true is if the user is running root. In other cases, the check on getuid happens every time. That wastes valuable clock cycles! (You wouldn't think I'd care, being a VB programmer these days, but I started out coding assembly language on a TRS-80...)

So I looked, and sure enough, this is the only place where the variable is used. I ripped it out, and its little declaration too. (aside: what's the deal with Beaver having to visually scroll the whole thing to find text? Top shows it using 44% of CPU and I'm not even doing anything? I'm touch-typing and it's hunt-and-peck-ing behind me. WTF?)

Ok, enough messing with the code, back to the less familiar waters of the Linux command line. ./configure... no such file? Oh, wrong directory. cd .., ./configure, make, run... w00t! It fires up (though it can't find its default world map for some reason). And no annoying message! I @m teh 7331, I mean 1337!

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

#7 Post by RobertB »

I've had my new toy for a week, and haven't been able to do a thing with it. It turns out that since the GPS unit isn't self-powered, you have to get a Y-cable to make it work. You can't just plug the PS2 connector into a PS2-to-DB9 adaptor, because the serial port doesn't supply power.

Although the BuyGPSNow.com site didn't make it clear that skipping the Y-cable was a newbie mistake when I bought the unit, their support folks are very helpful on their support forum.

The bad news, though, is that I've got three choices:

* For $16, I can get a "serial Y-cable" that takes the GPS plug and splits it into connectors for a serial port (for communications) and a PS2 port (for power). Unfortunately, my laptop doesn't have a PS2 port unless I mate it to the bulky "multimedia base".

* For $20, I can get a USB adapter that will plug the GPS right into the laptop's USB port, and will use USB power for the unit. But then I'll have to figure out how to make the USB port act as a serial port. There are a few posts (like this one referencing a modem) that deal with USB serial port adapters, but this is the only thread that discusses hooking up a GPS this way. The Globalsat site has Linux drivers (search for "355") -- kinda. It's a .c, a makefile, and a readme, and I'm not sure the .c is valid (it references a .h that I don't think exists). Oh, and there are three versions of the .c, all in different "RedHat x" directories.

* For an unknown cost, somewhere between $5 in parts and $Laptop, I could splice a USB extension cable with a PS2 extension cable, and route the power from the USB port to the appropriate pins of the GPS. This assumes that the USB voltage is what's expected by the GPS, and that my rusty wire-splicing skills are up to the task.

I'm leaning towards one of the latter two options. I can't decide whether I'd rather beat my head against the desk in frustration getting serial emulation to work with uncertain drivers, or instead punch a hole in the wall after toasting my laptop. Rationally, I should fight the drivers, but I sometimes miss the breadboard days (I once built a voice synthesizer for my TRS-80 Model 100). But I also have memories of seeing the Magic Smoke...

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

#8 Post by RobertB »

I can hardly believe it, but with a pocketknife, scissors, and some terminal strips, I've got my GPS receiver up and running. The package is barely holding together -- the wires are flimsy as all get-out -- and worst of all, it's hooked up to my Windows box at work (because the test program supplied with the unit only runs in Windows).

I'm late getting home (gee, I bet *nobody* else ever gets sidetracked like this), so I'll have to post the details Monday, after I figure out what the heck I did, and get it running on the Pup.

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

#9 Post by RobertB »

First off, my suggestion: unless you're dying to use your wirecutters, just buy a friggin Y-Cable.

But if you want to have as much fun as me, you can do what I did:

1. Prepare to sacrifice three nice cables:

* PS2 mouse/keyboard extension cable. You need the female end that the GPS plugs into, so you can't just cut the wire off your old mouse.

* USB cable for power. Keep the end that plugs into the PC.

* 9-pin serial cable for signal. Again, you want the PC end. I used an old Palm Pilot sync cable left over from the semi-disposable digital camera project.

2. Cut the ends off of all the cables. Be sure you cut off the end that is *farthest* from the part you're going to connect to, or you'll be sorrrreeee...

3. Use a fancy meter (or if you're like me, use an LED, a resistor, and a 9v battery) to find the right wires.

4. "Simply" connect the wires together and you're done! Ha. The wires in my cables were hair-thin, and I'm used to dealing with wires you can plug into a breadboard. I finally found something called a "eurostyle connector" that looks something like the pictures here, that uses a setscrew to clamp the conductors together.

4a. What about those ground/shield conductors? I screwed them together in a traditional terminal block I had laying around.

5. Wrap the whole thing in a giant ugly blob of electrical tape. Mine looks like a misshapen three-legged squid. It's bigger than the GPS unit itself. Man, is it ever ugly.

Here are the connections. Note that my first idea, to use an old PS2 mouse - serial mouse converter, would not have worked! I'm lucky I didn't blow the whole thing out -- fortunately, there's no juice available on the serial port.

Code: Select all

Power:
GPS      PC Serial   USB
1 (GND)  5 (GND)     Black (GND)
2 (Vcc)  nc          Red (+5)

Signal:
GPS      PC Serial
4 (RX)   3 (TX)
5 (TX)   2 (RX)

Loopback:
Connect PC Serial 4 (DTR) and 6 (DSR)
(I'm not sure this is required in practice,
but it worked when I tried it so I kept it)
Pinout info links:

BR-355 GPS unit: http://www.usglobalsat.com/downloads/BR ... pinout.jpg
Note that the pin numbers are labeled as you're looking into the male connector. I don't know if this is standard or not.

PS2 mouse/keyboard pinouts: http://www.burtonsys.com/PS2_keyboard_a ... nouts.html
Mostly useful for getting it through my thick skull that anything designed for a mouse converter wouldn't work for the GPS unit.

Serial port: http://www.diyaha.co.uk/electronics/comm1.html
Actually, I used a different page, but I lost the page link. This one has the bare basics.

USB port: http://www.usbman.com/Guides/BelkinMoth ... sembly.htm
Not terribly specific to the task at hand, but it had the info I needed.

If I didn't already have unused serial and usb cables lying around, I'd have spent more on this butt-ugly contraption than I would have by simply buying the pre-made, pretty one. But then, if I just wanted to sit back and let someone else have all the fun, I'd have paid ol' Billy Boy the $100 he wanted, and let him put his silly Windows on my laptop.

User avatar
RobertB
Posts: 145
Joined: Tue 03 Jan 2006, 01:06
Location: Big D
Contact:

#10 Post by RobertB »

I was Googling for maps for GpsDrive, and came across this LinuxJournal page that got me to thinking about some problems I've had.

GpsDrive has an annying "feature". If I open it and close it three times, it can no longer find the GPS unit from the third try on. Worse yet, the program defaults to position 0.0, 0.0 and midnight, so the map shifts to the east Atlantic off the coast of Africa, and the night light feature (eye-saving red) turns on. I should hack the code so that it *never* defaults to 0.0, 0.0 and 00:00. But for now, I'm going to see if GPSD is the solution.

According to its creators, "gpsd is a service daemon that monitors one or more GPSes attached to a host computer through serial or USB ports, making all data on the location/course/velocity of the sensors available to be queried on TCP port 2947 of the host computer." They also describe it as "high-quality, carefully-audited code" -- something you can't say about GpsDrive, though really I have nobody to blame but myself (if I don't like the compile-time messages, I should debug the thing and fix it!).

Perhaps if GpsDrive gets its input from GPSD instead of directly from /dev/ttyS0, it won't suffer this initialization problem.

A search of the forums turned up nada, so here goes compile #4! I know it's got to be annoying to the folks who recompile kernels for breakfast, but I'm still learning... scroll past the baby stuff if you like.

* Drop gpsd-2.32.tar.gz in / and unpack with tar xvzf (I've got to learn a mnemonic for those options)
* Change to directory and run ./configure - no obvious problems.
* make - things compile cleanly as promised... up to a point.

Code: Select all

creating gpsd
xmlto man gps.xml /bin/bash: xmlto: command not found
make[1]: [gps.1] Error 127 (ignored)
make[1]: Leaving directory '/gpsd-2.32'
Maybe everything will be ok...

That Linux Journal article gives one really good bit of info: how to test gpsd.

# ./gpsd -p /dev/ttyS0
# telnet localhost 2947

I had to do some poking, but I got the "R" command to make the receiver start dumping data. Good so far. Fired up GpsDrive and sure enough, it automagically figured out that GPRS was running and connected to it instead of to the serial port. You can tell because of the status message at the bottom of the screen -- note that the "Preferences" dialog still shows my /dev/ttyS0 setting and "Use serial conn" is still checked. GpsDrive needs to do some work on the user interface -- I'll add that to my to-do list.

Just two more things to do:

* Add this to /.etc/rc.d/rc.local (which I *always* have to use gtkfind to find):
ln -s /dev/ttyS0 /dev/gps

* Create a script to run GPSD before GpsDrive. It looks like I have to use the full path (for both gpsd and gpsdrive), since I didn't run the RPM install or some such that would have set the path or something... I still don't know what the proper method is to do that in Linux. :( Of course, I could put GPSD in rc.local, but I'll only need it if I'm running GpsDrive. On the other hand, I just have to hope (at this point) that GPSD detects that there's an instance already running...

* Reboot and try it out!

* bzzt. Even with the symlink properly created, gpsd won't default to it for some reason. I have to use -p /dev/gps. Strange.

* w00t, it works! I can fire up the script over and over and still never end up adrift off the coast of Africa. That problem with the serial port is clearly a bug -- one of those that you don't encounter unless you run without GPSD, which I'd wager most folks seldom do. I'll report it to the program's email discussion list (edit: the project has BugZilla, so I'll need to report it there... when I get a round tuit).

I'll probably try out Kismet's integration with GpsDrive and GPSD eventually... right now, I'd better get those maps downloaded. You know, the ones that sent me down this rabbit hole in the first place.

Edit: I'm going to move the gpsd startup call to rc.local after all. The more I look at the GPSD site, the more confident I am in their stuff, and they note "New gpsd is designed to be started by hotplug scripts when a USB device wakes up, or started at boot time and run continuously just like any normal daemon. It will do nothing, and be swapped out, unless there are clients trying to query the GPS." So I'll just fire it and forget it. If I ever managed to create a dotpup for gpsdrive, I'll have it install gpsd as well.

Post Reply