uspd: Multiple fixes

- Uci Schema updated
- Ubus schema updated
- Config option for sock path
- config option for transaction_timeout
- config option to disable uspd
- Align with latest bbf
- Added tests
This commit is contained in:
vdutta 2020-12-16 15:53:19 +05:30
parent 3bdf2ba11b
commit 86bab4da22
3 changed files with 43 additions and 3 deletions

View file

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uspd
PKG_VERSION:=2.1.7
PKG_VERSION:=2.1.8
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=34791d784cffe69e0c3b69fb75bc219b25a9b5ab
PKG_SOURCE_VERSION:=1dec7e4bcc8004d142fca195d82a013c1e6dbcb2
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
endif

View file

@ -1,3 +1,4 @@
config uspd 'usp'
option granularitylevel '0'
option debug '0'
option loglevel '1'

View file

@ -6,9 +6,48 @@ STOP=10
USE_PROCD=1
PROG=/usr/sbin/uspd
validate_uspd_usp_section()
{
uci_validate_section uspd uspd "usp" \
'enabled:bool:true' \
'granularitylevel:uinteger' \
'debug:bool:false' \
'loglevel:uinteger' \
'sock:string' \
'transaction_timeout:string'
}
configure_uspd()
{
local enabled debug sock transaction_timeout
config_load uspd
validate_uspd_usp_section || {
log "Validation of usp section failed"
return 1;
}
[ ${enabled} -eq 0 ] && exit 0
if [ ${debug} -eq 1 ]; then
procd_set_param stdout 1
procd_set_param stderr 1
fi
if [ -n "${sock}" ]; then
procd_append_param command -s ${sock}
fi
if [ -n "${transaction_timeout}" ]; then
procd_append_param command -t ${transaction_timeout}
fi
}
start_service() {
procd_open_instance
procd_open_instance usp
procd_set_param command ${PROG}
configure_uspd
procd_set_param respawn
procd_close_instance
}