6

The gpsd program lets linux users cleanly organize their GPS peripheral data, such that a command line program like cgps or a graphical one like xgps can read the data, and write to a socket, like /var/run/gpsd.sock.

There's a nice tutorial on the net for rigging a raspberry pi to use this data. This is all well and good, but how can I integrate this data in firefox or chromium, as the geolocation API? Is there a specific build process I might need? For instance, setting a ./configure flag or something? Is there a way to integrate this data in a prebuilt version of either browser?

Athan Clark
  • 3,886
  • 2
  • 21
  • 39

2 Answers2

4

Firefox on Linux supports gpsd - it was added in Firefox 4, removed in Firefox 23 and added back in Firefox 50.

However, it still needs to be enabled during build, with --enable-gpsd (which seems not to be the case yet in Ubuntu) and in the configuration, by following these steps:

  1. Navigate to about:config
  2. Create a new string preference, name geo.location.use_gpsd value true

Prior to Firefox 23, you had to:

  1. Create a new string preference, name geo.gpsd.host.ipaddr value localhost
  2. Create a new boolean value, name geo.gpsd.logging.enabled value true

Google Chrome had gpds support added in November 2011 and removed in October 2013. It looks like hardware GPS support is not a priority. If this was handled in Chrome OS, it might be possible to use the same mechanism, but I don't see support there either.

Someone built an extension which attempts to provide support in recent versions, requiring to install a script system-side.

3

Firefox on linux used to support gpsd.

  1. Navigate to about:config
  2. Create a new string preference, name geo.gpsd.host.ipaddr value localhost
  3. Create a new boolean value, name geo.gpsd.logging.enabled value true

However, it seems that the gpsd support has been removed

Chromium seems to have had gpsd support in the past, but I can't find anything about it now. It looks like hardware gps support is not a priority. If this was handled in ChromeOS, it might be possible to use the same mechanism, but I don't see support there either.

In both cases, it should be possible to write an extension to fake the GPS coordinates, which could read from your real GPS.

Thomas Zwaagstra
  • 397
  • 4
  • 11
  • 1
    With emphasis: Mozilla bug [866893 - Remove support for **multiple** geolocation providers](https://bugzilla.mozilla.org/show_bug.cgi?id=866893) was RESOLVED FIXED in Firefox 23. [1250922 - Add gpsd location provider](https://bugzilla.mozilla.org/show_bug.cgi?id=1250922) was RESOLVED FIXED in Firefox 50. – Graham Perrin Jul 13 '18 at 19:37
  • It seems in Firefox 50+ you have to set `geo.location.use_gpsd` to `true` in `about:config` to activate the `gpsd` location provider: https://hg.mozilla.org/mozilla-central/rev/76b04196acce – mkurz Jul 21 '18 at 21:57