Thursday, January 27, 2011

GPS functional in 0.10.156.1

With today's dev channel update, Google has finally put in place the final pieces to make the GPS functional. As far as I know, there is no GUI interface but you can test it out and get some cool details about your location by running the following commands from a root shell:
  1. initctl start gpsd
  2. cgps
The first command enables the gps service (or daemon as it's known in the Linux world, hence the d in gpsd). The second command runs a simple command line gps display. If cgps returns an error, you might need to shutdown the Cr-48 and boot it again. You might also try enabling/disabling the Cellular under the wireless strength indicator. Once cgps works, set the Cr-48 near a window or, if you don't live in the Northeast and you didn't get a foot of snow today and it's not another freezing cold night, you know, go outside. You should be able to get a GPS fix and learn your lat/long and other details. Now run up and down your sidewalk and watch your speed while your neighbors watch you run around with laptop in hand and wonder if they should call the cops. Remember, if a police officer approaches you, be sure to explain that you're testing out this laptop for Google and this is important work, that should help, or it'll make for a great story to be shared in the comments below.

27 comments:

  1. i try the first command and it said "permission denied", how should I deal with it?

    ReplyDelete
  2. @nopainkiller: you need to be root. Run "sudo su -" to become root. See:

    http://chromeos-cr48.blogspot.com/2010/12/rooting-jailbreaking-your-new-google.html

    ReplyDelete
  3. @Jay Lee: I got an error:
    close(3) in netlib_connectsock()
    cgps: no gpsd running or network error: -6, can't connect to host/port pair

    ReplyDelete
  4. are you sure you're on 0.10.156.1? Did you run "initctl start gpsd"?

    ReplyDelete
  5. @Jay Lee: I'm right at 0.10.156.1 and I ran "initctl start gpsd" and got a "gpsd start/running, process 8258"

    ReplyDelete
  6. @nopainkiller: I'm finding some weird issues. First off, I got rid of the "echo..." command, it wasn't necessary (starting gpsd does this). Try shutting the Cr-48 off and bringing it back up, also try toggling the Cellular radio on and off. I haven't figured out exactly what the right combo to get it working is just yet.

    ReplyDelete
  7. @Jay Lee: It works! GPS Type : Generic NMEA

    ReplyDelete
  8. I had a bit of trouble at first too, but a reboot got it going right away. That is so cool!

    ReplyDelete
  9. Works for me: http://www.chrome48.info/2011/01/gps-works.html

    ReplyDelete
  10. uhmm how do i exit from it? o-o

    ReplyDelete
  11. Wow, this is cool. I just went through the jailbreak today, updated the OS and saw this article. I got a lock pretty quickly and when I put the coordinates into google maps, it gave me a picture of my house! Now, what will they let us do with a gps?

    ReplyDelete
  12. Hello, I wanted to comment on Maps.google.com Press the button that is right above the slider that says something about enabling my location, and it zeros into me and the cr-48. I have a few guesses on how it's happening, but I have to get the Verizon card connected again. It stopped working after switching to the Dev Build. SO SWEET! The GPS card has to be working, or it's getting my location from my phone. I'll keep you posted. Feel free to de-bunk me if I'm wrong :-)

    ReplyDelete
  13. @Paul, I believe they can use your wifi connection (they have a huge database of known access points), don't think the GPS is working...

    ReplyDelete
  14. Haha, took me awhile to figure this one out..."q" to quit ^_^

    Took a few minutes of running around outside in the freezing cold, but I finally found enough satellites to get a lock! Funny thing is though..."speed err: +/- 49mph"!

    ReplyDelete
  15. does this work with ubuntu installed? I dont see the drivers for it in "additional drivers," maybe theres a way, that would be cool because you could use regular applications that can use gps

    ReplyDelete
  16. Is this what Google Maps uses to track your location on the OS?

    ReplyDelete
  17. Probably not how Maps finds you--especially since this is only sorta turned on. More likely tracking you by your IP. I guess to confirm we could just use a proxy or an onion router to check.

    ReplyDelete
  18. I tested this and it had surprisingly good accuracy. It did take a bit to get a lock though but once I did I watched it against a speedometer in the car (I was riding... not driving) and it was pretty well spot on. It also seemed to pick up slope pretty good. Note if you can't get it to work make sure that gpsd is even running. Run...

    ps axf | grep gpsd

    And check for the actual gpsd process. If you get 2 lines you are good. If you only get one then it only returned the command you just ran to grep for gpsd. If that's the case then try again or reboot the laptop. It should work after the reboot. I think the gpsd process is a little unstable still.

    ReplyDelete
  19. when will I be able to write a chrome app that uses the GPS? I don't really want to root it. I would be happy to wait until it is "available" which I assume will happen eventually?

    thanks!

    ReplyDelete
  20. I'm on the newest DEV build, 20.0.1132.1, and 'initctl start gpsd' results in an error: 'Unknown job: gpsd'. Did they rename the daemon or remove it entirely? cgps still seems to be available, but won't run without gpsd.

    ReplyDelete
  21. yeah im pretty sure its been removed

    sucks

    ReplyDelete
    Replies
    1. Dunno about the CR-48, but it is in the Samsung ARM build in /usr/sbin/gpsd - check that path.

      I have been hacking around with it in Dev mode, and found that the initctl also fails with this version but the command can be run directly by root:
      gpsd -n -F /tmp/gsock.fil -D 9 /dev/tty2

      /dev/tty2 seems to be where I plugged in my Delorme Earthmate LT-40, but I am not getting it to lock, and a tail of /dev/tty2 does not show any data stream coming back from the LT-40, so not sure if I identified its dev correctly. It shows up in dmesg and lsusb output, and neither shows me the /dev device.

      I also have a Earthmate BT(Blue Tooth)-20 receiver, but cannot get the Chrome OS BT settings to connect to it after I pair them, so not any help there.

      Anyone have any ideas for getting either receiver to connect and find what its /dev is?

      TIA,
      ROC

      Delete
    2. A bit more debugging:

      Running gpsd in interactive mode as root shows that it is failing to open /dev/tty2 due it being already opened by another process. The lsof command shows me the other processes associated with that file are login and bash, and they are root-owned! I have met the enemy, and it is ME! What now?

      ROC

      Delete
  22. And now the benefit of getting ready for bed making me step away from hammering on the problem to actually stop and think about it: tty2 is my terminal login session, so no wonder it belongs to "logon" and "bash" - and has nothing to do with the USB GPS receiver. I will try to track that down after a good night's rest.

    ROC

    ReplyDelete
  23. OK, I think I found the right /dev device file in /dev/bus/usb/002 - the files under that directory get new names, starting with 001, and on up matching what lsusb shows for the device number as I plug/re-plug the GPS receivers into the USB port (never could get anything going with BT).

    When I run GPSD in the foreground (-N option) I can see some activity I did not see before - lots of lines prefixed with "gpsd:INFO/gpsd:SPIN/gpsd:PROG/etc":
    ...
    stashing device /dev/bus/usb/002/004 at slot 0
    ...
    opening GPS data source type 2 at '/dev/bus/usb/002/004'
    open(/dev/bus/usb/002/004) -> 5 in gpsd_serial_open()
    Probing
    Probe not found...

    [only a few of the 2 dozen plus devices that "gpsd -h" shows, then...]
    no probe matched...
    gpsd_activate(): activated GPS (fd 5)
    device /dev/bus/usb/002/004 activated
    running with effective group ID 14
    running with effective user ID 0 [should be the root UID]
    startup at
    [then repeating pairs of:]
    gpsd:UNK: select waits
    gpsd:SPIN: select() {3 5} -> {} at 1365024511.597945 (errno 0)
    ...
    Note: those number pairs before "(errno 0)" increment each time, but in big jumps - milliseconds?

    Anyway cgpsd still does not think gpsd is running or a network error - take your pick - so I give up since I did not find any of my Earthmate GPS receivers to give any cgpsd results despite all the foregoing output, including an old LT-20 with a Zodiac chipset that is listed specifically in the GPSD help output, and that I recall giving older gpsd versions on "real" linux trouble some years back.

    YMMV

    ReplyDelete