summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--geoclue/Pkgfile6
-rw-r--r--geoclue/gpsd-3.4.patch75
2 files changed, 78 insertions, 3 deletions
diff --git a/geoclue/Pkgfile b/geoclue/Pkgfile
index 5050d19..fc0c0dd 100644
--- a/geoclue/Pkgfile
+++ b/geoclue/Pkgfile
@@ -7,17 +7,17 @@
name=geoclue
version=0.12
-release=2
+release=3
source=(http://cgit.freedesktop.org/$name/snapshot/$name-$version.tar.bz2
geoclue-NMCrash.patch
geoclue-nm08.patch
- gpsd-3.3.patch)
+ gpsd-3.4.patch)
build() {
cd $name-$version
patch -p1 < ../geoclue-NMCrash.patch
patch -p1 < ../geoclue-nm08.patch
- patch -p0 < ../gpsd-3.3.patch
+ patch -p1 < ../gpsd-3.4.patch
./autogen.sh
sed "s/-Werror//g" -i configure
./configure --prefix=/usr \
diff --git a/geoclue/gpsd-3.4.patch b/geoclue/gpsd-3.4.patch
new file mode 100644
index 0000000..6a71017
--- /dev/null
+++ b/geoclue/gpsd-3.4.patch
@@ -0,0 +1,75 @@
+Description: Refactoring to support new libgps API
+Author: James Page <james.page@ubuntu.com>
+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40996
+Forwarded: no
+
+Index: geoclue-providers-0.12.0/providers/gpsd/geoclue-gpsd.c
+===================================================================
+--- geoclue-providers-0.12.0.orig/providers/gpsd/geoclue-gpsd.c 2011-12-14 10:57:44.000000000 +0000
++++ geoclue-providers-0.12.0/providers/gpsd/geoclue-gpsd.c 2011-12-14 11:03:11.271878045 +0000
+@@ -40,7 +40,12 @@
+ #include <geoclue/gc-iface-position.h>
+ #include <geoclue/gc-iface-velocity.h>
+
++#if GPSD_API_MAJOR_VERSION >= 5
++/* gps_data conflicts with gps_data function */
++typedef struct gps_data_t gps_data_l;
++#else
+ typedef struct gps_data_t gps_data;
++#endif
+ typedef struct gps_fix_t gps_fix;
+
+ /* only listing used tags */
+@@ -59,7 +64,11 @@
+ char *host;
+ char *port;
+
++#if GPSD_API_MAJOR_VERSION >= 5
++ gps_data_l *gpsdata;
++#else
+ gps_data *gpsdata;
++#endif
+
+ gps_fix *last_fix;
+
+@@ -394,10 +403,16 @@
+ static gboolean
+ geoclue_gpsd_start_gpsd (GeoclueGpsd *self)
+ {
++#if GPSD_API_MAJOR_VERSION >= 5
++ int status = gps_open (self->host, self->port, self->gpsdata);
++ if (status == 0) {
++ gps_stream(self->gpsdata, WATCH_ENABLE | WATCH_NMEA, NULL);
++#else
+ self->gpsdata = gps_open (self->host, self->port);
+ if (self->gpsdata) {
+ gps_stream(self->gpsdata, WATCH_ENABLE | WATCH_NMEA | POLL_NONBLOCK, NULL);
+ gps_set_raw_hook (self->gpsdata, gpsd_raw_hook);
++#endif
+ return TRUE;
+ } else {
+ g_warning ("gps_open() failed, is gpsd running (host=%s,port=%s)?", self->host, self->port);
+@@ -410,10 +425,23 @@
+ {
+ GeoclueGpsd *self = (GeoclueGpsd*)data;
+ if (self->gpsdata) {
++#if GPSD_API_MAJOR_VERSION >= 5
++ /* gps_poll and gps_set_raw_hook no longer present in this API version */
++ if (gps_waiting(self->gpsdata, 500)) {
++ if (gps_read(self->gpsdata) == -1) {
++ geoclue_gpsd_set_status (self, GEOCLUE_STATUS_ERROR);
++ geoclue_gpsd_stop_gpsd(self);
++ return FALSE;
++ } else {
++ /* Call existing raw_hook to process the data */
++ gpsd_raw_hook(self->gpsdata, NULL, 0);
++ }
++#else
+ if (gps_poll(self->gpsdata) < 0) {
+ geoclue_gpsd_set_status (self, GEOCLUE_STATUS_ERROR);
+ geoclue_gpsd_stop_gpsd(self);
+ return FALSE;
++#endif
+ }
+ }
+ return TRUE;