Author Topic: Got Earthmate USB GPS, now what?  (Read 31066 times)

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #15 on: May 09, 2005, 02:20:25 pm »
Although I've used Linux for years, I've spent 99% of my time on Perl, PHP, and MySQL.  I don't have much experience with drivers (except for following explicit directions) and kernel modules (same).

So what I'm gathering from your posts is that I should just install the libraries (libusb and libemul) that you compiled, and install the gpsd binary that you compiled, and if everything worked right in compiler land, gpsd should work?

That would be great if it works.  I'll let you know if it works for me.  I know there was at least one other person in these forums with the same problem, hopefully he'll see these updates as well, and maybe we can get his feedback also.
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #16 on: May 09, 2005, 03:19:03 pm »
Tried to ipkg install the libusb you had up on that page; http://students.bath.ac.uk/enpsgp/Zaurus/e...-r1_armv5te.ipk

Quote
Installing.. blah blah
ipkg_conf_write_status_files: Can't open status file: /mnt/card/packages//usr/lib/ipkg/status for writing: Read-only file system.

The double slash (//) is not a typo.

When I try to usr sirfmon or emul_test I get errors.

sirmon wants a device name.  I used
mknod /dev/usb/ttyUSB1 c 180 0
although I wasn't sure if that was correct or not.

But it just tells me No such device.

emul_test:

Quote
em_open: Device or resource busy
Check node permissions and device attachment.

Same error as before I ran mknod

I saw a page somewhere in the OE documents which had specific mknod instructions, but for the life of me I can't find it
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #17 on: May 09, 2005, 03:44:26 pm »
Ok, it looks like maybe the mknod should be "mknod /dev/ttyUSBx c 188 x" since doing an ls in /dev shows me a couple existing ttyUSBx entries, and it says

"crw-rw---- 1 root root 188, 0 May 9 15:36 /dev/ttyUSB0"
"crw-rw---- 1 root root 188, 1 May 9 15:36 /dev/ttyUSB1"

I rebooted my machine, did a "mknod /dev/ttyUSB2 c 188 2"

But sirfmon still says /dev/ttyUSB2: No such device.
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #18 on: May 09, 2005, 06:45:21 pm »
I hadn't thought you'd need libusb, however after reading this (http://emul.berlios.de/about.php) I think you might (it might be worth trying to find some program which will test whether libusb is working - in fact I don't even know what it's supposed to do).

I'm working exclusively from http://emul.berlios.de/ as this is the one linked from http://geocities.com/i0xox0i/ with some kind of indication that it'll work on 2.4.x (the other site seems to me to be concerned with 2.6.x kernel modules which won't work for you until the 2.6.11 kernel is ported to the 6000).

Quote
Installing.. blah blah
ipkg_conf_write_status_files: Can't open status file: /mnt/card/packages//usr/lib/ipkg/status for writing: Read-only file system.

I saw someone saying this had happened to them - I asked whether their card was mounted ro or rw - I can't remember what the problem was though I'm afraid. Perhaps umount the card and try running fsck on it.

mknod /dev/ttyUSB0 c 188 0
mknod /dev/ttyUSB1 c 188 1
mknod /dev/ttyUSB2 c 188 2
mknod /dev/ttyUSB3 c 188 3
.
.
.
mknod /dev/ttyUSB15 c 188 15

appears to be correct.

Next question is whether the driver for the device is loaded, and whether/how it's bound to the dev entry. My (admittedly not very in-depth) understanding is that you'll get this binding if you use the kernel module (which acts as the usb-serial convertor).

I don;t think this is what you're going to be doing - the patched gpsd uses the emul lib which uses libusb which talks to the usb device directly (that's my guess anyway).

Try to install the libusb, stick the emul lib in (and create the symlinks to the major and .so files), the see if gpsd or the two test programs will work.


Si

(a bit of an explanation: http://www.mp3car.com/vbulletin/showthread.php?t=24211)

Last user comment on this page might also be interesting to investigate:
http://www.qbik.ch/usb/devices/showdev.php?id=2272
(the one from David Tauriainen)

Explanation of what emul is: http://s2.selwerd.nl/~dirk-jan/gpsdrive/ar...e/msg04332.html

Plus the entire README from emul source code:

Quote
EarthMate Userland Library v1.0.2
emul's dependencies are as follows:

libpthread
libusb >= 0.1.8

   The library has moved away from automake and friends.  For your target
install, please link the appropriate makefile.  For example, someone doing
an install with Mac OS X or OpenDarwin should issue the command:
   $ln -s Makefile.darwin Makefile

   To install, please take a look at the Makefile and make sure the
PREFIX variable is set to your liking.  The default is '/usr'.  If this
is acceptable, it should be simple enough to enter the command below
and hit enter:

$ make install

   To see if things are working, there are two programs which utilize
this library.  Those are: emul_test and sirfmon.  If all goes well,
simply running emul_test should start spewing NMEA (or binary garbage)
on the terminal.  A quick way to get the unit to switch back into nmea
mode is to physically replug it.  There is also the excellent utility
'sirfmon' written mostly by Eric S. Raymond which can be run with this
library via the command:
$ sirfmon emate     (it also works with regular tty devices)

   You can switch the unit between sirf and nmea with the sirfmon utility.
By default, the unit is switched into sirf mode when starting sirfmon.  To
go back to nmea, simply enter 'n' at the command line.

   Both sirfmon and emul_test are installed by default.  emul_test can be
passed the argument 'd1' - 'd8' to activate emul library debugging.

   For information regarding the gpsd patch in directory patches,
please view the readme file in that directory.

   Documentation for the library can be found in html/ courtesy of doxygen.
man keywords are 'emul.h' and 'serconfig'.


   If you want to help out, with porting/patches/bug reports/success
stories/etc, please do.  Visit the project page at:
http://developer.berlios.de/projects/emul/



My tests and trials:

  Machines tested with library:
   amd athlon 1500/256MB ddr266/ehci-ohci-uhci
   abit bh6 p3 667/256MB PC133/ali ehci-ohci, uhci bus onboard

2.4 linux kernel notice:

   Host controllers that are usb 2.0 compatible bundled with ohci bridges for
usb 1.1 gave me some trouble.  For instance, trying to read from the interrupt
in pipe will return -22 (or EINVAL) for whichever reason.  This problem does not
seem to exist on the 2.5/2.6 kernels.  A quick and dirty solution is to connect
a usb 1.1 hub on one of the controllers port hubs and then plug the earthmate
into that.  I'm not sure if this is the same for ehci/uhci controllers as
well... I surely hope not.  For people with plain jane usb 1.1 busses there
should be no problem.

RedHat Linux 9.0 (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) kernel
2.4.20-8)
   Before compiling, I had to change MANDIR to 'MANDIR=$(PREFIX)/share/man'.
Otherwise it compiled cleanly.  The version of libusb that comes default with
rh9 is 0.1.6, which does not contain the necessary functions for interrupt
transactions.  I had to first package a new rpm of libusb-0.1.10a and then force
it to install using the --force flag.  I also grabbed the latest usbutils and
repacked that as well (for lsusb tool).  On the first run, the system completely
locked up. Apparently when connected to the uhci usb bus the system would oops.
I then tried upgrading the kernel to something a little more recent from
kernel.org. With 2.4.22/2.4.24/2.4.30 no lockups occured.  sirfmon, both the
version packaged with the library and the one accompanying gpsd, worked well.
The library utilites, such as emul_test, did not however.  This problem should
be fixed at this point.  I also ran gpsd-2.21 with success.

Gentoo Linux 2005.0 (gcc 3.4.3 / kernel 2.6.11):
   Compiled without trouble.  It just works, but then again I'm developing emul
on this platform.

Slackware 10.1 (gcc 3.3.4 / kernel 2.4.29):
   Compiled without trouble.  The sirfmon utility works fairly well at rates
below or at 9600bps.  Anything higher will start
choking the emul applications, including gpsd.

OpenDarwin 7.2.1 (gcc 3.3):
   Compiled without trouble.  The only usb controller which seemed to work was
an Ali based ehci/ohci controller, and even then only one of the two ports
worked.  I'm sure someone with ppc hardware could easily have this working.
When running the test applications, they work quite well now.  Before a certain
bug was fixed, they would fail on the read process.  gpsd should work fine with
this.

Mac OS X:
   I'm guessing this library will work based on what happened with OpenDarwin.

BSD Folks:
   BSD support is coming along slowly.

NetBSD 2.0 (gcc 3.3.3):
   Compiled without trouble.  In order to avoid using userconf manually on every
boot to disable uhid/uhidev, the uhid interface needs to be disabled in the
kernel by recompiling it.  This is of course very inconvenient for someone with
usb mice, etc.  With userconf, at boot I had to issue the command 'boot -c' in
order to get into the userconf dialog.  Then, to disable the hid interface,
issue the commands: disable 349 and disable 350.  The emul_test program works
fine, however the lines never drop... that is something that should be fixed.
The em_select() function seems to be at blame for why sirfmon and emul_test2
fail to work properly.

FreeBSD:
   Avoid this library... use the ucycom module instead.  Someone, namely
'brick', has reported the module working fine with the earthmate on FreeBSD
6.0-CURRENT.  The node created by ucycom should be used with gpsd.  If you
however would want to still use this library... who am I to stop you!  Something
to look into for disabling ucycom/uhid without obtaining a migraine would be
this:

http://www.freebsd.org/doc/en_US.ISO8859-1...vice-hints.html

Good Luck!
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #19 on: May 09, 2005, 07:01:24 pm »
It's just occured to me that libusb may well be different for different kernel versions - I'm set to build for 2.6.11 so you may want to ask hrw in the upgrades thread if he'll build libusb for 2.4.18.

Also, even if the above isn't true, note that the ipk I've given you will require an arch of armv5te (iirc) - this will probably have to be added to /etc/ipkg/arch.conf - use a lowish number (I think high numbers are given preference), or just add it temporarily and remove it once it's installed.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #20 on: May 09, 2005, 09:22:44 pm »
I appreciate your help, lardman.  I'll try to muddle through and see what I can do tomorrow.

Thanks!
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #21 on: May 10, 2005, 07:14:40 am »
Okay, do the following:

1. hrw has added libusb to the upgrades feed - install that version
2. Stick my libemul.so.1.0.5 in /usr/lib, create the following symlinks:

libemul.so.1.0.5 -> libemul.so.1.0
libemul.so.1.0 -> libemul.so.1
libemul.so.1 -> libemul.so
(' cd /usr/lib && ln -s libemul.so.1.0.5 libemul.so.1.0', etc.)

3. stick sirfmon and emul_test in /usr/bin (you might need to chmod +x the files as I think they've passed though my WinXP machine)
4. Plug in the GPS
5. Try sirfmon and emul_test (I've no idea what they should do - but please post and tell us)
6. make temporary alteration to /etc/ipkg/arch.conf (post the contents here if you need help) so you can install the next ipk
7. Install my gpsd-emul_2.20-r2_armv5te.ipk
8. Run gpsd with fingers crossed


Si
« Last Edit: May 10, 2005, 07:46:13 am by lardman »
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #22 on: May 10, 2005, 08:38:25 am »
Ok, some results...

armv5te was already in my /etc/ipk/arch.conf file.

Installed the libusb from the 3.5.3 upgrades feed.  No problems.

I had to mknod for ttyUSB2 again (lsusb showed the earthmate on device 2) and when I check the ttyUSB files I see

crw-rw---- .. ttyUSB0
crw-rw---- ... ttyUSB1
crw-rw-rw- ... ttyUSB2

ttyUSB2 has a different file mask.  Should I just chmod 777 it?

When I went to install the gpsd ipk, I got the same read-only error, and errors about missing libgps, so I remounted my sd card as rw (mount /dev/mmcda1 -o remount,rw) and tried again.

No more read-only errors, but the same libgps error;

"Starting gpsd; error while loading shared libraries: libgps.so.10; cannot open shared object file: No such file or directory
success"

So I went to the oz353 feed and found libgps.so.10 and installed that.  It wouldn't install from the SD card, complained it couldn't create the symlinks.   think it just tried to create symlinks to the card, which is vfat, not ext2.  So I manually copied the libgps.so.10.0.0 file to /usr/lib, created symlinks for libgps.so.10 and libgps.so.

Now when I try to run sirfmon I get:

"# sirfmon emate
sirfmon: error while loading shared libraries: libgps.so.10: ELF file version does not match current one."

Same error when I try to run gpsd.  Does that mean I screwed up the installation of the libgps file in some way?

emul_test still gives me "em_open: Device or resource busy
Check node permissions and device attachment."
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #23 on: May 10, 2005, 09:00:38 am »
Quote
the card, which is vfat, not ext2

Can you format it ext2? It will save a lot of hassle. Or are you installing everything to root now anyway?

Quote
"# sirfmon emate
sirfmon: error while loading shared libraries: libgps.so.10: ELF file version does not match current one."

Quote
Same error when I try to run gpsd. Does that mean I screwed up the installation of the libgps file in some way?

I don't know I'm afraid.

Quote
I had to mknod for ttyUSB2 again (lsusb showed the earthmate on device 2) and when I check the ttyUSB files I see

crw-rw---- .. ttyUSB0
crw-rw---- ... ttyUSB1
crw-rw-rw- ... ttyUSB2

ttyUSB2 has a different file mask. Should I just chmod 777 it?

AFAIK you need to do this - you'd only do this if you were using the kernel modules which makes the gps act like a serial adaptor.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #24 on: May 10, 2005, 02:19:18 pm »
Well, after a couple hours I was able to get everything set up right.

- 1gb SD card is now partitioned, 375mb vfat, the rest ext2
- Installed libusb
- Installed gpsd
- Installed qpegps

gpsd runs without crashing. qpegps runs, and detects gpsd... but I can't get the gps to respond, go green, anything.  telnet to localhost 2947 to talk to gpsd manually, it's not getting any data (obviously, otherwise it would go green) and the X variable is 0, meaning the gps is inactive.  When I unplug/replug it into the USB port, it blinks red a few times then goes dark.  I've tried it outside to see if it would go green outside, but nothing.

I'm really about at my end.
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #25 on: May 10, 2005, 06:14:40 pm »
Quote
- Installed libusb
- Installed gpsd
- Installed qpegps

Did you 'install' (or rather copy to /usr/lib) libemul? - this is needed to communicate between gpsd and libusb. I presume you did do so otherwise gpsd would have failed to start.

Does emul_test, etc. work? This should be your first step.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #26 on: May 11, 2005, 05:37:28 am »
There's one more issue (of course), qpegps doesn't work with the latest versions of gpsd - even if gpsd is spewing data out, qpegps won't recognise it and will remain red - so if you can find out when the changes occurred in gpsd, I'll see if I can find an old version and perform the emul patch on that.

Otherwise, you'll (or I'll) need to use the version of gpsd which the qpegps people have on their site, and try to patch that with the emul patch (sounds like a fair bit of work to do).

Anyway, the moral of the story is ignore qpegps for the time being and just test whether there are any comms by telneting to gpsd, and using emul_test.


Si
« Last Edit: May 11, 2005, 05:39:49 am by lardman »
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

Gondola

  • Full Member
  • ***
  • Posts: 124
    • View Profile
Got Earthmate USB GPS, now what?
« Reply #27 on: May 11, 2005, 12:45:28 pm »
The sirfmon and emul_test programs aren't working.

Quote
root@tosa:/home/gondola# sirfmon emate
emate: No such file or directory
root@tosa:/home/gondola# emul_test
        em_open: Device or resource busy
        Check node permissions and device attachment.
root@tosa:/home/gondola# emul_test d1
em_open - Successfuly opened device.
em_open: dettached driver hid from device
em_open: failed to claim device
        em_open: Device or resource busy
        Check node permissions and device attachment.

There appears to be something possibly wrong with my libusb install.

Quote
root@tosa:/home/gondola# find / -name libusb*
/usr/bin/libusb-config
/usr/lib/ipkg/info/libusb.list
/usr/lib/ipkg/info/libusb.postinst
/usr/lib/ipkg/info/libusb.control
/usr/lib/libusbpp-0.1.so.4
/usr/lib/libusb-0.1.so.4
/usr/lib/libusbpp-0.1.so.4.4.2
/usr/lib/libusb-0.1.so.4.4.2

Although
Quote
root@tosa:/home/gondola# ipkg info 'libusb*'
Package: libusb
Version: 0.1.10a-r1
Depends: libstdc++6 (>= 3.4.3), libc6 (>= 2.3.2+cvs20040726), libgcc1 (>= 3.4.3)
Status: install user installed
Architecture: arm
Installed-Time: 1115829140

I tried to extract the ipk file to see if the filename matches the one in /usr/lib, but gunzip libusb.tar.gz says Invalid magic.  Not sure how else to check it.  The command line help for ipkg doesn't say anything about listing the contents of an ipk file, or I'm reading it wrong.
[span style=\'font-size:8pt;line-height:100%\']Nokia 770, running latest firmware.
1GB RS-MMC sandisk card
Garmin Etrex Legend GPS/USB Earthmate GPS
Rooted, with an SSH server, VNC viewer, etc.
[/span]

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #28 on: May 11, 2005, 12:50:22 pm »
Are you online atm - come and talk in #openzaurus, it'll be easier.

In any case, to list the files in an installed package try:

ipkg files <package name>

I'm not sure that libusb is necessarily not working, might be worth looking for a different app which you could use to test though I suppose.

I'll have a quick look through the OE packages list.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Got Earthmate USB GPS, now what?
« Reply #29 on: May 11, 2005, 01:04:19 pm »
libusb must be working otherwise this would fail at em_open.

Code: [Select]
root@tosa:/home/gondola# emul_test d1
em_open - Successfuly opened device.
em_open: dettached driver hid from device
em_open: failed to claim device
        em_open: Device or resource busy
        Check node permissions and device attachment.

From looking at the code, it would appear that the emul lib is failing here:

Code: [Select]
       usb_set_configuration(em_device.udev, 1);
        ret = usb_claim_interface(em_device.udev, 0);
        if (ret < 0) {
                if (em_debug) fprintf(stderr, "em_open: failed to claim device\n");
                usb_close(em_device.udev);
                em_device.udev = NULL;
                return ret;
        }

So this is a problem with the interface being claimed (remember that the other usblib functions appear to work, so I wouldn't blame the lib) - not sure why, but it's a place to start.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva