summaryrefslogtreecommitdiff
path: root/recipes-extended/multitech/venus-gps/fix_nmea_intervals.patch
blob: 41ce262a9e416e69ea9286c2d91c6cacc535ab54 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 35e865bbe72085260bd48fdc65eba0887fe32360 Mon Sep 17 00:00:00 2001
From: Serhii Voloshynov <serhii.voloshynov@globallogic.com>
Date: Thu, 3 Jan 2019 09:32:41 +0200
Subject: [PATCH] fix setting of NMEA sentences intervals, add --quit parameter

---
 src/venus_gps.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/venus_gps.c b/src/venus_gps.c
index 77c7e73..2f6bf44 100644
--- a/src/venus_gps.c
+++ b/src/venus_gps.c
@@ -788,6 +788,8 @@ static void usage(FILE * out)
 	fprintf(out, "         --gpzda 0-255 (default: 1) |\n");
 #endif
 	fprintf(out, "         --gpvtg 0-255 (default: 1)\n");
+	fprintf(out, "\n");
+	fprintf(out, "         --quit \n");
 	fprintf(out, "       }\n");
 	fprintf(out, "\n");
 }
@@ -819,6 +821,7 @@ enum {
 	OPT_SERIAL_CLIENT,
 	OPT_ID_PREFIX,
 	OPT_ID,
+	OPT_QUIT
 };
 
 static char *short_options = "b:d:p:f";
@@ -852,6 +855,7 @@ static struct option long_options[] = {
 	{"longitude", 1, 0, OPT_LONGITUDE},
 	{"altitude", 1, 0, OPT_ALTITUDE},
 #endif
+	{"quit", 0, 0, OPT_QUIT},
 	{"version", 0, NULL, OPT_VERSION},
 	{"help", 0, NULL, OPT_HELP},
 	{0, 0, 0, 0},
@@ -864,6 +868,7 @@ int main(int argc, char *argv[])
 	char *cp;
 	int option_index;
 	int tty;
+	int quit =0;
 	struct venus_msg msg;
 
 	struct socket_client_args *sc;
@@ -883,6 +888,10 @@ int main(int argc, char *argv[])
 			daemonize = 1;
 			break;
 
+		case OPT_QUIT:
+			quit = 1;
+			break;
+
 		case OPT_DEVICE:
 			device = optarg;
 			break;
@@ -1145,7 +1154,7 @@ int main(int argc, char *argv[])
 	}
 #endif
 
-	tmp = venus_conf_nmea(tty, 1, 1, 1, 1, 1, 1, 0, UPDATE_ATTR_SRAM);
+	tmp = venus_conf_nmea(tty, gpgga, gpgsa, gpgsv, gpgll, gprmc, gpvtg, 0, UPDATE_ATTR_SRAM);
 	if (tmp < 0) {
 		log_error("failed to configure nmea sentences");
 		exit(1);
@@ -1158,6 +1167,9 @@ int main(int argc, char *argv[])
 	}
 
 	venus_close(tty);
+	if (quit) {
+		exit(0);
+	}
 
 	sigset_t sigset;
 	sigemptyset(&sigset);
-- 
2.7.4