hamlib: Added init and config files
Signed-off-by: Jesper Henriksen <mail-openwrt@jesper.io>
This commit is contained in:
parent
b064f6b5db
commit
45f6a8ddd2
3 changed files with 111 additions and 1 deletions
|
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=hamlib
|
||||
PKG_VERSION:=4.5.4
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=@SF/hamlib
|
||||
|
@ -43,6 +43,10 @@ define Package/hamlib
|
|||
DEPENDS:=+libhamlib
|
||||
endef
|
||||
|
||||
define Package/hamlib/conffiles
|
||||
/etc/config/rigctld
|
||||
endef
|
||||
|
||||
define Package/hamlib/description
|
||||
$(call Package/hamlib/Default/description)
|
||||
|
||||
|
@ -90,6 +94,12 @@ CONFIGURE_VARS+= \
|
|||
define Package/hamlib/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/{rig,rot}* $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/rigctld.init $(1)/etc/init.d/rigctld
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/rigctld.conf $(1)/etc/config/rigctld
|
||||
endef
|
||||
|
||||
define Package/libhamlib/install
|
||||
|
|
24
utils/hamlib/files/rigctld.conf
Normal file
24
utils/hamlib/files/rigctld.conf
Normal file
|
@ -0,0 +1,24 @@
|
|||
config rig 'kx3'
|
||||
option enabled '0'
|
||||
option model '2045'
|
||||
option rig_file '/dev/ttyUSB0'
|
||||
option serial_speed '38400'
|
||||
|
||||
config rig 'example'
|
||||
option enabled '0'
|
||||
option model ''
|
||||
option rig_file ''
|
||||
option ptt_file ''
|
||||
option dcd_file ''
|
||||
option ptt_type ''
|
||||
option dcd_type ''
|
||||
option serial_speed ''
|
||||
option civaddr ''
|
||||
option listen_addr ''
|
||||
option port ''
|
||||
option set_conf ''
|
||||
option vfo ''
|
||||
option verbose ''
|
||||
option twiddle_timeout ''
|
||||
option uplink ''
|
||||
option debug_time_stamps ''
|
76
utils/hamlib/files/rigctld.init
Executable file
76
utils/hamlib/files/rigctld.init
Executable file
|
@ -0,0 +1,76 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=50
|
||||
STOP=50
|
||||
|
||||
NAME=rigctld
|
||||
TYPE=rig
|
||||
BIN=/usr/bin/rigctld
|
||||
|
||||
# option model '1234' => --model=1234
|
||||
OPTIONS_STRING="model rig_file ptt_file dcd_file ptt_type dcd_type serial_speed civaddr listen_addr port set_conf twiddle_timeout uplink"
|
||||
# option vfo '1' => --vfo
|
||||
OPTIONS_BOOL="debug_time_stamps vfo"
|
||||
# option verbose '3' => --verbose --verbose --verbose
|
||||
OPTIONS_CUMULATIVE="verbose"
|
||||
|
||||
start_service() {
|
||||
local instance="$1"
|
||||
|
||||
config_load "${NAME}"
|
||||
|
||||
if [ -n "$instance" ]; then
|
||||
start_instance "$instance"
|
||||
else
|
||||
config_foreach start_instance "$TYPE"
|
||||
fi
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local instance="$1"
|
||||
|
||||
config_get_bool "enabled" "$instance" "enabled" 0
|
||||
[ "$enabled" -gt 0 ] || return
|
||||
|
||||
procd_open_instance "$instance"
|
||||
|
||||
procd_set_param command "$BIN"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
local option
|
||||
local value
|
||||
|
||||
for option in $OPTIONS_STRING; do
|
||||
config_get value "$instance" "$option"
|
||||
[ -n "$value" ] || continue
|
||||
|
||||
option="${option//_/-}"
|
||||
procd_append_param command "--$option=$value"
|
||||
done
|
||||
|
||||
for option in $OPTIONS_BOOL; do
|
||||
config_get_bool value "$instance" "$option" 0
|
||||
[ "$value" -eq 1 ] || continue
|
||||
|
||||
option="${option//_/-}"
|
||||
procd_append_param command "--$option"
|
||||
done
|
||||
|
||||
for option in $OPTIONS_CUMULATIVE; do
|
||||
config_get value "$instance" "$option" 0
|
||||
[ -n "$value" ] || continue
|
||||
|
||||
option="${option//_/-}"
|
||||
|
||||
local i=0
|
||||
while [ $i -lt "$value" ]; do
|
||||
procd_append_param command "--$option"
|
||||
let i++
|
||||
done
|
||||
done
|
||||
|
||||
procd_close_instance
|
||||
}
|
Loading…
Reference in a new issue