mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
wifidmd: Refactor 'wifidmd' into a unified daemon
This commit is contained in:
parent
0cded2b974
commit
324244d26b
4 changed files with 54 additions and 14 deletions
|
|
@ -4,7 +4,7 @@ config WIFIDMD_DISABLE_LEGACY_WIFI
|
|||
bool "Disable legacy Wireless Objects like WiFi.Radio., WiFi.SSID., WiFi.AccessPoint. etc"
|
||||
default n
|
||||
|
||||
config WIFIDMD_WIFI_DATAELEMENTS
|
||||
config WIFIDMD_ENABLE_WIFI_DATAELEMENTS
|
||||
bool "Enable Device.WiFi.DataElements. Object"
|
||||
default y
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifidmd
|
||||
PKG_VERSION:=1.0.35
|
||||
PKG_VERSION:=1.1.0
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/wifidmd.git
|
||||
PKG_SOURCE_VERSION:=7d51fde1cb0ce1c0f35461aef0b15835758418ef
|
||||
PKG_SOURCE_VERSION:=4bc27ec89b482b98b0bd338c8739fbfbbe41bb15
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
|
@ -20,12 +20,12 @@ PKG_LICENSE:=BSD-3-Clause
|
|||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../bbfdm/bbfdm.mk
|
||||
include $(TOPDIR)/feeds/iopsys/bbfdm/bbfdm.mk
|
||||
|
||||
define Package/wifidmd
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=WiFi Data Model Support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||
endef
|
||||
|
||||
|
|
@ -45,19 +45,22 @@ define Build/Prepare
|
|||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WIFIDMD_WIFI_DATAELEMENTS),y)
|
||||
MAKE_FLAGS += WIFIDMD_WIFI_DATAELEMENTS=y
|
||||
ifeq ($(CONFIG_WIFIDMD_DISABLE_LEGACY_WIFI),y)
|
||||
MAKE_FLAGS += WIFIDMD_DISABLE_LEGACY_WIFI=y
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WIFIDMD_ENABLE_WIFI_DATAELEMENTS),y)
|
||||
MAKE_FLAGS += WIFIDMD_ENABLE_WIFI_DATAELEMENTS=y
|
||||
endif
|
||||
|
||||
define Package/wifidmd/install
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/services
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/micro_services
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wifidmd $(1)/usr/sbin/wifidmd
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/wifidmd $(1)/etc/init.d/wifidmd
|
||||
|
||||
ifneq ($(CONFIG_WIFIDMD_DISABLE_LEGACY_WIFI),y)
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
|
||||
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libwifi.so $(1) $(PKG_NAME)
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
$(eval $(call BuildPackage,wifidmd))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"daemon": {
|
||||
"enable": "1",
|
||||
"service_name": "wifidmd",
|
||||
"unified_daemon": false,
|
||||
"unified_daemon": true,
|
||||
"services": [
|
||||
{
|
||||
"parent_dm": "Device.",
|
||||
|
|
|
|||
37
wifidmd/files/etc/init.d/wifidmd
Normal file
37
wifidmd/files/etc/init.d/wifidmd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=60
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/wifidmd
|
||||
|
||||
start_service()
|
||||
{
|
||||
log_level=$(jsonfilter -qe '@.daemon.config.loglevel' < /etc/bbfdm/services/wifidmd.json)
|
||||
[ -z "$log_level" ] && log_level="3"
|
||||
|
||||
procd_open_instance "wifidmd"
|
||||
procd_set_param command ${PROG}
|
||||
procd_append_param command -l "${log_level}"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
ret=$(ubus call service list '{"name":"wifidmd"}' | jsonfilter -qe '@.wifidmd.instances.wifidmd.running')
|
||||
if [ "$ret" != "true" ]; then
|
||||
stop
|
||||
start
|
||||
else
|
||||
ubus send wifidmd.reload
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger wifidmd
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue