From b06eac5382baebd2db3715a2bff12f1aa27179fa Mon Sep 17 00:00:00 2001 From: p-wassi Date: Wed, 7 Dec 2016 21:41:06 +0100 Subject: [PATCH 1/6] utils/gpsd: Update to 3.16 Update gpsd to upstream release 3.16 The local patch is already included upstream, therefore removed here. Signed-off-by: Paul Wassi --- utils/gpsd/Makefile | 8 ++-- .../gpsd/patches/0001-Remove-a-BSD-ism.patch | 42 ------------------- 2 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 utils/gpsd/patches/0001-Remove-a-BSD-ism.patch diff --git a/utils/gpsd/Makefile b/utils/gpsd/Makefile index 4adb5316d..f57ecdc51 100644 --- a/utils/gpsd/Makefile +++ b/utils/gpsd/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gpsd -PKG_VERSION:=3.15 -PKG_RELEASE:=2 +PKG_VERSION:=3.16 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=http://download-mirror.savannah.gnu.org/releases/gpsd/ -PKG_MD5SUM:=afd79b87337fadf38ee2a7c4314dac79 +PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME) +PKG_MD5SUM:=68691b5de4c94f82ec4062b042b5eb63 PKG_MAINTAINER:=Pushpal Sidhu PKG_LICENSE:=BSD-3-Clause diff --git a/utils/gpsd/patches/0001-Remove-a-BSD-ism.patch b/utils/gpsd/patches/0001-Remove-a-BSD-ism.patch deleted file mode 100644 index 55004ab6b..000000000 --- a/utils/gpsd/patches/0001-Remove-a-BSD-ism.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 95c99f69e026e8c57aecba545e51c97f3b284e75 Mon Sep 17 00:00:00 2001 -From: "Gary E. Miller" -Date: Tue, 23 Jun 2015 14:36:26 -0700 -Subject: [PATCH] Remove a BSD-ism. - -CTRL('L') is a BSD-ism. CTRL() is defined in sys/ttydefaults.h -which does not always exist. Instead of adding scons tests for -needing CTRL() and its include files just replace with a simple -constant. - -Needed for musl and found by Baruch Siach ---- - gpsmon.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/gpsmon.c b/gpsmon.c -index c3001c8..58c8300 100644 ---- a/gpsmon.c -+++ b/gpsmon.c -@@ -583,6 +583,9 @@ static void select_packet_monitor(struct gps_device_t *device) - (void)wnoutrefresh(devicewin); - } - -+/* Control-L character */ -+#define CTRL_L 0x0C -+ - static char *curses_get_command(void) - /* char-by-char nonblocking input, return accumulated command line on \n */ - { -@@ -591,7 +594,8 @@ static char *curses_get_command(void) - int c; - - c = wgetch(cmdwin); -- if (c == CTRL('L')) { -+ if (CTRL_L == c) { -+ /* ^L is to repaint the screen */ - (void)clearok(stdscr, true); - if (active != NULL && (*active)->initialize != NULL) - (void)(*active)->initialize(); --- -2.6.0 - From 5099e731b36139cdd2a95fc25ddce7b9c0ff7311 Mon Sep 17 00:00:00 2001 From: p-wassi Date: Wed, 7 Dec 2016 21:58:05 +0100 Subject: [PATCH 2/6] utils/gpsd: (cosmetic) update config Make the default config look like usual, i.e.: indentation using tabs, single quotes, booleans 0/1 Signed-off-by: Paul Wassi --- utils/gpsd/files/gpsd.config | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/gpsd/files/gpsd.config b/utils/gpsd/files/gpsd.config index 1a5ddaa30..c0c88e0c4 100644 --- a/utils/gpsd/files/gpsd.config +++ b/utils/gpsd/files/gpsd.config @@ -1,5 +1,5 @@ -config gpsd core - option device "/dev/ttyUSB0" - option port "2947" - option listen_globally "false" - option enabled "false" +config gpsd 'core' + option enabled '0' + option device '/dev/ttyUSB0' + option port '2947' + option listen_globally '0' From 6aaca067d2a886bfb4cf7432a4e17ae0b546af5d Mon Sep 17 00:00:00 2001 From: p-wassi Date: Wed, 7 Dec 2016 22:00:50 +0100 Subject: [PATCH 3/6] utils/gpsd: remove hotplug script Remove a hotplug script, which starts/stops gpsd with attaching/detaching a PL2302 USB-UART device. Signed-off-by: Paul Wassi --- utils/gpsd/Makefile | 2 -- utils/gpsd/files/gpsd.hotplug | 16 ---------------- 2 files changed, 18 deletions(-) delete mode 100644 utils/gpsd/files/gpsd.hotplug diff --git a/utils/gpsd/Makefile b/utils/gpsd/Makefile index f57ecdc51..ee72b9508 100644 --- a/utils/gpsd/Makefile +++ b/utils/gpsd/Makefile @@ -122,8 +122,6 @@ define Package/gpsd/install $(INSTALL_CONF) ./files/gpsd.config $(1)/etc/config/gpsd $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/gpsd.init $(1)/etc/init.d/gpsd - $(INSTALL_DIR) $(1)/etc/hotplug.d/usb - $(INSTALL_DATA) ./files/gpsd.hotplug $(1)/etc/hotplug.d/usb/20-gpsd $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/gpsd $(1)/usr/sbin/ endef diff --git a/utils/gpsd/files/gpsd.hotplug b/utils/gpsd/files/gpsd.hotplug deleted file mode 100644 index fc15ddaee..000000000 --- a/utils/gpsd/files/gpsd.hotplug +++ /dev/null @@ -1,16 +0,0 @@ -case "$ACTION" in - add) - # start process - # only pl2303 devices are handled - if [ "$PRODUCT" = "67b/2303/300" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then - sleep 3 && /etc/init.d/gpsd start - fi - ;; - remove) - # stop process - # only pl2303 devices are handled - if [ "$PRODUCT" = "67b/2303/300" ] && [ "$TYPE" = "0/0/0" ] && [ "$INTERFACE" = "255/0/0" ]; then - /etc/init.d/gpsd stop - fi - ;; -esac From 933d93c68ad7cd0a5f610a73089a73367e9e7b4b Mon Sep 17 00:00:00 2001 From: p-wassi Date: Wed, 7 Dec 2016 23:05:00 +0100 Subject: [PATCH 4/6] utils/gpsd: switch to procd Rewrite init script for procd support Signed-off-by: Paul Wassi --- utils/gpsd/files/gpsd.init | 60 +++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/utils/gpsd/files/gpsd.init b/utils/gpsd/files/gpsd.init index 96cee782d..b7d9ec3e8 100644 --- a/utils/gpsd/files/gpsd.init +++ b/utils/gpsd/files/gpsd.init @@ -2,31 +2,43 @@ # Copyright (C) 2009-2011 OpenWrt.org START=50 +USE_PROCD=1 +PROG=/usr/sbin/gpsd NAME=gpsd -PIDF=/var/run/$NAME.pid -PROG=/usr/sbin/$NAME - -start() { - config_load gpsd - config_get device core device - config_get port core port - config_get_bool listen_globally core listen_globally - config_get_bool enabled core enabled - [ "$enabled" != "1" ] && exit - logger -t "$NAME" "Starting..." - [ ! -c "$device" ] && { - logger -t "$NAME" "Unable to find device $device. Exiting." - exit 1 - } - [ "$listen_globally" != "0" ] && append args "-G" - $PROG -n -P $PIDF -S $port $args $device + +validate_section_gpsd() +{ + uci_validate_section gpsd gpsd "${1}" \ + 'enable:bool:1' \ + 'device:string' \ + 'listen_globally:bool:0' \ + 'port:port:2947' +} + +gpsd_instance() +{ + local device enable listen_globally port + + validate_section_gpsd "${1}" || { + echo "validation failed" + return 1 + } + + [ "${enable}" = "0" ] && return 1 + + procd_open_instance + procd_set_param command "$PROG" -N -n + + [ "${listen_globally}" -ne 0 ] && procd_append_param command -G + procd_append_param command -S "${port}" + procd_append_param command "${device}" + procd_set_param respawn + + procd_close_instance } -stop() { - logger -t "$NAME" "Stopping..." - [ -f "$PIDF" ] && { - read PID < "$PIDF" - kill -9 $PID - rm $PIDF - } +start_service() +{ + config_load "${NAME}" + config_foreach gpsd_instance gpsd } From be6f00b269d76a7f2e3ca06101ee886b1522a3eb Mon Sep 17 00:00:00 2001 From: p-wassi Date: Wed, 7 Dec 2016 23:30:05 +0100 Subject: [PATCH 5/6] utils/gpsd: fix dependencies Remove unneccessary dependencies in gpsd/gpsd-clients/libgps. Signed-off-by: Paul Wassi --- utils/gpsd/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/gpsd/Makefile b/utils/gpsd/Makefile index ee72b9508..36f77360c 100644 --- a/utils/gpsd/Makefile +++ b/utils/gpsd/Makefile @@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/scons.mk define Package/gpsd/Default - DEPENDS:=+librt +libncurses + DEPENDS+= +libusb-1.0 URL:=http://catb.org/gpsd/ endef @@ -43,7 +43,6 @@ define Package/gpsd $(call Package/gpsd/Default) SECTION:=net CATEGORY:=Network - DEPENDS+= +libgps +libusb-1.0 TITLE:=An interface daemon for GPS receivers endef @@ -60,7 +59,7 @@ define Package/gpsd-clients $(call Package/gpsd/Default) SECTION:=net CATEGORY:=Network - DEPENDS+= +libgps +libncurses +libusb-1.0 + DEPENDS+= +libncurses TITLE:=GPS tools and clients endef @@ -74,7 +73,6 @@ define Package/libgps $(call Package/gpsd/Default) SECTION:=libs CATEGORY:=Libraries - DEPENDS+= +libcap TITLE:=C service library for communicating with the GPS daemon endef From 89036708b590c69fb9aa534b9e1b7b996d4c0b22 Mon Sep 17 00:00:00 2001 From: p-wassi Date: Wed, 7 Dec 2016 23:32:11 +0100 Subject: [PATCH 6/6] utils/gpsd: move package to 'Utilities' Move package 'gpsd' and 'gpsd-clients' to menuconfig's 'Utilities' Signed-off-by: Paul Wassi --- utils/gpsd/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/gpsd/Makefile b/utils/gpsd/Makefile index 36f77360c..fb1ff1cb7 100644 --- a/utils/gpsd/Makefile +++ b/utils/gpsd/Makefile @@ -41,8 +41,8 @@ endef define Package/gpsd $(call Package/gpsd/Default) - SECTION:=net - CATEGORY:=Network + SECTION:=utils + CATEGORY:=Utilities TITLE:=An interface daemon for GPS receivers endef @@ -57,8 +57,8 @@ endef define Package/gpsd-clients $(call Package/gpsd/Default) - SECTION:=net - CATEGORY:=Network + SECTION:=utils + CATEGORY:=Utilities DEPENDS+= +libncurses TITLE:=GPS tools and clients endef