Compare commits

..

3 Commits

Author SHA1 Message Date
Janusz Dziedzic
b10cf23b33 Revert "uboot: Remove package"
This reverts commit 31e356de22.
2023-03-03 13:18:16 +00:00
Janusz Dziedzic
6ade1cf8f5 Revert "easy-soc-libs: remove reference to iopsys-ramips target"
This reverts commit 379d09248d.
2023-03-03 13:18:02 +00:00
Janusz Dziedzic
679436f2dd Revert "iop: genconfig: remove support for iopsys-ramips"
This reverts commit 21bef13eff.
2023-03-03 13:17:22 +00:00
47 changed files with 699 additions and 1546 deletions

View File

@@ -5,11 +5,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libbbfdm
PKG_VERSION:=6.8.49
PKG_VERSION:=6.8.42
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
PKG_SOURCE_VERSION:=87ae46df8b4e221b8894fd861d2eb785ae1f3bf3
PKG_SOURCE_VERSION:=976744360c6f2b676046aee5cb6f61326e876b13
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
@@ -161,11 +161,13 @@ define Package/libbbfdm/default/install
$(INSTALL_DIR) $(1)/usr/share/bbfdm
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
ifeq ($(CONFIG_PACKAGE_mosquitto-ssl),y)
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/etc/uci-defaults/01-mosquitto-config $(1)/etc/uci-defaults/
endif
endef
define Package/libbbfdm/default/prerm

View File

@@ -0,0 +1,46 @@
#!/bin/sh
config_mosquitto_owrt() {
sec=$(uci -q get mosquitto.owrt)
if [ -z "${sec}" ]; then
sec=$(uci -q add mosquitto owrt)
uci -q rename mosquitto."${sec}=owrt"
fi
uci -q set mosquitto.owrt.use_uci="1"
uci -q set mosquitto.owrt.write_pid="1"
uci -q commit mosquitto
}
config_mosquitto_general() {
sec=$(uci -q get mosquitto.mosquitto)
if [ -z "${sec}" ]; then
sec=$(uci -q add mosquitto mosquitto)
uci -q rename mosquitto."${sec}=mosquitto"
fi
uci -q set mosquitto.mosquitto.log_dest="syslog"
uci -q set mosquitto.mosquitto.log_facility="5"
uci -q set mosquitto.mosquitto.log_timestamp="1"
uci -q set mosquitto.mosquitto.log_types="error"
uci -q set mosquitto.mosquitto.per_listener_settings="1"
uci -q commit mosquitto
}
config_mosquitto_persistence() {
sec=$(uci -q get mosquitto.persistence)
if [ -z "${sec}" ]; then
sec=$(uci -q add mosquitto persistence)
uci -q rename mosquitto."${sec}=persistence"
fi
uci -q set mosquitto.persistence.persistence="0"
uci -q set mosquitto.persistence.location="/var/run"
uci -q commit mosquitto
}
if [ -f "/etc/config/mosquitto" ]; then
config_mosquitto_owrt
config_mosquitto_general
config_mosquitto_persistence
fi

View File

@@ -1 +0,0 @@
/etc/bbfdm/sysctl.conf

View File

@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dectmngr
PKG_RELEASE:=3
PKG_VERSION:=3.5.7
PKG_VERSION:=3.5.6
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=83f89a83cf860bbcf2b7f2e030215db315a5bbbf
PKG_SOURCE_VERSION:=81450033d98fcdb68911e2148f48d190492090a6
PKG_MIRROR_HASH:=skip
endif

View File

@@ -7,13 +7,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=easy-soc-libs
PKG_VERSION:=7.2.26
PKG_VERSION:=7.2.16
PKG_RELEASE:=1
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=350793b45873480d8981dac540c4145705a7b7ba
PKG_SOURCE_VERSION:=ff2fca6e57f6da1384f6a5f7741d8d1b2aa114fb
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
@@ -43,6 +43,10 @@ ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
TARGET_PLATFORM=MEDIATEK
TARGET_WIFI_TYPE=MAC80211
TARGET_CFLAGS +=-DIOPSYS_MAC80211
else ifeq ($(CONFIG_TARGET_iopsys_x86),y)
TARGET_PLATFORM=TEST
TARGET_WIFI_TYPE=TEST
@@ -53,7 +57,7 @@ else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
TARGET_CFLAGS +=-DIOPSYS_TEST
else ifeq ($(CONFIG_TARGET_airoha),y)
TARGET_PLATFORM=ECONET
TARGET_WIFI_TYPE=MEDIATEK MAC80211
TARGET_WIFI_TYPE=MAC80211
TARGET_CFLAGS +=-DIOPSYS_ECONET
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
TARGET_PLATFORM=IPQ95XX
@@ -70,6 +74,9 @@ else
TARGET_CFLAGS +=-DIOPSYS_MAC80211
endif
export TARGET_PLATFORM
export TARGET_WIFI_TYPE
subdirs := \
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
$(if $(CONFIG_PACKAGE_libwifiutils),libwifi) \

View File

@@ -2,7 +2,7 @@
define Package/libethernet
$(call Package/easy-soc-libs)
TITLE:= Ethernet library (libethernet)
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_airoha:ecnt_api
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig +TARGET_airoha:ecnt_api
endef
define Package/libethernet/config

View File

@@ -8,11 +8,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=9.1.19
PKG_VERSION:=9.1.14
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
PKG_SOURCE_VERSION:=9d8389cda16f410826920bb27fd8af4d28c79de9
PKG_SOURCE_VERSION:=d135d87f65e569b504464738e2b0c2041865a20a
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip

View File

@@ -38,7 +38,6 @@ config cpe 'cpe'
option periodic_notify_enable '1'
option periodic_notify_interval '10'
option incoming_rule 'Port_Only'
option active_notif_throttle '0'
config lwn 'lwn'
option enable '1'

View File

