mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 22:47:56 +00:00
f50eb06441
350b960 add support for multi GNSS solutions fb87d0f ugps: add baud rate command line option a8171a0 main.c: -S does not take any options Build-tested: ramips/ltap-2hnd Run-tested: ramips/ltap-2hnd Signed-off-by: Arne Zachlod <arne@nerdkeller.org>
39 lines
784 B
Bash
39 lines
784 B
Bash
#!/bin/sh /etc/rc.common
|
|
# Copyright (c) 2014 OpenWrt.org
|
|
|
|
START=80
|
|
|
|
USE_PROCD=1
|
|
PROG=/usr/sbin/ugps
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger gps
|
|
}
|
|
|
|
start_service() {
|
|
local tty="$(uci get gps.@gps[-1].tty)"
|
|
local baudrate="$(uci get gps.@gps[-1].baudrate || echo 0)"
|
|
local atime="$(uci get gps.@gps[-1].adjust_time)"
|
|
local disabled="$(uci get gps.@gps[-1].disabled || echo 0)"
|
|
|
|
[ "$disabled" == "0" ] || return
|
|
[ "$tty" ] || return
|
|
|
|
case "$tty" in
|
|
"/"*)
|
|
true
|
|
;;
|
|
*)
|
|
tty="/dev/$tty"
|
|
;;
|
|
esac
|
|
|
|
procd_open_instance
|
|
procd_set_param command "$PROG"
|
|
[ "$baudrate" -eq 0 ] || procd_append_param command "-b ${baudrate}"
|
|
[ "$atime" -eq 0 ] || procd_append_param command "-a"
|
|
procd_append_param command "$tty"
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|