diff --git a/utils/gpsd/Makefile b/utils/gpsd/Makefile index 806740b42c..cd796eb672 100644 --- a/utils/gpsd/Makefile +++ b/utils/gpsd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gpsd PKG_VERSION:=3.25 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME) @@ -144,6 +144,9 @@ define Package/gpsd/install $(INSTALL_DIR) $(1)/etc/gpsd $(INSTALL_BIN) ./files/etc/gpsd/device-hook $(1)/etc/gpsd/ + + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/ endef define Package/gpsd-clients/install diff --git a/utils/gpsd/files/etc/uci-defaults/50-gpsd-migrate-device b/utils/gpsd/files/etc/uci-defaults/50-gpsd-migrate-device new file mode 100644 index 0000000000..9a164f7893 --- /dev/null +++ b/utils/gpsd/files/etc/uci-defaults/50-gpsd-migrate-device @@ -0,0 +1,17 @@ +. /lib/functions.sh + +gpsd_migrate_device() { + local device + + device="$(uci_get gpsd core device)" + + [ -z "$device" ] && return + + uci_add_list gpsd core devices "$device" + uci_remove gpsd core device + uci_commit gpsd +} + +gpsd_migrate_device + +exit 0 diff --git a/utils/gpsd/files/gpsd.config b/utils/gpsd/files/gpsd.config index c0c88e0c46..c49a44e332 100644 --- a/utils/gpsd/files/gpsd.config +++ b/utils/gpsd/files/gpsd.config @@ -1,5 +1,5 @@ config gpsd 'core' option enabled '0' - option device '/dev/ttyUSB0' option port '2947' option listen_globally '0' + list devices '/dev/ttyUSB0' diff --git a/utils/gpsd/files/gpsd.init b/utils/gpsd/files/gpsd.init index 5aad90ffc6..94dcd2a6d7 100644 --- a/utils/gpsd/files/gpsd.init +++ b/utils/gpsd/files/gpsd.init @@ -13,13 +13,15 @@ validate_section_gpsd() uci_load_validate gpsd gpsd "$1" "$2" \ 'enabled:bool:1' \ 'readonly:bool:1' \ - 'device:string' \ + 'devices:list(string)' \ 'listen_globally:bool:0' \ 'port:port:2947' } gpsd_instance() { + local device + [ "$2" = 0 ] || { echo "validation failed" return 1 @@ -35,7 +37,9 @@ gpsd_instance() procd_append_param command -D "$LOG_LEVEL" [ "$readonly" = "1" ] && procd_append_param command -b procd_append_param command -F /var/run/gpsd.sock - [ -n "$device" ] && procd_append_param command "$device" + for device in $devices; do + procd_append_param command "$device" + done procd_set_param respawn procd_close_instance