@@ -411,6 +411,7 @@ boot() {
# Copy backup data so that if it restart latter on, it gets the info
copy_cwmp_etc_files_to_varstate
touch /etc/icwmpd/cwmp_notification
mkdir -p /var/run/icwmpd/
touch /var/run/icwmpd/cwmp

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ieee1905
PKG_VERSION:=8.0.12
PKG_VERSION:=8.0.10
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=b265053762a3d6c901872f29fa3e70b8666daf46
PKG_SOURCE_VERSION:=69b1073cfe3dc936c9cbe3e8a71005e9fa9f57e0
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip

View File

@@ -14,6 +14,7 @@ function genconfig {
target="bogus"
target_config_path=""
brcmbca_feed="target/linux/feeds/brcmbca"
ramips_feed="target/linux/feeds/iopsys-ramips"
airoha_feed="target/linux/feeds/airoha"
x86_feed="target/linux/feeds/iopsys-x86"
armvirt_feed="target/linux/feeds/iopsys-armvirt"
@@ -110,6 +111,8 @@ function genconfig {
[ -e $brcmbca_feed/genconfig ] &&
brcmbca=$(cd $brcmbca_feed; ./genconfig)
[ -e $ramips_feed/genconfig ] &&
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
[ -e $airoha_feed/genconfig ] &&
airoha=$(cd $airoha_feed; ./genconfig)
[ -e $x86_feed/genconfig ] &&
@@ -122,7 +125,7 @@ function genconfig {
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
if [ "$profile" == "LIST" ]; then
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
echo "$list based boards:"
for b in ${!list}; do
echo -e "\t$b"
@@ -139,6 +142,14 @@ function genconfig {
fi
done
for p in $iopsys_ramips; do
if [ $p == $profile ]; then
target="iopsys_ramips"
target_config_path="$ramips_feed/config"
return
fi
done
for p in $airoha; do
if [ $p == $profile ]; then
target="airoha"
@@ -342,7 +353,7 @@ function genconfig {
# Special handling for targets which use TARGET_DEVICES
case "$target" in
airoha | iopsys_mediatek | brcmbca | ipq95xx)
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
# This assumes the device name to be unique within one target,
# which is a fair assumption to make.
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"

View File

@@ -13,6 +13,7 @@ function genconfig_min {
target="bogus"
target_config_path=""
brcmbca_feed="target/linux/feeds/brcmbca"
ramips_feed="target/linux/feeds/iopsys-ramips"
airoha_feed="target/linux/feeds/airoha"
x86_feed="target/linux/feeds/iopsys-x86"
armvirt_feed="target/linux/feeds/iopsys-armvirt"
@@ -109,6 +110,8 @@ function genconfig_min {
[ -e $brcmbca_feed/genconfig ] &&
brcmbca=$(cd $brcmbca_feed; ./genconfig)
[ -e $ramips_feed/genconfig ] &&
iopsys_ramips=$(cd $ramips_feed; ./genconfig)
[ -e $airoha_feed/genconfig ] &&
airoha=$(cd $airoha_feed; ./genconfig)
[ -e $x86_feed/genconfig ] &&
@@ -121,7 +124,7 @@ function genconfig_min {
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
if [ "$profile" == "LIST" ]; then
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
for list in brcmbca iopsys_ramips airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
echo "$list based boards:"
for b in ${!list}; do
echo -e "\t$b"
@@ -138,6 +141,14 @@ function genconfig_min {
fi
done
for p in $iopsys_ramips; do
if [ $p == $profile ]; then
target="iopsys_ramips"
target_config_path="$ramips_feed/config"
return
fi
done
for p in $airoha; do
if [ $p == $profile ]; then
target="airoha"
@@ -316,7 +327,7 @@ function genconfig_min {
# Special handling for targets which use TARGET_DEVICES
case "$target" in
airoha | iopsys_mediatek | brcmbca | ipq95xx)
iopsys_ramips | airoha | iopsys_mediatek | brcmbca | ipq95xx)
# This assumes the device name to be unique within one target,
# which is a fair assumption to make.
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"

View File

@@ -1,52 +0,0 @@
#
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_RELEASE:=1
PKG_VERSION:=0.3
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/libpicoevent.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=f446f186102539cceedaa15a95a33547ac3c1fd7
PKG_NAME:=libpicoevent-bcm
PKG_LICENSE:=LGPL-2.1-only
PKG_LICENSE_FILES:=LICENSE
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
include $(INCLUDE_DIR)/package.mk
define Package/libpicoevent-bcm
CATEGORY:=Libraries
TITLE:=Libpicoevent-bcm
URL:=
DEPENDS:= +TARGET_brcmbca:bcmkernel
include $(TOPDIR)/feeds/broadcom/bcmkernel/bcm-toolchain.mk
TARGET_CFLAGS := -Os -pipe -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCONFIG_TARGET_brcmbca -g3 -fno-caller-saves -fno-plt -Wno-error=unused-but-set-variable -Wno-error=unused-result \
-mfloat-abi=soft -fmacro-prefix-map=$(BUILD_DIR)libpicoevent-bcm-0.3=libpicoevent-bcm-0.3 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 \
-Wl,-z,now -Wl,-z,relro -Wl,--build-i
endef
define Package/libpicoevent-bcm/description
Minimal event library
endef
define Package/libpicoevent-bcm/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib
$(INSTALL_DIR) $(STAGING_DIR)/usr/lib/broadcom
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/bcm963xx
$(CP) $(PKG_BUILD_DIR)/libpicoevent.h $(STAGING_DIR)/usr/include/bcm963xx
mkdir -p $(1)/usr/lib/broadcom
$(CP) $(PKG_BUILD_DIR)/libpicoevent.so $(STAGING_DIR)/usr/lib/broadcom
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libpicoevent.so $(1)/usr/lib/broadcom
endef
$(eval $(call BuildPackage,libpicoevent-bcm))

View File

@@ -16,7 +16,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=2a6ef141747ad0f7b32a536b5b5bd174834a7af5
PKG_SOURCE_VERSION:=9133eacf5665dc01fa58d819bcc96f0a97ebd63c
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -16,7 +16,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=401a392a72e2933f527eb92466faaf2907c38730
PKG_SOURCE_VERSION:=415e36c4007040f723b164dee79a1719d9c77f0a
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -27,6 +27,7 @@ PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
export BCM_VOICEMNGR_WORKAROUND=y
export CONFIG_BCM_CHIP_ID
include $(INCLUDE_DIR)/package.mk

View File

@@ -16,7 +16,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=8a67b666e57836600457167ccadfba8c46461e5c
PKG_SOURCE_VERSION:=abedc475cac1a21ad434dbf2131eb42aa495744d
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -25,9 +25,9 @@ endif
# indirectly. This ensures that the package is rebuilt on config-changes.
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
include $(INCLUDE_DIR)/package.mk
LIBVOICE_PKG_BUILD_DIR := $(PKG_BUILD_DIR)
export D2_VTSP_PLATFORM := $(shell echo $(CONFIG_D2_VTSP_PLATFORM))
include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS += -Wall -Werror
@@ -35,7 +35,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=IOPSYS libvoice for D2 which is software DSP
URL:=
DEPENDS:=+d2-voice
DEPENDS:=
endef
define Package/$(PKG_NAME)/description

View File

@@ -5,9 +5,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-agent
PKG_VERSION:=4.2.0.7
PKG_VERSION:=4.2.0.4
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=142314d9a555ce30399d99ae1a44fbf8be8bb247
PKG_SOURCE_VERSION:=57a01fc4c8846486960a53d4ca808617520a051c
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -5,9 +5,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-controller
PKG_VERSION:=4.2.0.3
PKG_VERSION:=4.2.0.2
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=a88dea065f40c81d3356d850fe447a9deeb972e4
PKG_SOURCE_VERSION:=47e0c27b8a4f08e1dbebab98c3c3aa72dae22dd0
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)

View File

@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=map-topology
PKG_VERSION:=2.5.1.18
PKG_VERSION:=2.5.1.17
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_VERSION:=4320fa30e73b916ae6e4ff489294640e61feeb34
PKG_SOURCE_VERSION:=7683a1b6a08996f07de573c67a33ad143dffeaa8
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz

View File

@@ -20,31 +20,9 @@ generate_igmp_global_params(){
uci commit mcast
}
generate_mld_proxy_config(){
local u_itf="$1"
generate_mcast_config(){
uci add mcast proxy
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
uci set mcast.@proxy[-1].enable="1"
uci set mcast.@proxy[-1].proto="mld"
uci set mcast.@proxy[-1].version="2"
uci set mcast.@proxy[-1].robustness="2"
uci set mcast.@proxy[-1].query_interval="125"
uci set mcast.@proxy[-1].query_response_interval="100"
uci set mcast.@proxy[-1].last_member_query_interval="10"
uci set mcast.@proxy[-1].fast_leave="1"
uci set mcast.@proxy[-1].snooping_mode="2"
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
IFS=" "
for itf in $u_itf; do
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
done
}
generate_igmp_proxy_config(){
local u_itf="$1"
up_itf="$(uci -q get network.wan.device)"
uci add mcast proxy
uci rename mcast.@proxy[-1]="igmp_proxy_1"
@@ -60,56 +38,46 @@ generate_igmp_proxy_config(){
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
IFS=" "
for itf in $u_itf; do
for itf in $up_itf; do
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
done
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
}
generate_mcast_config(){
up_itf="$(uci -q get network.wan.device)"
uci add mcast proxy
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
uci set mcast.@proxy[-1].enable="1"
uci set mcast.@proxy[-1].proto="mld"
uci set mcast.@proxy[-1].version="1"
uci set mcast.@proxy[-1].robustness="2"
uci set mcast.@proxy[-1].query_interval="125"
uci set mcast.@proxy[-1].query_response_interval="100"
uci set mcast.@proxy[-1].last_member_query_interval="10"
uci set mcast.@proxy[-1].fast_leave="1"
uci set mcast.@proxy[-1].snooping_mode="2"
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
IFS=" "
for itf in $up_itf; do
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
done
generate_igmp_proxy_config "$up_itf"
generate_mld_proxy_config "$up_itf"
uci commit mcast
}
interfaces_ok(){
local section_name=$1
local up_interf=$(uci -q get ${section_name}.upstream_interface)
[ -z "$up_interf" ] && return 1
local down_interf=$(uci -q get ${section_name}.downstream_interface)
[ -z "$down_interf" ] && return 1
# check if upstream untagged
IFS=" "
for itf in $up_interf; do
# check if there exist a device section for this upstream interface, if yes the
# do nothing, if no then split the it at . and use the native interface as
# upstream interface
dev_section=$(ubus call uci get '{"config":"network", "type":"device", "match":{"name":"'"$itf"'"}}' | jsonfilter -e @.values | jq keys[])
# mcast config is outdated, simply generate as per new logic
[ -z "$dev_section" ] && return 1
done
}
if [ -s "/etc/config/mcast" ]; then
if uci -q get mcast.@proxy[0] >/dev/null; then
interfaces_ok "mcast.@proxy[0]" && exit
# return if there is any valid content
exit
elif uci -q get mcast.@snooping[0] >/dev/null; then
# return if there is any valid content
exit
else
rm -f /etc/config/mcast
fi
fi
rm -f /etc/config/mcast
touch /etc/config/mcast
generate_igmp_global_params

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa
PKG_VERSION:=7.0.0.9
PKG_VERSION:=7.0.0.7
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
@@ -110,7 +110,7 @@ define Package/obuspa/install
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/05-obuspa-mqtt-config $(1)/etc/uci-defaults/
$(INSTALL_BIN) ./files/etc/uci-defaults/50-add-mqtt-usp-test $(1)/etc/uci-defaults/
endef
$(eval $(call BuildPackage,obuspa))

View File

@@ -1,22 +0,0 @@
#!/bin/sh
. /lib/functions.sh
if [ ! -f "/etc/config/mosquitto" ]; then
echo "Local mosquitto broker not available"
return 0
fi
add_obuspa_config()
{
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
uci_add mosquitto listener obuspa
uci_set mosquitto obuspa enabled 1
uci_set mosquitto obuspa port '1883'
uci_set mosquitto obuspa no_remote_access '1'
uci_set mosquitto obuspa allow_anonymous '1'
fi
}
uci_load mosquitto
add_obuspa_config

View File

@@ -0,0 +1,14 @@
add_usp_test()
{
if ! uci_get mosquitto usptest >/dev/null 2>&1; then
uci_add mosquitto listener usptest
uci_set mosquitto usptest enabled 1
uci_set mosquitto usptest port '9001'
uci_set mosquitto usptest protocol 'websockets'
uci_set mosquitto usptest require_certificates '0'
uci_set mosquitto usptest auth_plugin '/usr/lib/mosquitto_auth_shadow.so'
fi
}
uci_load mosquitto
add_usp_test

View File

@@ -1,372 +0,0 @@
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
index 6b5c11d..3670361 100644
--- a/src/core/bdc_exec.c
+++ b/src/core/bdc_exec.c
@@ -548,9 +548,14 @@ int StartSendingReport(bdc_connection_t *bc)
// Set the list of headers
bc->headers = NULL;
bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
- bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
+ if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER)
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ObjectHierarchy");
+ else
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
+
if (bc->flags & BDC_FLAG_GZIP)
{
+ curl_easy_setopt(curl_ctx, CURLOPT_ACCEPT_ENCODING, "gzip");
bc->headers = curl_slist_append(bc->headers, "Content-Encoding: gzip");
}
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
index c58c6d5..ff37a2d 100644
--- a/src/core/bdc_exec.h
+++ b/src/core/bdc_exec.h
@@ -53,6 +53,6 @@ void BDC_EXEC_ScheduleExit(void);
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
-
+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be ObjectHierarchy otherwise NameValuePair
#endif
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
index 5b1aff2..a7d1b3e 100755
--- a/src/core/device_bulkdata.c
+++ b/src/core/device_bulkdata.c
@@ -68,7 +68,8 @@
//------------------------------------------------------------------------------
// Definitions for formats that we support
#define BULKDATA_ENCODING_TYPE "JSON"
-#define BULKDATA_JSON_REPORT_FORMAT "NameValuePair"
+#define BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE "NameValuePair"
+#define BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER "ObjectHierarchy"
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
@@ -159,6 +160,7 @@ typedef struct
char compression[9];
char method[9];
bool use_date_header;
+ char report_format[20];
} profile_ctrl_params_t;
//------------------------------------------------------------------------------
@@ -233,7 +235,7 @@ bulkdata_profile_t *bulkdata_find_free_profile(void);
bulkdata_profile_t *bulkdata_find_profile(int profile_id);
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp);
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
int bulkdata_start_profile(bulkdata_profile_t *bp);
@@ -307,7 +309,7 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Parameter.{i}.Reference", "", Validate_BulkDataReference, NULL, DM_STRING);
// Device.BulkData.Profile.{i}.JSONEncoding
- err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT, Validate_BulkDataReportFormat, NULL, DM_STRING);
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
// Device.BulkData.Profile.{i}.HTTP
@@ -661,9 +663,11 @@ int Validate_BulkDataReference(dm_req_t *req, char *value)
int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
{
// Exit if trying to set a value outside of the range we accept
- if (strcmp(value, BULKDATA_JSON_REPORT_FORMAT) != 0)
+ if (strcmp(value, BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE) != 0 &&
+ strcmp(value, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) != 0)
{
- USP_ERR_SetMessage("%s: Only JSON Report Format supported is '%s'", __FUNCTION__, BULKDATA_JSON_REPORT_FORMAT);
+ USP_ERR_SetMessage("%s: Only JSON Report Format supported are '%s', '%s'", __FUNCTION__,
+ BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER);
return USP_ERR_INVALID_VALUE;
}
@@ -1974,6 +1978,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
return err;
}
+ // Exit if unable to get ReportFormat
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_format, sizeof(ctrl_params->report_format), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
return USP_ERR_OK;
}
@@ -2249,7 +2261,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
}
// Exit if unable to generate the report
- json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp);
+ json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
if (json_report == NULL)
{
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
@@ -2299,7 +2311,8 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
kv_pair_t kv;
report_t *cur_report;
char *json_report;
- char report_timestamp[33];
+ char report_timestamp[33] = {0};
+ char report_format[20] = {0};
// Exit if the MTP has not been connected to successfully after bootup
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
@@ -2316,6 +2329,14 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
return;
}
+ // Exit if unable to get ReportFormat
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
+ if (err != USP_ERR_OK)
+ {
+ return;
+ }
+
// When sending via USP events, only one report is ever sent in each USP event
// So ensure all retained reports are removed. NOTE: Clearing the reports here is only necessary when switching protocol from HTTP to USP event, and where HTTP had some unsent reports
bulkdata_clear_retained_reports(bp);
@@ -2333,7 +2354,7 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
bp->num_retained_reports = 1;
// Exit if unable to generate the report
- json_report = bulkdata_generate_json_report(bp, report_timestamp);
+ json_report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
if (json_report == NULL)
{
USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
@@ -2545,21 +2566,7 @@ int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *ou
return USP_ERR_OK;
}
-/*********************************************************************//**
-**
-** bulkdata_generate_json_report
-**
-** Generates a JSON name-value pair format report
-** NOTE: The report contains all retained failed reports, as well as the current report
-** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
-**
-** \param bp - pointer to bulk data profile containing all reports (current and retained)
-** \param report_timestamp - value of Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
-**
-** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
-**
-**************************************************************************/
-char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp)
+static char *create_json_name_value_pair_report(bulkdata_profile_t *bp, char *report_timestamp)
{
JsonNode *top; // top of report
JsonNode *array; // array of reports (retained + current)
@@ -2574,7 +2581,6 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
long long value_as_ll;
unsigned long long value_as_ull;
bool value_as_bool;
- char *result;
int i, j;
char buf[32];
kv_pair_t *kv;
@@ -2597,7 +2603,7 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
}
else if (strcmp(report_timestamp, "ISO-8601")==0)
{
- result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
if (result != NULL)
{
json_append_member(element, "CollectionTime", json_mkstring(buf));
@@ -2656,11 +2662,174 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
json_append_member(top, "Report", array);
// Serialize the JSON tree
- result = json_stringify(top, " ");
+ char *output = json_stringify(top, " ");
+
+ // Clean up the JSON tree
+ json_delete(top); // Other JsonNodes which are children of this top level tree will be deleted
+
+ return output;
+}
+
+static char *create_json_obj_hier_report(bulkdata_profile_t *bp, char *report_timestamp)
+{
+ JsonNode *top; // top of report
+ JsonNode *array; // array of reports (retained + current)
+ JsonNode *element; // element of json array, containing an individual report
+ JsonNode *temp;
+ char *param_path;
+ char *param_type_value;
+ char param_type;
+ char *param_value;
+ kv_vector_t *report_map;
+ report_t *report;
+ double value_as_number;
+ long long value_as_ll;
+ unsigned long long value_as_ull;
+ bool value_as_bool;
+ int i, j;
+ char buf[32];
+ kv_pair_t *kv;
+ int err;
+
+ top = json_mkobject();
+ array = json_mkarray();
+
+ // Iterate over all reports adding them to the JSON array
+ for (i=0; i < bp->num_retained_reports; i++)
+ {
+ report = &bp->reports[i];
+ report_map = &report->report_map;
+
+ // Add Collection time to each json report element (only if specified and not 'None')
+ element = json_mkobject();
+ if (strcmp(report_timestamp, "Unix-Epoch")==0)
+ {
+ json_append_member(element, "CollectionTime", json_mknumber(report->collection_time));
+ }
+ else if (strcmp(report_timestamp, "ISO-8601")==0)
+ {
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
+ if (result != NULL)
+ {
+ json_append_member(element, "CollectionTime", json_mkstring(buf));
+ }
+ }
+
+ temp = element;
+ // Iterate over each parameter, adding it to the json element. Take account of the parameter's type
+ for (j=0; j < report_map->num_entries; j++)
+ {
+ char buff[2056] = {0};
+ char *pch = NULL, *pchr = NULL, *argv[128] = {0};
+ int n = 0;
+
+ kv = &report_map->vector[j];
+ param_path = kv->key;
+ param_type_value = kv->value;
+ param_type = param_type_value[0]; // First character denotes the type of the parameter
+ param_value = &param_type_value[1]; // Subsequent characters contain the parameter's value
+
+ strncpy(buff, param_path, sizeof(buff));
+ for (pch = strtok_r(buff, ".", &pchr); pch != NULL; pch = strtok_r(NULL, ".", &pchr)) {
+ int idx;
+ JsonNode *obj = element;
+ argv[n] = pch;
+
+ for (idx = 0; idx <= n; idx++) {
+ if (obj == NULL)
+ break;
+ obj = json_find_member(obj, argv[idx]);
+ }
+
+ if (obj)
+ temp = obj;
+ else {
+ if (pchr != NULL && *pchr != '\0') {
+ // It is a DMOBJ
+ JsonNode *new = json_mkobject();
+ json_append_member(temp, pch, new);
+ temp = new;
+ } else {
+ // It is a DMPARAM
+ switch (param_type)
+ {
+ case 'S':
+ json_append_member(temp, pch, json_mkstring(param_value) );
+ break;
+
+ case 'U':
+ value_as_ull = strtoull(param_value, NULL, 10);
+ json_append_member(temp, pch, json_mkulonglong(value_as_ull) );
+ break;
+
+ case 'L':
+ value_as_ll = strtoll(param_value, NULL, 10);
+ json_append_member(temp, pch, json_mklonglong(value_as_ll) );
+ break;
+
+ case 'N':
+ value_as_number = atof(param_value);
+ json_append_member(temp, pch, json_mknumber(value_as_number) );
+ break;
+
+ case 'B':
+ err = TEXT_UTILS_StringToBool(param_value, &value_as_bool);
+ if (err == USP_ERR_OK)
+ {
+ json_append_member(temp, pch, json_mkbool(value_as_bool) );
+ }
+ break;
+
+ default:
+ USP_ERR_SetMessage("%s: Invalid JSON parameter type ('%c') in report map for %s", __FUNCTION__, param_type_value[0], param_path);
+ break;
+ }
+ }
+ }
+ n++;
+ }
+ }
+
+ // Add the json element to the json array
+ json_append_element(array, element);
+ }
+
+ // Finally add the array to the report top level
+ json_append_member(top, "Report", array);
+
+ // Serialize the JSON tree
+ char *output = json_stringify(top, " ");
// Clean up the JSON tree
json_delete(top); // Other JsonNodes which are children of this top level tree will be deleted
+ return output;
+}
+
+/*********************************************************************//**
+**
+** bulkdata_generate_json_report
+**
+** Generates a JSON name-value pair or object-hierarchy format report
+** NOTE: The report contains all retained failed reports, as well as the current report
+** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
+**
+** \param bp - pointer to bulk data profile containing all reports (current and retained)
+** \param report_timestamp - value of Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
+**
+** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
+**
+**************************************************************************/
+char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format)
+{
+ char *result = NULL;
+
+ if (strcmp(report_format, BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE) == 0) {
+ result = create_json_name_value_pair_report(bp, report_timestamp);
+ } else if (strcmp(report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0) {
+ result = create_json_obj_hier_report(bp, report_timestamp);
+ }
+
return result;
}
@@ -2817,6 +2986,11 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
flags |= BDC_FLAG_DATE_HEADER;
}
+ if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0)
+ {
+ flags |= BDC_FLAG_HEADER_OBJ_HIER;
+ }
+
// Exit if failed to post a message to BDC thread
// NOTE: Ownership of full_url, query_string, report, username and password passes to BDC_EXEC
err = BDC_EXEC_PostReportToSend(bp->profile_id, full_url, query_string, username, password, report, report_len, flags);

