More than one device can be added to the gpsd at startup. Currently the gpsd
service start script in OpenWrt treats this as an option with only one value.
To allow multiple devices to be specified, the uci 'option device' must be
removed and a new uci 'list devices' is added.
This change means that several devices can be specified at gpsd start with
the new uci 'list devices' configuration.
Running configurations in the field are migrated by a migration script.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
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)
$(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
--- /dev/null
+. /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
config gpsd 'core'
option enabled '0'
- option device '/dev/ttyUSB0'
option port '2947'
option listen_globally '0'
+ list devices '/dev/ttyUSB0'
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
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