summaryrefslogtreecommitdiff
path: root/community-testing/gpsdrive/gpsd-2.96.patch
blob: bc6c7475f8a8b480cb094ac90f2ee98800fe0b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff -wbBur gpsdrive-2.11/src/gps_handler.c gpsdrive-2.11.my/src/gps_handler.c
--- gpsdrive-2.11/src/gps_handler.c	2010-06-24 19:53:32.000000000 +0000
+++ gpsdrive-2.11.my/src/gps_handler.c	2011-04-18 13:21:33.000000000 +0000
@@ -264,7 +264,8 @@
 #define GPS_TIMER 500
 
 static gint gps_timeout_source = 0;
-static struct gps_data_t *gpsdata;
+static struct gps_data_t __gd;
+static struct gps_data_t *gpsdata = &__gd;
 
 /* SYMBOLS USED IN LIBGPS:
  * 
@@ -410,9 +411,10 @@
 	 */
 	gps_query (gpsdata, "oys\n");
 #else
-	if (gps_waiting(gpsdata))
+	if (gps_waiting(gpsdata, 1000000))
 	{
-		gps_poll (gpsdata);
+		gps_read (gpsdata);
+		gps_hook_cb(gpsdata, NULL);
 	}
 #endif
 
@@ -447,7 +449,7 @@
 	}
 
 	/* try to open connection */
-	gpsdata =  gps_open (local_config.gpsd_server, local_config.gpsd_port);
+	gpsdata = gps_open (local_config.gpsd_server, local_config.gpsd_port, gpsdata) ? NULL : &__gd;
 	if (!gpsdata)
 	{
 		g_print ("Can't connect to gps daemon on %s:%s, disabling GPS support!\n",
@@ -466,7 +468,7 @@
 	gps_sats = g_new (gps_satellite_struct, MAXCHANNELS);
 
 	/* set hook function to handle gps data */
-	gps_set_raw_hook (gpsdata, (gpointer) gps_hook_cb);
+//	gps_set_raw_hook (gpsdata, (gpointer) gps_hook_cb);
 
 #ifndef LIBGPS_OLD
 	/* enable watch mode to get data stream from gpsd */