From a9d3d75f87a8c25e7cca7a6bc23784fae4c96bc9 Mon Sep 17 00:00:00 2001 From: Mykyta Dorokhin Date: Tue, 28 Dec 2021 16:53:45 +0200 Subject: gps: reintegrate 3.20 patches to 3.23.1; remove unused init script --- .../gpsd/gpsd-3.23.1/0006-itu_r_tf_460_6.patch | 37 +++++ .../gpsd/gpsd-3.23.1/0006-ubxtimelps.patch | 77 ++++++++++ .../gpsd/gpsd-3.23.1/0007-add-gll-vtg.patch | 74 ++++++++++ recipes-navigation/gpsd/gpsd-3.23.1/gpsd.init | 158 --------------------- recipes-navigation/gpsd/gpsd_3.23.1.bb | 35 +++-- 5 files changed, 212 insertions(+), 169 deletions(-) create mode 100644 recipes-navigation/gpsd/gpsd-3.23.1/0006-itu_r_tf_460_6.patch create mode 100644 recipes-navigation/gpsd/gpsd-3.23.1/0006-ubxtimelps.patch create mode 100644 recipes-navigation/gpsd/gpsd-3.23.1/0007-add-gll-vtg.patch delete mode 100644 recipes-navigation/gpsd/gpsd-3.23.1/gpsd.init (limited to 'recipes-navigation') diff --git a/recipes-navigation/gpsd/gpsd-3.23.1/0006-itu_r_tf_460_6.patch b/recipes-navigation/gpsd/gpsd-3.23.1/0006-itu_r_tf_460_6.patch new file mode 100644 index 0000000..e17cfad --- /dev/null +++ b/recipes-navigation/gpsd/gpsd-3.23.1/0006-itu_r_tf_460_6.patch @@ -0,0 +1,37 @@ +From 799f41e6bf0955d04510f16b33cdf731d27a597a Mon Sep 17 00:00:00 2001 +From: Mykyta Dorokhin +Date: Tue, 28 Dec 2021 15:46:42 +0200 +Subject: [PATCH] Reintegrate 0006-itu_r_tf_460_6.patch + +--- + gpsd/ntpshmwrite.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/gpsd/ntpshmwrite.c b/gpsd/ntpshmwrite.c +index 3f2ded3..5f0524b 100644 +--- a/gpsd/ntpshmwrite.c ++++ b/gpsd/ntpshmwrite.c +@@ -39,11 +39,20 @@ void ntp_write(volatile struct shmTime *shmseg, + * ITU-R TF.460-6, Section 2.1, says laep seconds can be primarily + * in Jun/Dec but may be in March or September + */ ++ ++/* This code contradicts page 3 section 2.1 of ITU-R RV.460-6 that ++ * leap second may occur at the last second of a month, with ++ * preference for December and June, 2nd preference to March and ++ * September. ++ * https://www.itu.int/dms_pubrec/itu-r/rec/tf/R-REC-TF.460-6-200202-I!!PDF-E.pdf ++ */ ++#ifdef NOTITU_R_TF_460_6 + (void)gmtime_r( &(td->real.tv_sec), &tm); + if ( 5 != tm.tm_mon && 11 != tm.tm_mon ) { + /* Not june, not December, no way */ + leap_notify = LEAP_NOWARNING; + } ++#endif /* NOTITU_R_TF_460_6 */ + + /* we use the shmTime mode 1 protocol + * +-- +2.25.1 + diff --git a/recipes-navigation/gpsd/gpsd-3.23.1/0006-ubxtimelps.patch b/recipes-navigation/gpsd/gpsd-3.23.1/0006-ubxtimelps.patch new file mode 100644 index 0000000..6f92aea --- /dev/null +++ b/recipes-navigation/gpsd/gpsd-3.23.1/0006-ubxtimelps.patch @@ -0,0 +1,77 @@ +From 830a414311ee287340b11b60f5c6bb58aad7074f Mon Sep 17 00:00:00 2001 +From: Mykyta Dorokhin +Date: Tue, 28 Dec 2021 15:35:38 +0200 +Subject: [PATCH] Add missing leap seconds parts + +--- + SConscript | 1 + + drivers/driver_ubx.c | 19 +++++++++++++++++++ + 2 files changed, 20 insertions(+) + +diff --git a/SConscript b/SConscript +index 8c6136d..3ae2a7b 100644 +--- a/SConscript ++++ b/SConscript +@@ -315,6 +315,7 @@ boolopts = ( + ("tripmate", True, "DeLorme TripMate support"), + ("tsip", True, "Trimble TSIP support"), + ("ublox", True, "u-blox Protocol support"), ++ ("ubloxtimels", False, "u-blox UBX-NAV-TIMELS support (leap second)"), + # Non-GPS protocols + ("aivdm", True, "AIVDM support"), + ("gpsclock", True, "GPSClock support"), +diff --git a/drivers/driver_ubx.c b/drivers/driver_ubx.c +index bea2de0..e9f8a1c 100644 +--- a/drivers/driver_ubx.c ++++ b/drivers/driver_ubx.c +@@ -3798,7 +3798,10 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf, + mask = ubx_msg_nav_timegps(session, &buf[UBX_PREFIX_LEN], data_len); + break; + case UBX_NAV_TIMELS: ++ GPSD_LOG(LOG_PROG, &session->context->errout, "UBX_NAV_TIMELS\n"); ++#ifdef UBLOXTIMELS_ENABLE + mask = ubx_msg_nav_timels(session, &buf[UBX_PREFIX_LEN], data_len); ++#endif // UBLOXTIMELS_ENABLE + break; + case UBX_NAV_TIMEQZSS: + GPSD_LOG(LOG_PROG, &session->context->errout, "UBX-NAV-TIMEQZSS\n"); +@@ -3853,6 +3856,7 @@ gps_mask_t ubx_parse(struct gps_device_t * session, unsigned char *buf, + GPSD_LOG(LOG_PROG, &session->context->errout, "UBX-RXM-RTCM\n"); + break; + case UBX_RXM_SFRB: ++ GPSD_LOG(LOG_DATA, &session->context->errout, "UBX_RXM_SFRB\n"); + mask = ubx_msg_rxm_sfrb(session, &buf[UBX_PREFIX_LEN], data_len); + break; + case UBX_RXM_SFRBX: +@@ -4267,6 +4271,14 @@ ubx_cfg_prt(struct gps_device_t *session, speed_t speed, const char parity, + (void)ubx_write(session, UBX_CLASS_CFG, 0x01, msg, 3); + } + ++#ifdef UBLOXTIMELS_ENABLE ++ msg[0] = 0x01; /* class */ ++ msg[1] = 0x26; /* msg id = UBX_NAV_TIMELS */ ++ msg[2] = 0xff; /* rate */ ++ (void)ubx_write(session, 0x06u, 0x01, msg, 3); ++#endif /* UBLOXTIMELS_ENABLE */ ++ ++ + } else { /* MODE_BINARY */ + // nmea to turn off + const unsigned char nmea_off[] = { +@@ -4349,6 +4361,13 @@ ubx_cfg_prt(struct gps_device_t *session, speed_t speed, const char parity, + (void)ubx_write(session, UBX_CLASS_CFG, 0x01, msg, 3); + } + ++#ifdef UBLOXTIMELS_ENABLE ++ msg[0] = 0x01; /* class */ ++ msg[1] = 0x26; /* msg id = UBX_NAV_TIMELS */ ++ msg[2] = 0xff; /* rate */ ++ (void)ubx_write(session, 0x06u, 0x01, msg, 3); ++#endif /* UBLOXTIMELS_ENABLE */ ++ + /* if protver unknown, turn on everything. Which may be too + * much for slower serial port speeds. Hope that we know protver + * later and can fix things then. */ +-- +2.25.1 + diff --git a/recipes-navigation/gpsd/gpsd-3.23.1/0007-add-gll-vtg.patch b/recipes-navigation/gpsd/gpsd-3.23.1/0007-add-gll-vtg.patch new file mode 100644 index 0000000..777c0ca --- /dev/null +++ b/recipes-navigation/gpsd/gpsd-3.23.1/0007-add-gll-vtg.patch @@ -0,0 +1,74 @@ +From 596089b8582097c1f934a5d25035353f00118965 Mon Sep 17 00:00:00 2001 +From: Mykyta Dorokhin +Date: Tue, 28 Dec 2021 15:56:07 +0200 +Subject: [PATCH] add GLL and VTG to 'gpspipe -r' output in binary mode + +--- + gpsd/pseudonmea.c | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/gpsd/pseudonmea.c b/gpsd/pseudonmea.c +index 2d63d0f..feb9867 100644 +--- a/gpsd/pseudonmea.c ++++ b/gpsd/pseudonmea.c +@@ -171,6 +171,21 @@ void gpsd_position_fix_dump(struct gps_device_t *session, + * Differential base station ID */ + (void)strlcat(bufp, ",", len); + nmea_add_checksum(bufp); ++ ++ //$GNGGA,103527.00,4957.22994,N,03618.97862,E,1,12,0.89,180.3,M,17.0,M,,*4B ++ //$GNGLL,4957.22997,N,03618.97858,E,103526.00,A,A*7B ++ //we use the same values as in GGA sentence ++ char *bufgll = &bufp[strlen(bufp)]; ++ (void)snprintf(bufgll, len, ++ "$GPGLL,%s,%c,%s,%c,%s,%c,A,", ++ lat_str, ++ ((session->gpsdata.fix.latitude > 0) ? 'N' : 'S'), ++ lon_str, ++ ((session->gpsdata.fix.longitude > 0) ? 'E' : 'W'), ++ time_str, ++ ((fixquality != FIX_QUALITY_INVALID) ? 'A' : 'V') ++ ); ++ nmea_add_checksum(bufgll); + } + } + +@@ -183,6 +198,7 @@ static void gpsd_transit_fix_dump(struct gps_device_t *session, + char lat_str[BUF_SZ]; + char lon_str[BUF_SZ]; + char speed_str[BUF_SZ]; ++ char kspeed_str[BUF_SZ]; + char track_str[BUF_SZ]; + char var_str[BUF_SZ]; + char *var_dir = ""; +@@ -231,6 +247,27 @@ static void gpsd_transit_fix_dump(struct gps_device_t *session, + time2_str, + var_str, var_dir); + nmea_add_checksum(bufp); ++ ++ //$GNRMC,114740.00,A,4957.22826,N,03618.97015,E,0.054,,091220,,,A*65 ++ //$GNVTG,,T,,M,0.054,N,0.100,K,A*3D ++ //1 = Track made good ++ //2 = Fixed text 'T' indicates that track made good is relative to true north ++ //3 = Track made good, degrees Magnetic ++ //4 = Magnetic track indicator - 'M' ++ //5 = Speed over ground in knots ++ //6 = Fixed text 'N' indicates that speed over ground in in knots ++ //7 = Speed over ground in kilometers/hour ++ //8 = Fixed text 'K' indicates that speed over ground is in kilometers/hour ++ //we use the same values as in RMC sentence ++ char *bufvtg = &bufp[strlen(bufp)]; ++ (void)snprintf(bufvtg, len, ++ "$GPVTG,%s,T,%s,M,%s,N,%s,K,A,", ++ track_str, ++ track_str,//it is not Magnetic track, but may be it is enough ++ speed_str, ++ f_str(session->gpsdata.fix.speed, "%.4f", kspeed_str) ++ ); ++ nmea_add_checksum(bufvtg); + } + + static void gpsd_binary_satellite_dump(struct gps_device_t *session, +-- +2.25.1 + diff --git a/recipes-navigation/gpsd/gpsd-3.23.1/gpsd.init b/recipes-navigation/gpsd/gpsd-3.23.1/gpsd.init deleted file mode 100644 index c9db0bb..0000000 --- a/recipes-navigation/gpsd/gpsd-3.23.1/gpsd.init +++ /dev/null @@ -1,158 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: gpsd -# Required-Start: $remote_fs $syslog $network -# Should-Start: bluetooth dbus udev -# Required-Stop: $remote_fs $syslog $network -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# X-Start-Before: ntp -# Short-Description: GPS (Global Positioning System) daemon start/stop script -# Description: Start/Stop script for the gpsd service daemon, -# which is able to monitor one or more GPS devices -# connected to a host computer, making all data on -# the location and movements of the sensors available -# to be queried on TCP port 2947. -### END INIT INFO - - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -DESC="GPS (Global Positioning System) daemon" -NAME="gpsd" -DAEMON=/usr/sbin/$NAME -PIDFILE=/var/run/$NAME.pid - -. /etc/init.d/functions || exit 1 - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -if [ -z "$GPSD_SOCKET" ] && [ -z "$DEVICES" ]; then - GPSD_SOCKET=/var/run/gpsd.sock -fi - -if [ -n "$GPSD_SOCKET" ]; then - GPSD_OPTIONS="$GPSD_OPTIONS -F $GPSD_SOCKET" -fi - -DAEMON_ARGS="$GPSD_OPTIONS $DEVICES" - -# -# Function that starts the daemon/service -# -do_start() { - local status pid - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC already running ($pid)." - exit 1 - ;; - *) - echo "Starting $DESC ..." - exec $DAEMON $DAEMON_ARGS >/dev/null 2>&1 || status=$? - echo "ERROR: Failed to start $DESC." - exit $status - ;; - esac -} - -# -# Function that stops the daemon/service -# -do_stop() { - local pid status - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - # Exit when fail to stop, the kill would complain when fail - kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \ - echo "Stopped $DESC ($pid)." || exit $? - ;; - *) - echo "$DESC is not running; none killed." >&2 - ;; - esac - - return $status -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - local pid status - - status=0 - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "Reloading $DESC ..." - kill -s 1 $pid || exit $? - ;; - *) - echo "$DESC is not running; none reloaded." >&2 - ;; - esac - exit $status -} - - -# -# Function that shows the daemon/service status -# -status_of_proc () { - local pid status - - status=0 - # pidof output null when no program is running, so no "2>/dev/null". - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC is running ($pid)." - exit 0 - ;; - *) - echo "$DESC is not running." >&2 - exit $status - ;; - esac -} - -case "$1" in -start) - do_start - ;; -stop) - do_stop || exit $? - ;; -status) - status_of_proc - ;; -restart) - # Always start the service regardless the status of do_stop - do_stop - do_start - ;; -force-reload) - # Only start the service when do_stop succeeds - do_stop && do_start - ;; -*) - echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac diff --git a/recipes-navigation/gpsd/gpsd_3.23.1.bb b/recipes-navigation/gpsd/gpsd_3.23.1.bb index 9af661e..2d7ad0e 100644 --- a/recipes-navigation/gpsd/gpsd_3.23.1.bb +++ b/recipes-navigation/gpsd/gpsd_3.23.1.bb @@ -6,8 +6,18 @@ DEPENDS = "dbus ncurses python3 pps-tools" PROVIDES = "virtual/gpsd" SRC_URI = "${SAVANNAH_GNU_MIRROR}/${BPN}/${BP}.tar.gz \ - file://gpsd.init \ - " + file://0006-ubxtimelps.patch \ + file://0007-add-gll-vtg.patch \ + file://gpsd-default \ + file://gpsd \ + file://gpsd_ubx_fixed.sh \ + file://gpsd_ubx_settime.sh \ + file://gpsd_fixed.sh \ + file://gpsd_settime.sh \ + file://gpsd.rules \ + file://gpsd.service \ +" + SRC_URI[sha256sum] = "0b991ce9a46538c4ea450f7a8ee428ff44fb4f8d665fddf2ffe40fe0ae9a6c09" inherit scons update-rc.d python3-dir python3native systemd update-alternatives pkgconfig @@ -88,9 +98,6 @@ EXTRA_OESCONS = " \ ${PACKAGECONFIG_CONFARGS} \ " - - - # This cannot be used, because then chrpath is not found and only static lib is built # target=${HOST_SYS} @@ -117,10 +124,16 @@ do_install() { } do_install_append() { - install -d ${D}${sysconfdir}/init.d - install -m 0755 ${WORKDIR}/gpsd.init ${D}${sysconfdir}/init.d/gpsd - install -d ${D}${sysconfdir}/default - install -m 0644 ${S}/packaging/deb/etc_default_gpsd ${D}${sysconfdir}/default/gpsd.default + install -d ${D}/${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/gpsd ${D}/${sysconfdir}/init.d/ + install -d ${D}/${sysconfdir}/default + install -m 0644 ${WORKDIR}/gpsd-default ${D}/${sysconfdir}/default/gpsd.default + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/gpsd_ubx_fixed.sh ${D}${sbindir}/gpsd_ubx_fixed + install -m 0755 ${WORKDIR}/gpsd_ubx_settime.sh ${D}${sbindir}/gpsd_ubx_settime + install -m 0755 ${WORKDIR}/gpsd_fixed.sh ${D}${sbindir}/gpsd_fixed + install -m 0755 ${WORKDIR}/gpsd_settime.sh ${D}${sbindir}/gpsd_settime + # Support for python install -d ${D}${PYTHON_SITEPACKAGES_DIR}/gps @@ -136,7 +149,7 @@ FILES_${PN}-dev += "${libdir}/libQgpsmm.prl" FILES_${PN}-doc += "${datadir}/${BPN}/doc" -RDEPENDS_${PN} = "gpsd-gpsctl" +RDEPENDS_${PN} = "bash gpsd-gpsctl" RRECOMMENDS_${PN} = "gpsd-conf gpsd-udev gpsd-machine-conf" SUMMARY_gpsd-udev = "udev relevant files to use gpsd hotplugging" @@ -149,6 +162,7 @@ FILES_libgps = "${libdir}/libgps.so.*" SUMMARY_gpsd-conf = "gpsd configuration files and init scripts" FILES_gpsd-conf = "${sysconfdir}" CONFFILES_gpsd-conf = "${sysconfdir}/default/gpsd.default" +RDEPENDS_gpsd-conf = "bash" SUMMARY_gpsd-gpsctl = "Tool for tweaking GPS modes" FILES_gpsd-gpsctl = "${bindir}/gpsctl" @@ -169,7 +183,6 @@ FILES_gps-utils = "\ ${bindir}/gpsdecode \ ${bindir}/gpsfake \ ${bindir}/gpsmon \ - ${bindir}/gpspipe \ ${bindir}/gpsplot \ ${bindir}/gpsprof \ ${bindir}/gpsrinex \ -- cgit v1.2.3