View File

@@ -1,673 +0,0 @@
diff --git a/src/core/bdc_exec.c b/src/core/bdc_exec.c
index 3670361..6a6325d 100644
--- a/src/core/bdc_exec.c
+++ b/src/core/bdc_exec.c
@@ -547,11 +547,19 @@ int StartSendingReport(bdc_connection_t *bc)
// Set the list of headers
bc->headers = NULL;
- bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
- if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER)
+ if (bc->flags & BDC_FLAG_HEADER_OBJ_HIER) {
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ObjectHierarchy");
- else
+ } else if (bc->flags & BDC_FLAG_HEADER_NAME_VAL) {
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: application/json; charset=UTF-8");
bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: NameValuePair");
+ } else if (bc->flags & BDC_FLAG_HEADER_PER_COL) {
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: text/csv; charset=UTF-8");
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ParameterPerColumn");
+ } else {
+ bc->headers = curl_slist_append(bc->headers, "Content-Type: text/csv; charset=UTF-8");
+ bc->headers = curl_slist_append(bc->headers, "BBF-Report-Format: ParameterPerRow");
+ }
if (bc->flags & BDC_FLAG_GZIP)
{
diff --git a/src/core/bdc_exec.h b/src/core/bdc_exec.h
index ff37a2d..ee29c85 100644
--- a/src/core/bdc_exec.h
+++ b/src/core/bdc_exec.h
@@ -53,6 +53,9 @@ void BDC_EXEC_ScheduleExit(void);
#define BDC_FLAG_PUT 0x00000001 // If set, HTTP PUT should be used instead of HTTP POST when sending the report to the BDC server
#define BDC_FLAG_GZIP 0x00000002 // If set, the reports contants are Gzipped
#define BDC_FLAG_DATE_HEADER 0x00000004 // If set, the date header should be included in the HTTP post.
-#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be ObjectHierarchy otherwise NameValuePair
+#define BDC_FLAG_HEADER_OBJ_HIER 0x00000008 // If set, report format in header would be json ObjectHierarchy
+#define BDC_FLAG_HEADER_NAME_VAL 0x00000010 // If set, report format in header would be json NameValuePair
+#define BDC_FLAG_HEADER_PER_ROW 0x00000020 // If set, report format in header would be csv ParameterPerRow
+#define BDC_FLAG_HEADER_PER_COL 0x00000040 // If set, report format in header would be csv ParameterPerColumn
#endif
diff --git a/src/core/device_bulkdata.c b/src/core/device_bulkdata.c
index a7d1b3e..fab9731 100755
--- a/src/core/device_bulkdata.c
+++ b/src/core/device_bulkdata.c
@@ -67,9 +67,12 @@
//------------------------------------------------------------------------------
// Definitions for formats that we support
-#define BULKDATA_ENCODING_TYPE "JSON"
+#define BULKDATA_ENCODING_TYPE_JSON "JSON"
+#define BULKDATA_ENCODING_TYPE_CSV "CSV"
#define BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE "NameValuePair"
#define BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER "ObjectHierarchy"
+#define BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN "ParameterPerColumn"
+#define BULKDATA_CSV_REPORT_FORMAT_PER_ROW "ParameterPerRow"
// Definitions for Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp
@@ -153,6 +156,7 @@ static char *profile_push_event_args[] =
typedef struct
{
int num_retained_failed_reports;
+ char encoding_type[10];
char report_timestamp[33];
char url[1025];
char username[257];
@@ -161,6 +165,11 @@ typedef struct
char method[9];
bool use_date_header;
char report_format[20];
+ char field_separator[10];
+ char row_separator[10];
+ char escape_char[10];
+ char csv_format[20];
+ char row_timestamp[33];
} profile_ctrl_params_t;
//------------------------------------------------------------------------------
@@ -208,6 +217,7 @@ int Validate_BulkDataEncodingType(dm_req_t *req, char *value);
int Validate_BulkDataReportingInterval(dm_req_t *req, char *value);
int Validate_BulkDataReference(dm_req_t *req, char *value);
int Validate_BulkDataReportFormat(dm_req_t *req, char *value);
+int Validate_BulkDataCSVReportFormat(dm_req_t *req, char *value);
int Validate_BulkDataReportTimestamp(dm_req_t *req, char *value);
int Validate_BulkDataCompression(dm_req_t *req, char *value);
int Validate_BulkDataHTTPMethod(dm_req_t *req, char *value);
@@ -236,6 +246,8 @@ bulkdata_profile_t *bulkdata_find_profile(int profile_id);
int bulkdata_calc_report_map(bulkdata_profile_t *bp, kv_vector_t *report_map);
int bulkdata_reduce_to_alt_name(char *spec, char *path, char *alt_name, char *out_buf, int buf_len);
char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timestamp, char *report_format);
+char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator, char *row_separator,
+ char *escape_char, char *csv_format, char *row_timestamp);
unsigned char *bulkdata_compress_report(profile_ctrl_params_t *ctrl, char *input_buf, int input_len, int *p_output_len);
int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_profile_t *bp, unsigned char *json_report, int report_len);
int bulkdata_start_profile(bulkdata_profile_t *bp);
@@ -250,6 +262,7 @@ char *bulkdata_platform_calc_uri_query_string(kv_vector_t *escaped_map);
int bulkdata_platform_get_param_refs(int profile_id, param_ref_vector_t *param_refs);
void bulkdata_expand_param_ref(param_ref_entry_t *pr, group_get_vector_t *ggv);
void bulkdata_append_to_result_map(param_ref_entry_t *pr, group_get_vector_t *ggv, kv_vector_t *report_map);
+void append_string_to_target(char *str, char **output);
/*********************************************************************//**
**
@@ -282,7 +295,7 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_VendorParam_ReadOnly("Device.BulkData.Status", Get_BulkDataGlobalStatus, DM_STRING);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MinReportingInterval", BULKDATA_MINIMUM_REPORTING_INTERVAL_STR, DM_UINT);
err |= USP_REGISTER_Param_SupportedList("Device.BulkData.Protocols", bdc_protocols, NUM_ELEM(bdc_protocols));
- err |= USP_REGISTER_Param_Constant("Device.BulkData.EncodingTypes", BULKDATA_ENCODING_TYPE, DM_STRING);
+ err |= USP_REGISTER_Param_Constant("Device.BulkData.EncodingTypes", "CSV,JSON", DM_STRING);
err |= USP_REGISTER_Param_Constant("Device.BulkData.ParameterWildCardSupported", "true", DM_BOOL);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfProfiles", BULKDATA_MAX_PROFILES_STR, DM_INT);
err |= USP_REGISTER_Param_Constant("Device.BulkData.MaxNumberOfParameterReferences", "-1", DM_INT);
@@ -297,7 +310,7 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Name", "", NULL, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports", "0", Validate_NumberOfRetainedFailedReports, NULL, DM_INT);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.Protocol", BULKDATA_PROTOCOL_HTTP, Validate_BulkDataProtocol, NULL, DM_STRING);
- err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE, Validate_BulkDataEncodingType, NULL, DM_STRING);
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.EncodingType", BULKDATA_ENCODING_TYPE_JSON, Validate_BulkDataEncodingType, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.ReportingInterval", "86400", Validate_BulkDataReportingInterval, NotifyChange_BulkDataReportingInterval, DM_UINT);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.TimeReference", UNKNOWN_TIME_STR, NULL, NotifyChange_BulkDataTimeReference, DM_DATETIME);
@@ -312,6 +325,13 @@ int DEVICE_BULKDATA_Init(void)
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat", BULKDATA_JSON_REPORT_FORMAT_NAME_VALUE, Validate_BulkDataReportFormat, NULL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
+ // Device.BulkData.Profile.{i}.CSVEncoding
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.FieldSeparator", ",", NULL, NULL, DM_STRING);
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.RowSeparator", "&#10;", NULL, NULL, DM_STRING);
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.EscapeCharacter", "&quot;", NULL, NULL, DM_STRING);
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat", BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN, Validate_BulkDataCSVReportFormat, NULL, DM_STRING);
+ err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.CSVEncoding.RowTimestamp", BULKDATA_JSON_TIMESTAMP_FORMAT_EPOCH, Validate_BulkDataReportTimestamp, NULL, DM_STRING);
+
// Device.BulkData.Profile.{i}.HTTP
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.URL", "", NULL, NotifyChange_BulkDataURL, DM_STRING);
err |= USP_REGISTER_DBParam_ReadWrite("Device.BulkData.Profile.{i}.HTTP.Username", "", NULL, NULL, DM_STRING);
@@ -591,9 +611,10 @@ int Validate_BulkDataProtocol(dm_req_t *req, char *value)
int Validate_BulkDataEncodingType(dm_req_t *req, char *value)
{
// Exit if trying to set a value outside of the range we accept
- if (strcmp(value, BULKDATA_ENCODING_TYPE) != 0)
+ if (strcmp(value, BULKDATA_ENCODING_TYPE_JSON) != 0 && strcmp(value, BULKDATA_ENCODING_TYPE_CSV) != 0)
{
- USP_ERR_SetMessage("%s: Only EncodingType supported is '%s'", __FUNCTION__, BULKDATA_ENCODING_TYPE);
+ USP_ERR_SetMessage("%s: Only EncodingType supported are '%s,%s'", __FUNCTION__,
+ BULKDATA_ENCODING_TYPE_JSON, BULKDATA_ENCODING_TYPE_CSV);
return USP_ERR_INVALID_VALUE;
}
@@ -674,6 +695,32 @@ int Validate_BulkDataReportFormat(dm_req_t *req, char *value)
return USP_ERR_OK;
}
+/*********************************************************************//**
+**
+** Validate_BulkDataCSVReportFormat
+**
+** Validates Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
+**
+** \param req - pointer to structure identifying the parameter
+** \param value - value that the controller would like to set the parameter to
+**
+** \return USP_ERR_OK if successful
+**
+**************************************************************************/
+int Validate_BulkDataCSVReportFormat(dm_req_t *req, char *value)
+{
+ // Exit if trying to set a value outside of the range we accept
+ if (strcmp(value, BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN) != 0 &&
+ strcmp(value, BULKDATA_CSV_REPORT_FORMAT_PER_ROW) != 0)
+ {
+ USP_ERR_SetMessage("%s: Only JSON Report Format supported are '%s', '%s'", __FUNCTION__,
+ BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN, BULKDATA_CSV_REPORT_FORMAT_PER_ROW);
+ return USP_ERR_INVALID_VALUE;
+ }
+
+ return USP_ERR_OK;
+}
+
/*********************************************************************//**
**
** Validate_BulkDataReportTimestamp
@@ -1970,6 +2017,14 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
return err;
}
+ // Exit if unable to get EncodingType
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.EncodingType", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->encoding_type, sizeof(ctrl_params->encoding_type), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
// Exit if unable to get ReportTimestamp
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
err = DATA_MODEL_GetParameterValue(path, ctrl_params->report_timestamp, sizeof(ctrl_params->report_timestamp), 0);
@@ -1986,6 +2041,46 @@ int bulkdata_platform_get_profile_control_params(bulkdata_profile_t *bp, profile
return err;
}
+ // Exit if unable to get FieldSeparator
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.FieldSeparator", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->field_separator, sizeof(ctrl_params->field_separator), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
+ // Exit if unable to get RowSeparator
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowSeparator", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->row_separator, sizeof(ctrl_params->row_separator), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
+ // Exit if unable to get EscapeCharacter
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.EscapeCharacter", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->escape_char, sizeof(ctrl_params->escape_char), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
+ // Exit if unable to get ReportFormat
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.ReportFormat", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->csv_format, sizeof(ctrl_params->csv_format), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
+ // Exit if unable to get RowTimestamp
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowTimestamp", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, ctrl_params->row_timestamp, sizeof(ctrl_params->row_timestamp), 0);
+ if (err != USP_ERR_OK)
+ {
+ return err;
+ }
+
return USP_ERR_OK;
}
@@ -2222,7 +2317,7 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
{
int err;
report_t *cur_report;
- char *json_report;
+ char *report;
profile_ctrl_params_t ctrl;
unsigned char *compressed_report;
int compressed_len;
@@ -2261,10 +2356,23 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
}
// Exit if unable to generate the report
- json_report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
- if (json_report == NULL)
- {
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
+ if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
+ report = bulkdata_generate_json_report(bp, ctrl.report_timestamp, ctrl.report_format);
+ if (report == NULL)
+ {
+ USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
+ return;
+ }
+ } else if (strcmp(ctrl.encoding_type, BULKDATA_ENCODING_TYPE_CSV) == 0) {
+ report = bulkdata_generate_csv_report(bp, ctrl.field_separator, ctrl.row_separator, ctrl.escape_char,
+ ctrl.csv_format, ctrl.row_timestamp);
+ if (report == NULL)
+ {
+ USP_ERR_SetMessage("%s: bulkdata_generate_csv_report failed", __FUNCTION__);
+ return;
+ }
+ } else {
+ USP_ERR_SetMessage("%s: bulkdata invalid report encoding type %s", __FUNCTION__, ctrl.encoding_type);
return;
}
@@ -2273,14 +2381,14 @@ void bulkdata_process_profile_http(bulkdata_profile_t *bp)
USP_LOG_Info("BULK DATA: using compression method=%s", ctrl.compression);
if (enable_protocol_trace)
{
- USP_LOG_String(kLogLevel_Info, kLogType_Protocol, json_report);
+ USP_LOG_String(kLogLevel_Info, kLogType_Protocol, report);
}
// Compress the report, if enabled
- compressed_report = bulkdata_compress_report(&ctrl, json_report, strlen(json_report), &compressed_len);
- if (compressed_report != (unsigned char *)json_report)
+ compressed_report = bulkdata_compress_report(&ctrl, report, strlen(report), &compressed_len);
+ if (compressed_report != (unsigned char *)report)
{
- free(json_report);
+ free(report);
}
// NOTE: From this point on, only the compressed_report exists
@@ -2310,9 +2418,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
kv_vector_t event_args;
kv_pair_t kv;
report_t *cur_report;
- char *json_report;
+ char *report;
+ char encoding_type[10] = {0};
char report_timestamp[33] = {0};
char report_format[20] = {0};
+ char field_separator[10];
+ char row_separator[10];
+ char escape_char[10];
+ char csv_format[20];
+ char row_timestamp[33];
// Exit if the MTP has not been connected to successfully after bootup
// This is to prevent BDC events being enqueued before the Boot! event is sent (the Boot! event is only sent after successfully connecting to the MTP).
@@ -2321,20 +2435,62 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
goto exit;
}
- // Exit if unable to get ReportTimestamp
- USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
- err = DATA_MODEL_GetParameterValue(path, report_timestamp, sizeof(report_timestamp), 0);
- if (err != USP_ERR_OK)
- {
+ // Exit if unable to get EncodingType
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.EncodingType", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, encoding_type, sizeof(encoding_type), 0);
+ if (err != USP_ERR_OK) {
return;
}
- // Exit if unable to get ReportFormat
- USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
- err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
- if (err != USP_ERR_OK)
- {
- return;
+ if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
+ // Exit if unable to get ReportTimestamp
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportTimestamp", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, report_timestamp, sizeof(report_timestamp), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
+
+ // Exit if unable to get ReportFormat
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.JSONEncoding.ReportFormat", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, report_format, sizeof(report_format), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
+ } else {
+ // Exit if unable to get FieldSeparator
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.FieldSeparator", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, field_separator, sizeof(field_separator), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
+
+ // Exit if unable to get RowSeparator
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowSeparator", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, row_separator, sizeof(row_separator), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
+
+ // Exit if unable to get EscapeCharacter
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.EscapeCharacter", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, escape_char, sizeof(escape_char), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
+
+ // Exit if unable to get ReportFormat
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.ReportFormat", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, csv_format, sizeof(csv_format), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
+
+ // Exit if unable to get RowTimestamp
+ USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.CSVEncoding.RowTimestamp", bp->profile_id);
+ err = DATA_MODEL_GetParameterValue(path, row_timestamp, sizeof(row_timestamp), 0);
+ if (err != USP_ERR_OK) {
+ return;
+ }
}
// When sending via USP events, only one report is ever sent in each USP event
@@ -2354,10 +2510,16 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
bp->num_retained_reports = 1;
// Exit if unable to generate the report
- json_report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
- if (json_report == NULL)
+ if (strcmp(encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
+ report = bulkdata_generate_json_report(bp, report_timestamp, report_format);
+ } else {
+ report = bulkdata_generate_csv_report(bp, field_separator, row_separator, escape_char,
+ csv_format, row_timestamp);
+ }
+
+ if (report == NULL)
{
- USP_ERR_SetMessage("%s: bulkdata_generate_json_report failed", __FUNCTION__);
+ USP_ERR_SetMessage("%s: bulkdata failed to generate report", __FUNCTION__);
return;
}
@@ -2365,15 +2527,15 @@ void bulkdata_process_profile_usp_event(bulkdata_profile_t *bp)
// Construct event_args manually to avoid the overhead of a malloc and copy of the report in KV_VECTOR_Add()
kv.key = "Data";
- kv.value = json_report;
+ kv.value = report;
event_args.vector = &kv;
event_args.num_entries = 1;
USP_SNPRINTF(path, sizeof(path), "Device.BulkData.Profile.%d.Push!", bp->profile_id);
DEVICE_SUBSCRIPTION_ProcessAllEventCompleteSubscriptions(path, &event_args);
- // Free the report. No need to free the event_args as json_report is the only thing dynamically allocated in it
- free(json_report); // The report is not allocated via USP_MALLOC
+ // Free the report. No need to free the event_args as report is the only thing dynamically allocated in it
+ free(report); // The report is not allocated via USP_MALLOC
// From the point of view of this code, the report(s) have been successfully sent, so don't retain them
// NOTE: Sending of the reports successfully is delegated to the USP notification retry mechanism
@@ -2833,6 +2995,219 @@ char *bulkdata_generate_json_report(bulkdata_profile_t *bp, char *report_timesta
return result;
}
+/*********************************************************************//**
+**
+** append_string_to_target
+**
+** concatenates the src string with target string in newly allocated memory
+** and assign back the new pointer.
+**
+** \param str - pointer to the src string
+** \param output - address of the pointer that points to the target string
+**
+** \return None
+**
+**************************************************************************/
+void append_string_to_target(char *str, char **output)
+{
+ char *tmp = NULL;
+
+ if (str == NULL || strlen(str) == 0)
+ return;
+
+ if (*output == NULL || strlen(*output) == 0) {
+ *output = USP_STRDUP(str);
+ return;
+ } else {
+ tmp = USP_STRDUP(*output);
+ free(*output);
+ }
+
+ assert(tmp != NULL);
+ asprintf(output, "%s%s", tmp, str);
+ free(tmp);
+}
+
+/*********************************************************************//**
+**
+** bulkdata_generate_csv_report
+**
+** Generates a CSV ParameterPerRow or ParameterPerColumn format report
+** NOTE: The report contains all retained failed reports, as well as the current report
+** See TR-157 section A.4.2 (end) for an example, and section A.3.5.2 for layout of content containing failed report transmissions
+**
+** \param bp - pointer to bulk data profile containing all reports (current and retained)
+** \param field_separator - value of Device.Bulkdata.Profile.{i}.CSVEncoding.FieldSeparator
+** \param row_separator - value of Device.Bulkdata.Profile.{i}.CSVEncoding.RowSeparator
+** \param escape_char - value of Device.Bulkdata.Profile.{i}.CSVEncoding.EscapeCharacter
+** \param csv_format - value of Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat
+** \param row_timestamp - value of Device.Bulkdata.Profile.{i}.CSVEncoding.RowTimestamp
+**
+** \return pointer to NULL terminated dynamically allocated buffer containing the serialized report to send
+**
+**************************************************************************/
+char *bulkdata_generate_csv_report(bulkdata_profile_t *bp, char *field_separator, char *row_separator,
+ char *escape_char, char *csv_format, char *row_timestamp)
+{
+ char *param_path;
+ char *param_type_value;
+ char param_type;
+ char *param_value;
+ kv_vector_t *report_map;
+ report_t *report;
+ int i, j;
+ bool value_as_bool;
+ char buf[32];
+ kv_pair_t *kv;
+ int err;
+ char *output = NULL, *str = NULL, *str1 = NULL, *str2 = NULL, rowseparator = '\0', separator = '\0';
+
+ if (strcmp(row_separator, "&#10;") == 0)
+ rowseparator = '\n';
+ else if (strcmp(row_separator, "&#13;") == 0)
+ rowseparator = '\r';
+
+ if (field_separator)
+ separator = field_separator[0];
+
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
+ if (strcmp(row_timestamp, "None") == 0)
+ asprintf(&str, "ParameterName%cParameterValue%cParameterType%c", separator, separator, rowseparator);
+ else
+ asprintf(&str, "ReportTimestamp%cParameterName%cParameterValue%cParameterType%c", separator, separator, separator, rowseparator);
+
+ assert(str != NULL);
+ append_string_to_target(str, &output);
+ free(str);
+ str = NULL;
+ }
+
+ for (i=0; i < bp->num_retained_reports; i++)
+ {
+ char *timestamp = NULL;
+ report = &bp->reports[i];
+ report_map = &report->report_map;
+
+ // Add Collection time to each csv report element (only if specified and not 'None')
+ if (strcmp(row_timestamp, "Unix-Epoch")==0)
+ {
+ asprintf(&timestamp, "%lld", (long long int)report->collection_time);
+ }
+ else if (strcmp(row_timestamp, "ISO-8601")==0)
+ {
+ char *result = iso8601_from_unix_time(report->collection_time, buf, sizeof(buf));
+ if (result != NULL)
+ {
+ asprintf(&timestamp, "%s", buf);
+ }
+ }
+
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0 && timestamp) {
+ append_string_to_target("ReportTimestamp", &str1);
+ append_string_to_target(timestamp, &str2);
+ }
+
+ // Iterate over each parameter, adding it to the json element. Take account of the parameter's type
+ for (j=0; j < report_map->num_entries; j++)
+ {
+ kv = &report_map->vector[j];
+ param_path = kv->key;
+ param_type_value = kv->value;
+ param_type = param_type_value[0]; // First character denotes the type of the parameter
+ param_value = &param_type_value[1]; // Subsequent characters contain the parameter's valu
+ char *type = NULL;
+ switch (param_type)
+ {
+ case 'S':
+ type = "string";
+ break;
+
+ case 'U':
+ type = "unsignedInt";
+ break;
+
+ case 'L':
+ type = "long";
+ break;
+
+ case 'N':
+ type = "decimal";
+ break;
+
+ case 'B':
+ err = TEXT_UTILS_StringToBool(param_value, &value_as_bool);
+ if (err == USP_ERR_OK)
+ {
+ type = "boolean";
+ param_value = value_as_bool ? "True" : "False";
+ }
+ break;
+
+ default:
+ USP_ERR_SetMessage("%s: Invalid JSON parameter type ('%c') in report map for %s", __FUNCTION__, param_type_value[0], param_path);
+ break;
+ }
+
+ if (type) {
+ if (strcasecmp(csv_format, "ParameterPerRow") == 0) {
+ if (timestamp == NULL)
+ asprintf(&str, "%s%c%s%c%s%c", param_path, separator, param_value, separator, type, rowseparator);
+ else
+ asprintf(&str, "%s%c%s%c%s%c%s%c", timestamp, separator, param_path, separator, param_value, separator, type, rowseparator);
+
+ assert(str != NULL);
+ append_string_to_target(str, &output);
+ free(str);
+ str = NULL;
+ } else {
+ if (str1 == NULL || strlen(str1) == 0)
+ asprintf(&str, "%s", param_path);
+ else
+ asprintf(&str, "%c%s", separator, param_path);
+
+ assert(str != NULL);
+ append_string_to_target(str, &str1);
+ free(str);
+ str = NULL;
+
+ if (str2 == NULL || strlen(str2) == 0)
+ asprintf(&str, "%s", param_value);
+ else
+ asprintf(&str, "%c%s", separator, param_value);
+
+ assert(str != NULL);
+ append_string_to_target(str, &str2);
+ free(str);
+ str = NULL;
+ }
+ }
+ }
+
+ if (timestamp) {
+ free(timestamp);
+ timestamp = NULL;
+ }
+ }
+
+ if (strcasecmp(csv_format, "ParameterPerColumn") == 0) {
+ asprintf(&str, "%c", rowseparator);
+ assert(str != NULL);
+ append_string_to_target(str, &str1);
+ append_string_to_target(str, &str2);
+ append_string_to_target(str1, &output);
+ append_string_to_target(str2, &output);
+ }
+
+ if (str)
+ free(str);
+ if (str1)
+ free(str1);
+ if (str2)
+ free(str2);
+
+ return output;
+}
+
/*********************************************************************//**
**
** bulkdata_compress_report
@@ -2986,9 +3361,18 @@ int bulkdata_schedule_sending_http_report(profile_ctrl_params_t *ctrl, bulkdata_
flags |= BDC_FLAG_DATE_HEADER;
}
- if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0)
- {
- flags |= BDC_FLAG_HEADER_OBJ_HIER;
+ if (strcmp(ctrl->encoding_type, BULKDATA_ENCODING_TYPE_JSON) == 0) {
+ if (strcmp(ctrl->report_format, BULKDATA_JSON_REPORT_FORMAT_OBJ_HIER) == 0) {
+ flags |= BDC_FLAG_HEADER_OBJ_HIER;
+ } else {
+ flags |= BDC_FLAG_HEADER_NAME_VAL;
+ }
+ } else {
+ if (strcmp(ctrl->csv_format, BULKDATA_CSV_REPORT_FORMAT_PER_COLUMN) == 0) {
+ flags |= BDC_FLAG_HEADER_PER_COL;
+ } else {
+ flags |= BDC_FLAG_HEADER_PER_ROW;
+ }
}
// Exit if failed to post a message to BDC thread

View File

@@ -6,8 +6,6 @@ set_serial_number() {
vendor_id=$1
vssn=$2
# Vendor id is not taken from serial automatically, propagate it as well
/userfs/bin/omcicfgCmd set vendorId ${vendor_id}
/userfs/bin/omcicfgCmd set sn ${vendor_id}${vssn}
}

View File

@@ -173,6 +173,27 @@
}
]
},
"TransceiverNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "xpon",
"method": "status",
"args": {},
"key": "ONU[@index].Transceiver.@Count"
}
}
]
},
"Device.XPON.ONU.{i}.SoftwareImage.{i}.": {
"type": "object",
"protocols": [
@@ -600,27 +621,6 @@
}
]
},
"TransceiverNumberOfEntries": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "xpon",
"method": "status",
"args": {},
"key": "ONU[@index].ANI[@index].Transceiver.@Count"
}
}
]
},
"Device.XPON.ONU.{i}.ANI.{i}.Stats.": {
"type": "object",
"protocols": [
@@ -804,247 +804,247 @@
]
}
}
},
"Device.XPON.ONU.{i}.ANI.{i}.Transceiver.{i}.": {
"type": "object",
}
},
"Device.XPON.ONU.{i}.Transceiver.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": true,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "xpon",
"method": "status",
"args": {},
"key": "ONU[@index].Transceiver"
}
}
],
"ID": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"access": false,
"array": true,
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "xpon",
"method": "status",
"args": {},
"key": "ONU[@index].ANI[@index].Transceiver"
}
"data": "@Parent",
"type": "json",
"key": "ID"
}
]
},
"Identifier": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"ID": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ID"
}
]
},
"Identifier": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Identifier"
}
]
},
"ModuleVendor": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleVendor"
}
]
},
"ModuleName": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleName"
}
]
},
"ModuleVersion": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleVersion"
}
]
},
"ModuleFirmwareVersion": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleFirmwareVersion"
}
]
},
"PONMode": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "PONMode"
}
]
},
"Connector": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "connector"
}
]
},
"RxPower": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "RxPower"
}
]
},
"TxPower": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "TxPower"
}
]
},
"Voltage": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Voltage"
}
]
},
"Bias": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Bias"
}
]
},
"Temperature": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Temperature"
}
]
}
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Identifier"
}
]
},
"ModuleVendor": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleVendor"
}
]
},
"ModuleName": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleName"
}
]
},
"ModuleVersion": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleVersion"
}
]
},
"ModuleFirmwareVersion": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "ModuleFirmwareVersion"
}
]
},
"PONMode": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "PONMode"
}
]
},
"Connector": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "connector"
}
]
},
"RxPower": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "RxPower"
}
]
},
"TxPower": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "TxPower"
}
]
},
"Voltage": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Voltage"
}
]
},
"Bias": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "unsignedInt",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Bias"
}
]
},
"Temperature": {
"type": "int",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"datatype": "int",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "Temperature"
}
]
}
}
}

View File

@@ -5,11 +5,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-base
PKG_VERSION:=2.0.8
PKG_VERSION:=2.0.3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
PKG_SOURCE_VERSION:=c867e8ba1f2a61e88b8c7eb4331465d2dc90c412
PKG_SOURCE_VERSION:=424fb2c76b8b59d235705c5ea8cb0a188d72024d
PKG_MIRROR_HASH:=skip
SULU_MOD:=core

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-builder
PKG_VERSION:=2.0.8
PKG_VERSION:=2.0.4
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
PKG_SOURCE_VERSION:=cc34ec44b9d6803bc80752e2a87fbd9c476fc0dc
PKG_SOURCE_VERSION:=fc2b367cb949fd247fce78e7bf06bd24c97aa9b4
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
@@ -19,7 +19,8 @@ PKG_MIRROR_HASH:=skip
PKG_LICENSE:=PROPRIETARY IOPSYS
PKG_LICENSE_FILES:=LICENSE
SULU_PLUGINS:=$(filter-out sulu-builder,$(filter-out Readme.md,$(notdir $(wildcard ../*))))
SULU_PLUGINS:=$(filter-out Readme.md,$(notdir $(wildcard ../*)))
SULU_PLUGINS:=$(filter-out sulu-builder,$(notdir $(wildcard ../*)))
SULU_EXTRA:=$(subst $\",,$(CONFIG_SULU_EXTRA_PACKAGES))
include $(INCLUDE_DIR)/package.mk

View File

@@ -7,6 +7,17 @@ if [ ! -f "/etc/config/mosquitto" ]; then
return 0
fi
add_obuspa_config()
{
if ! uci_get mosquitto obuspa >/dev/null 2>&1; then
uci_add mosquitto listener obuspa
uci_set mosquitto obuspa enabled 1
uci_set mosquitto obuspa port '1883'
uci_set mosquitto obuspa no_remote_access '1'
uci_set mosquitto obuspa allow_anonymous '1'
fi
}
add_sulu_config()
{
if ! uci_get mosquitto sulu >/dev/null 2>&1; then
@@ -22,4 +33,5 @@ add_sulu_config()
}
uci_load mosquitto
add_obuspa_config
add_sulu_config

View File

@@ -4,11 +4,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-multi-ap
PKG_VERSION:=2.0.7
PKG_VERSION:=2.0.3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-multi-ap.git
PKG_SOURCE_VERSION:=ce924795ad6cabe054a1051fb430f515d0961bbc
PKG_SOURCE_VERSION:=b1e144f1c9bbf641754a6a88693d1c7f8700e6bf
PKG_MIRROR_HASH:=skip
include ../sulu-builder/sulu.mk

View File

@@ -4,11 +4,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-parental-control
PKG_VERSION:=2.0.7
PKG_VERSION:=2.0.2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-parental-control.git
PKG_SOURCE_VERSION:=83d89da5172a5921cd2fa456ca35c181fb9dd7a5
PKG_SOURCE_VERSION:=484c0bcb1ced835a3ca2f26cadb7180fd7572ddd
PKG_MIRROR_HASH:=skip
include ../sulu-builder/sulu.mk

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=swmodd
PKG_VERSION:=2.1.23
PKG_VERSION:=2.1.22
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View File

@@ -48,17 +48,17 @@ configure_crun_container() {
uci_set ocicontainer "${1}" password ""
result=$(${RUNNER} -b "${BUNDLE}" -n "${name}" -r "${url}" -l "${username}:${password}")
if [ "$?" -eq 0 ]; then
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_description")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" description "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_vendor")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" vendor "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_version")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" version "${result}"
fi
@@ -106,17 +106,17 @@ configure_crun_container() {
if [ "${BOOT}" -eq "1" ]; then
if [ "${autostart}" -eq 1 ]; then
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_description")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" description "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_vendor")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" vendor "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_version")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" version "${result}"
fi
@@ -139,17 +139,17 @@ configure_crun_container() {
crun resume "${name}"
else
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_description")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" description "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_vendor")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" vendor "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
result=$(cat "${BUNDLE}"/"${name}"/config.json |jq ".annotations.org_opencontainers_image_version")
if [ "${result}" != "null" ]; then
uci_set ocicontainer "${1}" version "${result}"
fi

View File

@@ -35,12 +35,12 @@ mount_cgroup()
fi
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
cd /sys/fs/cgroup
cd /sys/fs/cgroup || return 1
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rm -f $sys || true
mkdir -p "${sys}"
if ! mountpoint -q "${sys}"; then
if ! mount -n -t cgroup -o "${sys}" cgroup "${sys}"; then
rm -f "${sys}" || true
fi
fi
done

View File

@@ -92,11 +92,11 @@ run_container() {
update_network_ns() {
local type
json_select $2
json_select "${2}"
json_get_var type type
if [ "${type}" = "network" ]; then
json_add_string path "/var/run/netns/${NAME}"
break;
return;
fi
json_select ..
}
@@ -121,7 +121,7 @@ update_config_json() {
log "jshn.sh missing in the system"
exit 1;
fi
cd "${BUNDLE}/${NAME}"
cd "${BUNDLE}/${NAME}" || exit 1;
if cat config.json |jq '.linux.namespaces[] |select (.type == "network") |.path' |grep -q ${NAME}; then
exit 0;
fi
@@ -157,20 +157,20 @@ pull_image_from_registry() {
exit 1
fi
cd "${temp}"
cd "${temp}" || exit 1;
OPTS=""
INSPECT_OPT=""
if [ "${#LOGIN}" -gt 3 ]; then
OPTS="--src-creds ${LOGIN}"
INSPECT_OPT="--creds ${LOGIN}"
fi
if ! skopeo --command-timeout 4m copy ${OPTS} ${REGURL} oci:${NAME}_tmp:latest >/dev/null 2>&1; then
if ! skopeo --command-timeout 4m copy "${OPTS}" "${REGURL}" oci:"${NAME}"_tmp:latest >/dev/null 2>&1; then
log "Failed to download image"
cd -
rm -rf "${temp}"
exit 1
fi
if ! umoci unpack --image ${NAME}_tmp:latest ${NAME} >/dev/null 2>&1; then
if ! umoci unpack --image "${NAME}"_tmp:latest "${NAME}" >/dev/null 2>&1; then
log "Failed to unpack image"
cd -
rm -rf "${temp}"
@@ -185,8 +185,8 @@ pull_image_from_registry() {
fi
# Check disk available space before copy
disksize=$(df -P -k ${BUNDLE} |tail -n +2 |awk '{print $4}')
exsize=$(du -s ${temp} |awk '{print $1}')
disksize=$(df -P -k "${BUNDLE}" |tail -n +2 |awk '{print $4}')
exsize=$(du -s "${temp}" |awk '{print $1}')
if [ "${disksize}" -lt "${exsize}" ]; then
log "Disk space ${disksize} less than required ${exsize}"
cd -
@@ -194,12 +194,12 @@ pull_image_from_registry() {
exit 1
fi
mv ${NAME} ${BUNDLE}/
mv "${NAME}" "${BUNDLE}"/
if [ "$?" -ne 0 ]; then
log "Failed ${name} move in ${BUNDLE}"
cd -
rm -rf "${temp}"
rm -rf ${BUNDLE}/${NAME}
rm -rf "${BUNDLE}"/"${NAME}"
exit 1
fi

View File

@@ -20,7 +20,7 @@ if [ -n "${lxc_bundle}" ]; then
echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf
elif [ -n "${lxc}" ]; then
# if lxc_bundle_root not define in swmodd, update it with lxc path
uci_set swmodd globals lxc_bundle_root ${lxc}
uci_set swmodd globals lxc_bundle_root "${lxc}"
uci_commit
else
mkdir -p /etc/lxc
@@ -35,7 +35,7 @@ if [ -z "${oci_bundle}" ] && [ -n "${lxc_bundle}" ]; then
uci_commit
elif [ -z "${oci_bundle}" ] && [ -n "${lxc}" ]; then
# if oci_bundle_root not defined in swmodd, update it with lxc path
uci_set swmodd globals oci_bundle_root ${lxc}
uci_set swmodd globals oci_bundle_root "${lxc}"
uci_commit
elif [ -z "${oci_bundle}" ]; then
uci_set swmodd globals oci_bundle_root "/srv/"

137
uboot/Makefile Normal file
View File

@@ -0,0 +1,137 @@
#
# Copyright (C) 2013-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=u-boot
PKG_VERSION:=2016.08
PKG_SOURCE_PROTO:=git
ifdef CONFIG_TARGET_airoha
PKG_SOURCE_URL:=https://dev.iopsys.eu/ensemble/u-boot.git
PKG_SOURCE_VERSION:=1b320f0656bfc8504fa4f771dd77d8e403ed00e0
else
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/uboot.git
PKG_SOURCE_VERSION:=4cd73fe5db0ebfc1242ca9c85c14d7f0718eaf73
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=GPL-2.0-or-later
# u-boot for mips_intel do not build in parallel.
#PKG_BUILD_PARALLEL:=1
# we currently do not use OpenWRT u_boot make files
#include $(INCLUDE_DIR)/u-boot.mk
include $(INCLUDE_DIR)/package.mk
# prevent openwrt source date to be used as build date by u-boot
unexport SOURCE_DATE_EPOCH
define uboot/Default
TITLE:=
CONFIG:=
IMAGE:=
endef
UBOOT_IMG:=uboot.img
define uboot/ex400
TITLE:=U-Boot for the ex400
DEPENDS:=@TARGET_iopsys_ramips
PKG_RELEASE:=7
endef
define uboot/en7562
TITLE:=U-Boot for the en7562
CONFIG:=econet-en7562-ram
DEPENDS:=@TARGET_airoha
UBOOT_IMG:=u-boot-nand.bin
endef
UBOOTS := \
ex400 \
en7562
define Package/uboot/template
define Package/uboot-$(1)
SECTION:=boot
CATEGORY:=Boot Loaders
TITLE:=$(2)
URL:=http://www.denx.de/wiki/U-Boot
VARIANT:=$(1)
endef
endef
define BuildUBootPackage
$(eval $(uboot/Default))
$(eval $(uboot/$(1)))
$(call Package/uboot/template,$(1),$(TITLE))
endef
ifdef BUILD_VARIANT
$(eval $(call uboot/$(BUILD_VARIANT)))
UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
UBOOT_IOPSYS_VERSION:=$(PKG_RELEASE)
endif
define Build/Configure
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
$(UBOOT_CONFIG)_config
$(SED) "s,CONFIG_INTENO_MAJOR=\"0\",CONFIG_INTENO_MAJOR=\"$(UBOOT_IOPSYS_VERSION)\"," $(PKG_BUILD_DIR)/.config
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
oldconfig
endef
define Build/Compile
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS)
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS) env
endef
# don't install /etc/init.d/uboot for intel-mips as it's not needed
define Package/uboot/install/default
$(INSTALL_DIR) $$(1)/lib/upgrade
$(CP) ./files/uboot-upgrade $$(1)/lib/upgrade/
$(INSTALL_DIR) $(BIN_DIR)/$(TARGET)
$(CP) \
$(PKG_BUILD_DIR)/$(UBOOT_IMG) \
$(BIN_DIR)/$(TARGET)/uboot.img
$(CP) \
$(PKG_BUILD_DIR)/$(UBOOT_IMG) \
$(wildcard $(BUILD_DIR)/linux-$(BOARD)*)/uboot.img
$(INSTALL_DIR) $$(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $$(1)/usr/sbin/
ln -s /usr/sbin/fw_printenv $$(1)/usr/sbin/fw_setenv
endef
define Package/uboot/install/template
define Package/uboot-$(1)/install
$(call Package/uboot/install/default,$(2))
endef
endef
$(foreach u,$(UBOOTS), \
$(eval $(call Package/uboot/install/template,$(u),$(u))) \
)
$(foreach u,$(UBOOTS), \
$(eval $(call BuildUBootPackage,$(u))) \
$(eval $(call BuildPackage,uboot-$(u))) \
)

8
uboot/files/uboot Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh /etc/rc.common
START=50
start() {
. /lib/upgrade/uboot-upgrade
uboot_upgrade /boot/uboot.img
}

87
uboot/files/uboot-upgrade Executable file
View File

@@ -0,0 +1,87 @@
. /usr/share/libubox/jshn.sh
sanity_check_env(){
# make sure iboot is used to start board, but only if verify_boot != 1
# that allows a person to change the bootcmd and not have it overwritten automatically
# but still force it to iboot for old boards.
vb=$(fw_printenv -n verify_boot 2>/dev/null)
if [ "1" != "$verify_boot" ]
then
if ! fw_printenv -n bootcmd 2>/dev/null| grep iboot >/dev/null
then
echo "update uboot boot command"
fw_setenv bootcmd "rescue;iboot"
fw_setenv verify_boot 1
fi
fi
# just set 115200 baudrate as it is really hardcoded in the binary blob
fw_setenv baudrate 115200
}
do_uboot_upgrade(){
local u_ver
echo "doing upgrade of u-boot old version $cur_Major.$cur_Minor new version $Major.$Minor"
mtd erase /dev/mtd0
mtd write $1 /dev/mtd0
u_ver=$(strings /dev/mtd0 | grep 938f0820-2ffb-11e7-bbc9-2f21351ee6fb)
[ -n "$u_ver" ] && fw_setenv uboot_inteno_version "$u_ver"
sanity_check_env
}
# Return:
# 0: update is successfull
# 1: update is not needed
# 2: error occured
uboot_upgrade() {
[ ! -f $1 ] && return 2
iver=$(fw_printenv -n uboot_inteno_version 2>/dev/null)
# Fixup improper json string for major and minor key.
# this adds the missing "
iver=$(echo $iver | sed -e 's/{Major:/{"Major":/' | sed -e 's/,Minor:/,"Minor":/')
if [ -z "$iver" ]
then
# if this variable is not set by u-boot the u-boot version is too old.
do_uboot_upgrade $1
return 0
fi
# read in current version into Major Minor variables
json_init
json_load $(echo $iver |sed -e 's/938f0820-2ffb-11e7-bbc9-2f21351ee6fb: //')
json_get_vars Major Minor
# echo "Major $Major"
# echo "Minor $Minor"
cur_Major=$Major
cur_Minor=$Minor
# read in new uboot version into Major Minor variables
json_load $(strings $1 | grep 938f0820-2ffb-11e7-bbc9-2f21351ee6fb |sed -e 's/938f0820-2ffb-11e7-bbc9-2f21351ee6fb: //')
json_get_vars Major Minor
# echo "Major $Major"
# echo "Minor $Minor"
if [ $Major -gt $cur_Major ]
then
do_uboot_upgrade $1
return 0
fi
if [ $Major -eq $cur_Major -a $Minor -gt $cur_Minor ]
then
do_uboot_upgrade $1
return 0
fi
return 1
}

View File

@@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uspd
PKG_VERSION:=2.2.27
PKG_VERSION:=2.2.25
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
PKG_SOURCE_VERSION:=35d2c6f62d1b6513826d3f7beab11687b7d7def7
PKG_SOURCE_VERSION:=d29d9581ac2d1a31e0a55ba472d1fc1c494cb392
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif

View File

@@ -2,5 +2,5 @@ config uspd 'usp'
option granularitylevel '0'
option debug '0'
option loglevel '1'
option refresh_time '10'
option refresh_time '5'
option transaction_timeout '10'

View File

@@ -45,35 +45,19 @@ configure_uspd()
fi
}
apply_sysctl_configuration() {
local sysctl_conf
sysctl_conf="/etc/bbfdm/sysctl.conf"
[ -f "${sysctl_conf}" ] || touch "${sysctl_conf}"
sysctl -e -p "${sysctl_conf}" >&-
}
start_service() {
local sysctl_reload
ubus -t 5 wait_for network.device
[ "$?" -eq 0 ] && sysctl_reload=1
procd_open_instance usp
configure_uspd
procd_set_param respawn
procd_close_instance
[ "${sysctl_reload}" -eq 1 ] && apply_sysctl_configuration
}
reload_service() {
apply_sysctl_configuration
stop
start
}
service_triggers()
{
procd_add_reload_trigger "uspd" "network"
procd_add_reload_trigger "uspd"
}

View File

@@ -18,7 +18,7 @@ LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/$(PKG_NAME).git
PKG_SOURCE_VERSION:=97f67f99b542fdfffab1195cbd4300b57a3f19e1
PKG_SOURCE_VERSION:=049933cc516d7cd6105e13b7ac5a61c8c2aed55f
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@@ -38,22 +38,10 @@ define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=IOPSYS Voice Manager
URL:=
DEPENDS:= +libubox +ubus +libblobmsg-json +!TARGET_brcmbca:libpicoevent +TARGET_brcmbca:libpicoevent-bcm \
+!TARGET_brcmbca:uci +TARGET_brcmbca:uci-bcm \
DEPENDS:= +libubox +ubus +libpicoevent +uci \
+TARGET_brcmbca:bcmkernel +TARGET_brcmbca:libvoice-broadcom \
+TARGET_ipq95xx:libvoice-d2 +TARGET_ipq95xx:kmod-d2-voice \
+TARGET_ipq95xx:libvoice-d2 +TARGET_ipq95xx:d2-voice +TARGET_ipq95xx:kmod-d2-voice \
+TARGET_airoha:kmod-voip_driver +TARGET_airoha:voip_app +TARGET_airoha:libvoice-airoha
ifeq ($(CONFIG_TARGET_brcmbca),y)
include $(TOPDIR)/feeds/broadcom/bcmkernel/bcm-toolchain.mk
TARGET_CFLAGS := -I$(STAGING_DIR)/usr/include/bcm963xx/ -L$(STAGING_DIR)/root-brcmbca/usr/lib/broadcom -L$(STAGING_DIR)/usr/lib/broadcom
TARGET_CPPFLAGS :=
TARGET_CXXFLAGS :=
EXTRA_CFLAGS :=
endif
endef
define Package/$(PKG_NAME)/description
@@ -80,5 +68,6 @@ define Package/$(PKG_NAME)/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
$(CP) $(PKG_BUILD_DIR)/libvoice/libvoice.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -9,12 +9,9 @@ NAME=voicemngr
start_service() {
[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
[ -d "/usr/lib/broadcom" ] && BCM_LIBS=LD_LIBRARY_PATH=/usr/lib/broadcom
procd_open_instance
procd_set_param env hw_board_hasDect="$(db get hw.board.hasDect)" \
hw_board_VoicePortNames="$(db get hw.board.VoicePortNames)" \
$BCM_LIBS
hw_board_VoicePortNames="$(db get hw.board.VoicePortNames)"
procd_set_param command $NAME
procd_set_param respawn "5" "0" "3"
procd_set_param nice -12

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wfadatad
PKG_VERSION:=4.0.1.7
PKG_VERSION:=4.0.1.6
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=b165177f12b2cef129f36bff1be077b65fbc86aa
PKG_SOURCE_VERSION:=7f882307d34a09b1cf09ea3335c2fa71a59ce92f
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wfadatad.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wifimngr
PKG_VERSION:=15.0.7
PKG_VERSION:=15.0.6
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=2da5a816e034751baa426605e1e653ec62afc749
PKG_SOURCE_VERSION:=fdbc45c18f67655544546868b2069c028e1e0628
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz