mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 01:52:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			114 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			114 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 68f93efdb492ae6fc62855766383fd7184823454 Mon Sep 17 00:00:00 2001
 | |
| From: Tanya Singh <tanya.singh@4ipnet.com>
 | |
| Date: Wed, 11 Sep 2024 18:46:59 +0800
 | |
| Subject: [PATCH] Add AFC related fields to 'ubus call gps info' command
 | |
| 
 | |
| ---
 | |
|  .../001-ubus-gps-add-gst-gsa.patch        | 94 +++++++++++++++++++
 | |
|  1 file changed, 94 insertions(+)
 | |
|  create mode 100644 package/utils/ugps/patches/001-ubus-gps-add-gst-gsa.patch
 | |
| 
 | |
| diff --git a/package/utils/ugps/patches/001-ubus-gps-add-gst-gsa.patch b/package/utils/ugps/patches/001-ubus-gps-add-gst-gsa.patch
 | |
| new file mode 100644
 | |
| index 0000000000..dbb2769e40
 | |
| --- /dev/null
 | |
| +++ b/package/utils/ugps/patches/001-ubus-gps-add-gst-gsa.patch
 | |
| @@ -0,0 +1,94 @@
 | |
| +--- ugps-2021-07-19-a8171a07.orig/nmea.h	2024-09-11 18:38:04.960719689 +0800
 | |
| ++++ ugps-2021-07-19-a8171a07/nmea.h	2024-09-11 18:39:21.029376727 +0800
 | |
| +@@ -23,7 +23,7 @@
 | |
| + 
 | |
| + #include <libubox/ustream.h>
 | |
| + 
 | |
| +-extern char longitude[33], latitude[33], course[17], speed[17], elevation[17];
 | |
| ++extern char longitude[33], latitude[33], course[17], speed[17], elevation[17], major_axis[17], minor_axis[17], major_orientation[17], vdop[17];
 | |
| + extern int nmea_open(char *dev, struct ustream_fd *s, speed_t speed);
 | |
| + extern void gps_timestamp(void);
 | |
| + extern unsigned int adjust_clock;
 | |
| +@@ -33,5 +33,7 @@
 | |
| + #define GPS_FIELD_COG (1<<2)
 | |
| + #define GPS_FIELD_SPD (1<<3)
 | |
| + #define GPS_FIELD_ALT (1<<4)
 | |
| +-
 | |
| ++#define GPS_FIELD_MAJ (1<<5)
 | |
| ++#define GPS_FIELD_MIN (1<<6)
 | |
| ++#define GPS_FIELD_VDOP (1<<7)
 | |
| + #endif
 | |
| +--- ugps-2021-07-19-a8171a07.orig/nmea.c	2024-09-11 18:38:13.452792960 +0800
 | |
| ++++ ugps-2021-07-19-a8171a07/nmea.c	2024-09-11 18:40:00.425717593 +0800
 | |
| +@@ -52,7 +52,7 @@
 | |
| + } nmea_params[MAX_NMEA_PARAM];
 | |
| + 
 | |
| + static int nmea_bad_time;
 | |
| +-char longitude[33] = { 0 }, latitude[33] = { 0 }, course[17] = { 0 }, speed[17] = { 0 }, elevation[17] = { 0 };
 | |
| ++char longitude[33] = { 0 }, latitude[33] = { 0 }, course[17] = { 0 }, speed[17] = { 0 }, elevation[17] = { 0 }, major_axis[17] = { 0 }, minor_axis[17] = { 0 }, major_orientation[17] = { 0 }, vdop[17] = { 0 };
 | |
| + int gps_valid = 0;
 | |
| + char gps_fields = 0;
 | |
| + 
 | |
| +@@ -239,6 +239,30 @@
 | |
| + 	DEBUG(4, "speed: %s\n", speed);
 | |
| + }
 | |
| + 
 | |
| ++static void
 | |
| ++nmea_gst_cb(void)
 | |
| ++{
 | |
| ++	if (!gps_valid)
 | |
| ++		return;
 | |
| ++	strncpy(major_axis, nmea_params[3].str, sizeof(major_axis));
 | |
| ++	strncpy(minor_axis, nmea_params[4].str, sizeof(minor_axis));
 | |
| ++	strncpy(major_orientation, nmea_params[5].str, sizeof(major_orientation));
 | |
| ++	gps_fields |= GPS_FIELD_MAJ | GPS_FIELD_MIN;
 | |
| ++	DEBUG(4, "major_axis: %s\n", major_axis);
 | |
| ++	DEBUG(4, "minor_axis: %s\n", minor_axis);
 | |
| ++	DEBUG(4, "major_orientation: %s\n", major_orientation);
 | |
| ++}
 | |
| ++
 | |
| ++static void
 | |
| ++nmea_gsa_cb(void)
 | |
| ++{
 | |
| ++	if (!gps_valid)
 | |
| ++		return;
 | |
| ++	strncpy(vdop, nmea_params[17].str, sizeof(vdop));
 | |
| ++	gps_fields |= GPS_FIELD_VDOP;
 | |
| ++	DEBUG(4, "vdop: %s\n", vdop);
 | |
| ++}
 | |
| ++
 | |
| + static struct nmea_msg {
 | |
| + 	char *msg;
 | |
| + 	int cnt;
 | |
| +@@ -268,6 +292,14 @@
 | |
| + 		.msg = "ZDA",
 | |
| + 		.cnt = 5,
 | |
| + 		.handler = nmea_zda_cb,
 | |
| ++	}, {
 | |
| ++		.msg = "GST",
 | |
| ++		.cnt = 8,
 | |
| ++		.handler = nmea_gst_cb,
 | |
| ++	}, {
 | |
| ++		.msg = "GSA",
 | |
| ++		.cnt = 18,
 | |
| ++		.handler = nmea_gsa_cb,
 | |
| + 	},
 | |
| + };
 | |
| + 
 | |
| +--- ugps-2021-07-19-a8171a07.orig/main.c	2024-09-11 18:38:23.620880720 +0800
 | |
| ++++ ugps-2021-07-19-a8171a07/main.c	2024-09-11 18:40:24.681927642 +0800
 | |
| +@@ -66,6 +66,14 @@
 | |
| + 			blobmsg_add_string(&b, "course", course);
 | |
| + 		if (gps_fields & GPS_FIELD_SPD)
 | |
| + 			blobmsg_add_string(&b, "speed", speed);
 | |
| ++		if (gps_fields & GPS_FIELD_MAJ) {
 | |
| ++			blobmsg_add_string(&b, "major_axis", major_axis);
 | |
| ++			blobmsg_add_string(&b, "major_orientation", major_orientation);
 | |
| ++		}
 | |
| ++		if (gps_fields & GPS_FIELD_MIN)
 | |
| ++			blobmsg_add_string(&b, "minor_axis", minor_axis);
 | |
| ++		if (gps_fields & GPS_FIELD_VDOP)
 | |
| ++			blobmsg_add_string(&b, "vdop", vdop);
 | |
| + 	}
 | |
| + 	ubus_send_reply(ctx, req, b.head);
 | |
| + 
 | |
| -- 
 | |
| 2.34.1
 | |
| 
 | 
