Geoclue on the system bus

Chrisopher Vogl christopher.vogl at hale.at
Fri Nov 26 01:41:46 PST 2010


Hi,

I'm trying to run geoclue 0.12 just on the system bus, but non of the 
examples work. Has anybody configured it with "--enable-system-bus" and 
was able to run any of the examples?  Do I still have to provide a 
session bus?
e.g.

/geoclue-0.12.0/example/.libs]$ ./position-example Gypsy
Using provider 'Gypsy'
Failed to open connection to bus: dbus-launch *failed to autolaunch D-Bus session*: Autolaunch error: X11 initialization failed.
** (process:1142): CRITICAL **: dbus_g_proxy_add_signal: assertion `DBUS_IS_G_PROXY (proxy)' failed
** (process:1142): CRITICAL **: dbus_g_proxy_connect_signal: assertion `DBUS_IS_G_PROXY (proxy)' failed
** (process:1142): CRITICAL **: dbus_g_proxy_call: assertion `DBUS_IS_G_PROXY (proxy)' failed
Latitude and longitude not available.


I also tried the master-pos-example.
./master-pos-example
(process:1159): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(process:1159): GLib-GObject-CRITICAL **: g_signal_connect_data: 
assertion `G_TYPE_CHECK_INSTANCE (instance)' failed
(process:1159): GLib-GObject-CRITICAL **: g_type_instance_get_private: 
assertion `instance != NULL && instance->g_class != NULL' failed
Segmentation fault


Geoclue service files are located in share/dbus-1/services. Gypsy also 
runs on the system bus (with working gypsy examples), but its service 
files are in system-services, including a "User=root" line. So I moved 
the service files to system-services and also added a user.
Futhermore I put a Geoclue.conf file in etc/dbus-1/system.d:
...
<busconfig>
    <policy user="root">
        <allow own="org.freedesktop.Geoclue.Master"/>
        <allow own="org.freedesktop.Geoclue.Providers.Gypsy"/>
        <allow own="org.freedesktop.Geoclue.Providers.Gpsd"/>
    </policy>
    <policy context="default">
        <allow send_destination="org.freedesktop.Geoclue.Master"/>
        <allow send_destination="org.freedesktop.Geoclue.Providers.Gypsy"/>
        <allow send_destination="org.freedesktop.Geoclue.Providers.Gpsd"/>
    </policy>
</busconfig>
...

The --enable-system-bus option creates a macro in config.h
#define GEOCLUE_DBUS_BUS DBUS_BUS_SYSTEM

But in geoclue-provider.c =>  constructor () => connection = 
dbus_g_bus_get (DBUS_BUS_SESSION, &error);
DBUS_BUS_SESSION is hard coded (instead of GEOCLUE_DBUS_BUS ?).

Besides, in master.c => gc_master_init()
g_warning ("Could not get %s: %s", GEOCLUE_DBUS_BUS, error->message);
the first %s leads to a Segmentation fault.


With these changes the necessary providers start on its own (master, 
gypsy, gpsd) and also gypsy.

/geoclue-0.12.0/example/.libs]$ ./master-pos-example
** (process:1179): WARNING **: Metadata for error domain 
"geoclue-error-quark" already registered
No provider available


ps aux

root      1132  0.0  1.7   4544  2172 pts/0    S    00:21   0:00 
/opt/ttsdk/libexec/gconfd-2 8
103       1176  0.0  0.9   2752  1212 pts/0    S+   02:29   0:00 
dbus-daemon --system --nofork
root      1179  0.0  1.5   5484  1952 pts/3    S+   02:29   0:00 
./master-pos-example
root      1181  0.1  2.1   6276  2716 pts/0    S+   02:29   0:00 
/opt/ttsdk/libexec/geoclue-master
root      1183  0.2  1.9   6656  2476 pts/0    S+   02:29   0:00 
/opt/ttsdk/libexec/geoclue-gpsd
root      1185  0.1  1.5   5548  2012 pts/0    S+   02:29   0:00 
/opt/ttsdk/libexec/geoclue-gypsy
root      1187  0.0  1.4   4096  1788 pts/0    S+   02:29   0:00 
/opt/ttsdk/libexec/gypsy-daemon --no-daemon



dbus-daemon --system --nofork

Master options:
  /apps/geoclue/master/org.freedesktop.Geoclue.GPSDevice = /dev/ttymxc0
Found providers:
  geoclue-geonames.provider
  geoclue-plazes.provider
  geoclue-gpsd.provider
  geoclue-nominatim.provider
  geoclue-hostip.provider
  geoclue-manual.provider
  geoclue-localnet.provider
  geoclue-gsmloc.provider
  geoclue-gypsy.provider
  geoclue-yahoo.provider
  geoclue-example.provider
** (process:1181): DEBUG: client: 2 position providers matching 
requirements found, now choosing current provider
** (process:1181): DEBUG: client: connecting to 'GPSd' accuracy-changed 
and status-changed
** (process:1181): DEBUG: client: connecting to 'Gypsy' accuracy-changed 
and status-changed
** (process:1181): DEBUG: client: choosing best provider
** (process:1181): DEBUG:         ...trying provider GPSd
close(7) in netlib_connectsock()

** (process:1183): WARNING **: gps_open() failed, is gpsd running 
(host=(null),port=2947)?
** (process:1181): DEBUG: GPSd: Updating cache
** (process:1181): DEBUG: client: provider GPSd status changed: 2
** (process:1181): DEBUG: client: GPSd accuracy changed (0)
** (process:1181): DEBUG:         ...but provider choice in progress
** (process:1181): DEBUG: client: provider GPSd status changed: 0
** (process:1181): DEBUG:         ...started GPSd (status 0), 
re-starting provider selection
** (process:1181): DEBUG:         ...trying provider Gypsy
Gypsy provider using '/dev/ttymxc0'
** (gypsy-daemon:1187): DEBUG: Creating client for /dev/ttymxc0
** (gypsy-daemon:1187): DEBUG: Device name: ttymxc0
** (gypsy-daemon:1187): DEBUG: Registered client on 
/org/freedesktop/Gypsy/ttymxc0
** (process:1185): DEBUG: starting device
** (gypsy-daemon:1187): DEBUG: Starting connection to /dev/ttymxc0
** (gypsy-daemon:1187): DEBUG: GPS channel can connect
Initial status - 1 (connected)
Gypsy position changed
** (process:1181): DEBUG: Gypsy: Updating cache
** (process:1181): DEBUG: client: provider Gypsy status changed: 2
** (process:1181): DEBUG: client: Gypsy accuracy changed (0)
** (process:1181): DEBUG:         ...but provider choice in progress
** (process:1181): DEBUG: client: provider Gypsy status changed: 1
** (process:1181): DEBUG:         ...started Gypsy (status 1), 
re-starting provider selection
** (process:1181): DEBUG:         ...trying provider Gypsy
** (process:1181): DEBUG:         ...trying provider GPSd
** (process:1181): DEBUG: Gypsy without clients
** (process:1181): DEBUG: GPSd without clients
** (process:1181): DEBUG: client: position provider changed (to NULL)
** (process:1181): DEBUG: client: provider GPSd status changed: 2
** (process:1181): DEBUG: client: provider GPSd status changed: 0





--
Scanned by MailScanner.



More information about the GeoClue mailing list