maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Troubleshooting (https://talk.maemo.org/forumdisplay.php?f=6)
-   -   How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper (https://talk.maemo.org/showthread.php?t=21847)

zzzy 2008-07-13 05:47

How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
Just in case someone else ends up with the Pharos USB GPS (the one that comes with Microsoft Streets & Trips with GPS). This device is a USB-only GPS receiver powered by SIRF III technology. It reads model no. GPS-500 and part no. X13-51914.

Instead of buying a separate Bluetooth dock, I thought I would try and make use of the USB host mode that comes with OS versions chinook and up. A specially modified adapter does the specific trick of automatically switching the USB mode.

The Pharos USB GPS-500 receiver has a built-in Prolific USB-serial interface. N800 however does not come with the necessary modules and drivers to perform USB-serial interfacing. Fanoush was kind enough to make available a module pack (tar.gz) (see also this post) containing suitable modules: usbserial.ko and pl2303.ko under drivers/usb/serial. These of course will have to be loaded with insmod from the root account. Upon successfully insmodding, a new /dev/ttyUSB0 serial device is created.

One last trick I had to figure out was a hidden file called /var/lib/gps/.gps_no_serial_ports which will prevent maemo-mapper and the built-in gpsd daemon from accessing /dev/ttyUSB0. Once you remove that file everything should work like a charm.

The following steps are involved:

Code:

# insert kernel modules BEFORE connecting the dongle
insmod usbserial.ko # as root
insmod pl2303.ko    # as root
# this is when we connect the GPS dongle, wait ~10 seconds
chmod 666 /dev/ttyUSB0              # as root
rm /var/lib/gps/.gps_no_serial_ports # again as root
# the next step is probably not necessary
stty -F /dev/ttyUSB0 sane ; stty -F /dev/ttyUSB0 4800

Maemo-mapper will have to be configured to use the serial device /dev/ttyUSB0 under Settings/GPS/File Path. Make sure you write down the default /dev/pgps somewhere before replacing just in case it may prove critical some time in the future.

Cheers

Z

2/7/09 Edit: here is an implementation suggestion in conjunction with the Personal Menu app. A notable change from the example above is the use of gpsd as data source in maemo-mapper as opposed to pointing it to /dev/ttyUSB0. The scripts below will fire up gpsd with the right command-line options, This way several gps-enabled applications can run simultaneously.

Caution: some unix/linux skills are required, such as opening an xterm session, navigating the file system using cd and ls, copying and renaming files etc--

(1) I opened a Terminal session and created a new directory called /home/user/bin/usbser containing the following files; the .ko files are the new kernel modules described above:
Code:

start-gpsd   
restart-gpsd 
stop-gpsd
pl2303.ko   
usbserial.ko

The other 3 files are simple shell scripts as shown below:

start-gpsd
Code:

#!/bin/sh
echo do not connect the GPS dongle just yet. press enter when ready...
read x
killall gpsd && ( sleep 3 ; killall -9 gpsd ; sleep 3)
echo enabling usbserial module
lsmod | grep usbserial || ( insmod /home/user/bin/usbser/usbserial.ko ; sleep 3 )
echo enabling pl2303 module
lsmod | grep pl2303 || ( insmod /home/user/bin/usbser/pl2303.ko ; sleep 3 )
echo you can now connect the GPS dongle. press enter when ready...
read x
echo "/dev/ttyUSB0" > /var/lib/gps/gps_serial_ports
echo "/dev/pgps" >> /var/lib/gps/gps_serial_ports
echo --------------------------
echo modules that are now active
echo --------------------------
lsmod
echo --------------------------
chmod 666 /dev/ttyUSB0
stty -F /dev/ttyUSB0 sane
stty -F /dev/ttyUSB0 4800
rm /var/lib/gps/.gps_no_serial_ports
echo firing up gpsd
/usr/sbin/gpsd -n /dev/ttyUSB0
sleep 4

restart-gpsd
Code:

#!/bin/sh
killall gpsd && ( sleep 3 ; killall -9 gpsd ; sleep 3)
stty -F /dev/ttyUSB0 sane
stty -F /dev/ttyUSB0 4800
rm /var/lib/gps/.gps_no_serial_ports
echo firing up gpsd
/usr/sbin/gpsd -n /dev/ttyUSB0
sleep 4

stop-gpsd
Code:

#!/bin/sh
echo please remove the GPS dongle now. press enter when ready...
read x
killall gpsd && ( sleep 3 ; killall -9 gpsd ; sleep 3 )
echo disabling pl2303 module
lsmod | grep pl2303 && ( rmmod /home/user/bin/usbser/pl2303.ko ; sleep 3 )
echo disabling usbserial module
lsmod | grep usbserial && ( rmmod /home/user/bin/usbser/usbserial.ko ; sleep 3 )
echo ----------------------------
echo modules that are still active
echo ----------------------------
lsmod
echo ----------------------------
sleep 4

These scripts can be created on your PC using notepad then copied over a USB cable on the internal or external card. Then you could open a terminal session and copy the new files from either your external card (found at /media/mmc1) or internal (/media/mmc2). An alternative of course would be to create said shell scripts in vi or any other editor you may have available that can save plain text files (I for one use mc / mcedit).

With all files in place, I made the scritps executable: chmod +x *-gpsd.

(2) I installed Personal Menu. Then using the Edit Personal Menu option, I created entries for the scripts above and checked the "run as root" box; here are excerpts from my ~/.personal_menu.rc config file:

Code:

[1]
app name=engps
icon name=qgn_stat_gps_fix
executable=osso-xterm /home/user/bin/usbser/start-gpsd
run as root=true
run in term=false
service=

[2]
app name=disgps
icon name=qgn_stat_gps_no_fix
executable=osso-xterm /home/user/bin/usbser/stop-gpsd
run as root=true
run in term=false
service=

[3]
app name=regps
icon name=qgn_stat_gps_searching
executable=osso-xterm -e /home/user/bin/usbser/restart-gpsd
run as root=true
run in term=false
service=

(3) Logged in as root (see below posting from Aquabits describing how to do this,) I went ahead and added the following line to the bottom of /etc/sudoers:

Code:

user ALL = NOPASSWD: /usr/bin/osso-xterm
(4) One final step is to set maemo-mapper to use gpsd on localhost port 2947.

The "restart-gpsd" command above is sometimes useful when maemo-mapper is unable to locate the gps device; this most likely happens when the OS (stubbornly) recreates the .gps_no_serial_ports file.

Hope this helps

Cheers

Z.

Munk 2008-07-13 05:52

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
I wondered if there was a way to get that GPS to work. Especially since it was $29.99 on woot about two weeks ago.

So, since it's working, how is the reception on it? Is the lock time fast? Does it really drain the power pretty fast?

zzzy 2008-07-13 06:08

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
It locks within seconds (less than 10 in my case). I take that back, it locks within 20-30 seconds if no prior gpsd instances are active.

I had the entire setup on battery for about about 3 hrs before it drained.

YoDude 2008-07-13 14:15

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
Quote:

Originally Posted by zzzy (Post 202394)
It locks within seconds (less than 10 in my case). I take that back, it locks within 20-30 seconds if no prior gpsd instances are active.

I had the entire setup on battery for about about 3 hrs before it drained.

Very cool indeed...

Is your USB GPS two seperate peices not including the modified adapter? I have one from Microsoft Streets & Trips laying around here somewhere that has a postage stamp sized GPS reciever that plugs into a seperate USB-serial interface.

Now I'm wondering if this smaller serial interface with the modified adapter can be used for connecting other serial devices with the Tablet.

zzzy 2008-07-13 15:13

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
1 Attachment(s)
Quote:

Originally Posted by YoDude (Post 202465)
Very cool indeed...

Is your USB GPS two seperate peices not including the modified adapter? I have one from Microsoft Streets & Trips laying around here somewhere that has a postage stamp sized GPS reciever that plugs into a seperate USB-serial interface.

Now I'm wondering if this smaller serial interface with the modified adapter can be used for connecting other serial devices with the Tablet.

You're right, it is the two separate parts one, see attached, blurry pic. In my very limited experience with serial devices I have never seen a serial connector like this one in the past, so it may actually be Pharos-specific.

Z.

durval 2008-10-14 18:04

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
Just for the record, Zzzy instructions worked *great* for enabling a Holux GR-213 ("GPS mouse" serial receiver) plugged into a Nokia N800 using a Holux USB adapter cable (which contains a Prolific PL2303 serial-to-usb chip): maemo-mapper is working wonderfully.

If afterwards it stops working, just see it the /var/lib/gps/.gps_no_serial_ports is back there, and if so, just remove it and restart maemo-mapper. That happened to me, I think some program in Maemo recreates it from time to time.

Cheers,
--
Durval Menezes.

tgalati4 2008-10-14 18:56

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
I had worked this out a couple of months ago, but did't have a chance to write up a tutorial. I used a BU-353 and I also get about 3 hours of continous mapping with my n800. I believe the SirFSTAR III chipset uses 70 mA.

Den in USA 2008-10-14 19:26

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
Would be nice if someone could package this all into an installable .deb file.

aquabits 2008-10-24 15:58

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
Thanks much to zzzy (and Fanoush).

Few tips for newbies like me:
- The device zzzy mentiones comes with 2007 version of MS Streets&Trips. Older versions may have a slower GPS chip.
- The insmod command is only available when you are logged in as root. To do it, you can use the "rootsh" program which when installed, shows up as "x-terminal". Issue "sudo gainroot" in x-terminal and you are root.
- You can use a regular mini-usb adapter, but you will have to manually put N800 in host mode. To do so, you can use the "usbcontrol" program. Once it is in host
mode, you can exit the program.
- Make sure to delete the hidden file, even though you may not see it.
- When you plug-in the GPS, N800 will recognize "a usb device". You will get a message about unknown file system, just ignore it.
-The default Map program won't work with this. You will need Maemo Mapper.
- Do the settings change for ttyUSB0 in Maemo Mapper and then go to GPS->enable GPS. It will take a while for it to find the device and get a lock on it.
- Use the center button on the pad on N800 to center the map to your location.
- Additional maemo mapper information here.

aquabits 2008-10-24 16:07

Re: How to use Pharos USB GPS (Microsoft Streets & Trips) with N800 & maemo mapper
 
By the way, I have N800 and the latest OS2008 version (4.2008.36-5). This GPS works on it with the steps described in the initial post by zzzy.


All times are GMT. The time now is 12:05.

vBulletin® Version 3.8.8