Compare commits

..

5 Commits

Author SHA1 Message Date
Ionut-Alex Oprea
0b861b97bb inteno-netmode: update repo hash 2017-12-19 10:37:24 +01:00
Reidar Cederqvist
ccb4e65f34 inteno-netmode: add repo for netmoded source code 2017-12-19 10:37:24 +01:00
Kenneth Johansson
011f586731 fatrace: we need to flush every line when using a pipe.
/sbin/fatrace -c -t -f W |  grep "/etc/"

produced no output until internal printf buffer full and that is not so
useful.
2017-12-18 21:03:37 +01:00
Kenneth Johansson
90aff84618 fatrace: add kernel config option and patch for correct O_LAGEFILE.
The program only worked on x86.
2017-12-18 20:24:44 +01:00
Kenneth Johansson
e81718ab54 Add fatrace program. 2017-12-18 17:49:31 +01:00
629 changed files with 22387 additions and 32354 deletions

31
4g-support/Makefile Normal file
View File

@@ -0,0 +1,31 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=4g-support
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/4g-support
CATEGORY:=Network
TITLE:=4G Network Setup Tools
endef
define Package/4g-support/description
4g-support contains necessary tools to setup 4G WAN connection
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./files/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
endef
define Package/4g-support/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,4g-support))

View File

@@ -0,0 +1,62 @@
opengt
set com 115200n81
set comecho off
set senddelay 0.05
waitquiet 1 0.2
:start
if $env("USE_DISCONNECT")="1" goto disconnect
send "AT^^NDISDUP=1,1,\""
send $env("USE_APN")
if $env("USE_AUTHTYPE")="-1" goto noauth
else goto auth
:noauth
send "\"^m"
goto result
:auth
send "\",\""
send $env("USE_USERID")
send "\",\""
send $env("USE_PASSWORD")
send "\","
send $env("USE_AUTHTYPE")
send "^m"
goto result
:result
waitfor 5 "OK","ERR","ERROR"
if % = 0 goto connok
if % = 1 goto connerr
if % = 2 goto connerr
:connok
print "WWAN connection established.\r\n"
goto done
:connerr
print "WWAN error. Connection failed.\r\n"
exit 1
:disconnect
send "AT^^NDISDUP=1,0,\""
send $env("USE_APN")
send "\"^m"
waitfor 5 "OK","ERR","ERROR"
if % = 0 goto disconnok
if % = 1 goto disconnerr
if % = 2 goto disconnerr
:disconnok
print "WWAN connection disconnected.\r\n"
goto done
:disconnerr
print "WWAN disconnection error.\r\n"
exit 1
:done
exit 0

View File

@@ -0,0 +1,35 @@
. /lib/network/config.sh
. /usr/share/libubox/jshn.sh
iface_status() {
local iface=$1
local up
json_load "$(ifstatus $iface)"
json_get_var up up
json_close_object
return $up
}
case "$ACTION" in
add|register)
if [ "${INTERFACE:0:4}" == "wwan" ]; then
netname=$(get_network_of "$INTERFACE")
for net in $netname; do
local service=$(uci -q get network.$net.service)
local cnt=0
while $(iface_status $net); do
ifup $net
if [ "$service" == "qmi" ]; then
cnt=$(($cnt+1))
# quit trying if still not online after three times
[ $cnt -eq 3 ] && break
sleep 5
else
break
fi
done
done
fi
;;
esac

View File

@@ -0,0 +1,74 @@
#!/bin/sh
local usb_dir uVid uPid uMa uPr uSe bConf bNumConfs vendor product mdmtyp netdev comdev cdcdev ttydev interface usbno usbbr
sanitize() {
sed -e 's/[[:space:]]\+$//; s/[[:space:]]\+/_/g' "$@"
}
find_usb_attrs() {
usb_dir="/sys/$DEVPATH"
[ -f "$usb_dir/idVendor" ] || usb_dir="${usb_dir%/*}"
uVid=$(cat "$usb_dir/idVendor")
uPid=$(cat "$usb_dir/idProduct")
uMa=$(sanitize "$usb_dir/manufacturer")
uPr=$(sanitize "$usb_dir/product")
uSe=$(sanitize "$usb_dir/serial")
bNumConfs=$(cat "$usb_dir/bNumConfigurations")
bConf=$(cat "$usb_dir/bConfigurationValue")
netdev=$(find $usb_dir -name wwan* | awk -F'/' '{print$NF}' | head -2 | tail -1)
cdcdev=$(find $usb_dir -name cdc-wdm* | awk -F'/' '{print$NF}' | head -2 | tail -1)
ttydev=$(ls $(find $usb_dir -name tty | head -2 | tail -1) | tail -1)
interface=$(cat $usb_dir/interface)
if [ -n "$cdcdev" ]; then
comdev=$cdcdev
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$2}' | head -1)
vendor=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$3}' | head -1)
product=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$4}' | head -1)
else
comdev=$ttydev
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$2}' | head -1)
vendor=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$3}' | head -1)
product=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$4}' | head -1)
fi
[ -n "$mdmtyp" ] || mdmtyp=$(grep $uVid:$uPid /etc/modemdb | awk '{print$2}' | head -1)
[ -n "$vendor" ] || vendor=$(grep $uVid:$uPid /etc/modemdb | awk '{print$3}' | head -1)
[ -n "$product" ] || product=$(grep $uVid:$uPid /etc/modemdb | awk '{print$4}' | head -1)
}
convert_to_mbim() {
if [ "$mdmtyp" == "mbim" ] && [ "$bNumConfs" == "2" ]; then
[ "$bConf" == "2" ] || echo 2 > $usb_dir/bConfigurationValue
fi
}
usbno=$(echo $DEVPATH | cut -d'/' -f5)
usbbr=$(echo $DEVPATH | cut -d'/' -f7)
case "$usbbr" in
*:*) usbbr=$(echo $DEVPATH | cut -d'/' -f6) ;;
esac
#devno=$(basename $DEVPATH)
find_usb_attrs
if [ "$ACTION" = add ]; then
convert_to_mbim "$uVid:$uPid"
if [ -n "$uVid" ] && [ -n "$uPid" ] && [ -n "$mdmtyp" ] && [ -n "$netdev" ] && [ -n "$comdev" ]; then
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
sed -i "/$usbno:$usbbr/ d" /var/usbnets
echo $usbno:$usbbr $uVid:$uPid $uMa $uPr $netdev $comdev $mdmtyp $vendor $product >> /var/usbnets
ubus send hotplug.usb "{'action': 'add', 'devpath': '$DEVPATH', 'manufacturer': '$uMa', 'product': '$uPr', 'serial': '$uSe', 'vendor_id': '$uVid', \
'product_id': '$uPid', 'driver_interface': '$interface', 'driver': '$DRIVER', 'devtype': '$DEVTYPE'}"
fi
fi
fi
if [ "$ACTION" = remove ]; then
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
sed -i "/$usbno:$usbbr/ d" /var/usbnets
ubus send hotplug.usb "{'action': 'remove', 'devpath': '$DEVPATH', 'manufacturer': '$uMa', 'product': '$uPr', 'serial': '$uSe', 'vendor_id': '$uVid', \
'product_id': '$uPid', 'driver_interface': '$interface', 'driver': '$DRIVER', 'devtype': '$DEVTYPE'}"
fi
fi

View File

@@ -0,0 +1,100 @@
1bbb:011e qmi
1a8d:1001 ecm
1a8d:100c ecm
1a8d:100d ecm
16d8:6280 qmi
16d8:6803 qmi
16d8:6804 qmi
16d8:7003 qmi
16d8:700a qmi
2001:7d01 mbim
2001:7d02 mbim
2001:7d03 mbim
12d1:14ac qmi
12d1:140c qmi
12d1:1506 qmi Huawei E367/392/398
12d1:1506 ncm Huawei E3276
12d1:14d2 qmi
12d1:1c07 ncm
12d1:1436 ecm
12d1:14c9 qmi
12d1:14db ecm
12d1:151d mbim
12d1:151e qmi Huawei E353
12d1:1c1e ncm
12d1:150c qmi
12d1:150f qmi
12d1:151b qmi
12d1:142d ecm
12d1:1432 ecm
12d1:1c1f ncm
12d1:1433 qmi
12d1:1465 ecm
12d1:14ca qmi
12d1:14cf ncm
12d1:14bc ecm
12d1:14ae ecm
12d1:1576 mbim
12d1:1577 mbim
12d1:1400 mbim
12d1:14f7 mbim
12d1:1464 qmi
12d1:14cb qmi
12d1:14cc qmi
12d1:14c6 qmi
12d1:14fa mbim
12d1:1578 mbim
12d1:14c8 qmi
12d1:14f8 mbim
12d1:1575 mbim
12d1:1579 mbim
12d1:157a mbim
12d1:157b mbim
12d1:157f mbim
12d1:1f16 mbim Vodafone K5150
12d1:1404 qmi
19f2:1700 ecm
1410:b001 qmi
1527:1000 ecm
0b3c:c005 qmi
0f3d:68a2 qmi
1199:68a2 qmi SierraWireless M7710
1199:68c0 qmi SierraWireless M7304
1349:1100 qmi
1349:1200 qmi
1199:683c qmi
2360:2100 qmi
2360:2200 qmi
2360:2300 qmi
2507:0000 qmi
19d2:0055 qmi
19d2:0052 qmi
19d2:0063 qmi
19d2:1008 qmi
19d2:1010 qmi
19d2:2002 qmi
19d2:1176 qmi
19d2:1023 mbim
19d2:0104 qmi
19d2:1018 qmi
19d2:1032 mbim
19d2:1402 qmi
19d2:1405 ecm
19d2:1426 qmi
19d2:0031 qmi
19d2:0124 qmi
19d2:1254 qmi
19d2:0017 qmi
19d2:0002 qmi
19d2:0121 qmi
19d2:1252 qmi
19d2:0157 qmi
19d2:0167 qmi
19d2:0199 qmi
19d2:0257 qmi
19d2:0326 qmi
19d2:0349 ecm
19d2:1408 ecm
19d2:0284 qmi
19d2:0019 qmi
19d2:0265 qmi

View File

@@ -0,0 +1,159 @@
#!/bin/sh
INCLUDE_ONLY=1
. /lib/functions.sh
. ../netifd-proto.sh
init_proto "$@"
proto_4g_init_config() {
proto_config_add_string "modem"
proto_config_add_string "service"
proto_config_add_string "comdev"
proto_config_add_string "ipaddr"
proto_config_add_string "netmask"
proto_config_add_string "hostname"
proto_config_add_string "clientid"
proto_config_add_string "vendorid"
proto_config_add_boolean "broadcast"
proto_config_add_string "reqopts"
proto_config_add_string "apn"
proto_config_add_string "username"
proto_config_add_string "password"
proto_config_add_boolean "lte_apn_use"
proto_config_add_string "lte_apn"
proto_config_add_string "lte_username"
proto_config_add_string "lte_password"
proto_config_add_string "pincode"
proto_config_add_string "technology"
proto_config_add_string "auto"
}
proto_4g_setup() {
local config="$1"
local iface="$2"
local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
local opt dhcpopts
for opt in $reqopts; do
append dhcpopts "-O $opt"
done
for opt in $sendopts; do
append dhcpopts "-x $opt"
done
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
[ -n "$zone" ] && proto_export "ZONE=$zone"
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
json_get_var comdev comdev
json_get_var apn apn
json_get_var service service
json_get_var pincode pincode
# if [ -n "$modem" ]; then
# service=$(echo $modem | cut -d':' -f1)
# comdev=$(echo $modem | cut -d':' -f2)
# iface=$(echo $modem | cut -d':' -f3)
# fi
case "$service" in
ecm)
;;
eem)
;;
mbim)
local mbimdev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
local comdev="${comdev:-$mbimdev}"
[ -n "$pincode" ] && {
if ! mbimcli -d $comdev --query-pin-state 2>&1 | grep -q "unlocked"; then
set -o pipefail
if ! mbimcli -d $comdev --enter-pin="${pincode}" 2>&1; then
mbimcli -d $comdev --query-pin-state
proto_notify_error "$config" PIN_FAILED
proto_block_restart "$interface"
return 1
fi
fi
}
APN="$apn" mbim-network $comdev start
;;
ncm)
[ -n "$pincode" ] && echo $pincode | gcom -d $comdev
USE_APN="$apn" gcom -d $comdev -s /etc/gcom/ncmconnection.gcom
;;
qmi)
local qmidev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
local comdev="${comdev:-$qmidev}"
[ -n "$pincode" ] && {
if ! qmicli -d $comdev --dms-uim-get-pin-status 2>&1 | grep -q "enabled-verified\|disabled" >/dev/null; then
set -o pipefail
if ! qmicli -d $comdev --dms-uim-verify-pin="PIN,${pincode}" 2>&1; then
qmicli -d $comdev --dms-uim-get-pin-status
proto_notify_error "$config" PIN_FAILED
proto_block_restart "$interface"
return 1
fi
fi
}
APN="$apn" qmi-network $comdev start
;;
esac
proto_export "INTERFACE=$config"
proto_run_command "$config" udhcpc -R \
-p /var/run/udhcpc-$iface.pid \
-s /lib/netifd/dhcp.script \
-f -t 0 -i "$iface" \
${ipaddr:+-r $ipaddr} \
${hostname:+-H $hostname} \
${vendorid:+-V $vendorid} \
$clientid $broadcast $dhcpopts
}
proto_4g_teardown() {
local interface="$1"
local iface="$2"
local modem service comdev
config_load network
config_get service $interface service
config_get comdev $interface comdev
# config_get modem $interface modem
# if [ -n "$modem" ]; then
# service=$(echo $modem | cut -d':' -f1)
# comdev=$(echo $modem | cut -d':' -f2)
# iface=$(echo $modem | cut -d':' -f3)
# fi
case "$service" in
ecm)
;;
eem)
;;
mbim)
local mbimdev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
local comdev="${comdev:-$mbimdev}"
mbim-network $comdev stop
;;
ncm)
USE_DISCONNECT=1 gcom -d $comdev -s /etc/gcom/ncmconnection.gcom
;;
qmi)
local qmidev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
local comdev="${comdev:-$qmidev}"
qmi-network $comdev stop
;;
esac
proto_kill_command "$interface"
}
add_protocol 4g

773
asterisk-1.8.x-mod/Makefile Normal file
View File

@@ -0,0 +1,773 @@
#
# Copyright (C) 2008-2012 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:=asterisk18-mod
PKG_VERSION:=1.8.10.1
PKG_SOURCE_VERSION:=ee99af0d91a2197529b13075d802ebc37e644e40
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se:/asterisk-1.8.x
PKG_RELEASE:=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)-$(PKG_RELEASE).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
-include $(INCLUDE_DIR)/ltqtapi.mk
include $(INCLUDE_DIR)/package.mk
define Package/asterisk18-mod/Default
SUBMENU:=Telephony
SECTION:=net
CATEGORY:=Network
URL:=http://www.asterisk.org/
endef
define Package/asterisk18-mod/Default/description
Asterisk is a complete PBX in software. It provides all of the features
you would expect from a PBX and more. Asterisk does voice over IP in three
protocols, and can interoperate with almost all standards-based telephony
equipment using relatively inexpensive hardware.
endef
define Package/asterisk18-mod
$(call Package/asterisk18-mod/Default)
TITLE:=Complete open source PBX, v1.8x
MENU:=1
DEPENDS:= +natalie-dect-h +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen +libopenssl +libncurses +libpopt +libpthread +uci +ubus +zlib @!TARGET_avr32
endef
define Package/asterisk18-mod/description
$(call Package/asterisk18-mod/Default/description)
endef
define Package/asterisk18-mod-sounds
$(call Package/asterisk18-mod/Default)
TITLE:=Sound files
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-sounds/description
$(call Package/asterisk18-mod/Default/description)
This package contains sound files for Asterisk.
endef
define Package/asterisk18-mod-voicemail
$(call Package/asterisk18-mod/Default)
TITLE:=Voicemail support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-voicemail/description
$(call Package/asterisk18-mod/Default/description)
This package contains voicemail related modules for Asterisk.
endef
define Package/asterisk18-mod-app-transfer
$(call Package/asterisk18-mod/Default)
TITLE:=Call transfer support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-app-transfer/description
$(call Package/asterisk18-mod/Default/description)
This package contains the call transfer support module for Asterisk.
endef
define Package/asterisk18-mod-app-softhangup
$(call Package/asterisk18-mod/Default)
TITLE:=SoftHangup application
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-app-softhangup/description
$(call Package/asterisk18-mod/Default/description)
This package contains the SoftHangup support module for Asterisk.
endef
define Package/asterisk18-mod-app-meetme
$(call Package/asterisk18-mod/Default)
TITLE:=conferencing support
DEPENDS:= asterisk18-mod +dahdi-tools-libtonezone +dahdi
endef
define Package/asterisk18-mod-app-meetme/description
$(call Package/asterisk18-mod/Default/description)
This package provides the MeetMe application driver Conferencing support to
Asterisk.
endef
define Package/asterisk18-mod-chan-iax2
$(call Package/asterisk18-mod/Default)
TITLE:=IAX support
DEPENDS:= asterisk18-mod +asterisk18-res-crypto
endef
define Package/asterisk18-mod-chan-iax2/description
$(call Package/asterisk18-mod/Default/description)
This package provides IAX support to
Asterisk.
endef
define Package/asterisk18-mod-cdr
$(call Package/asterisk18-mod/Default)
TITLE:=CDR support
DEPENDS:= asterisk18-mod +libsqlite3
endef
define Package/asterisk18-mod-cdr/description
$(call Package/asterisk18-mod/Default/description)
This package provides Call Detail Record support to
Asterisk.
endef
define Package/asterisk18-mod-res-musiconhold
$(call Package/asterisk18-mod/Default)
TITLE:=MOH support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-res-musiconhold/description
$(call Package/asterisk18-mod/Default/description)
This package provides Music On Hold support to
Asterisk.
endef
define Package/asterisk18-mod-res-voice
$(call Package/asterisk18-mod/Default)
TITLE:=Voice client/pbx support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-res-voice/description
$(call Package/asterisk18-mod/Default/description)
This package provides Voice Client/pbx support to
Asterisk.
endef
define Package/asterisk18-mod-res-srtp
$(call Package/asterisk18-mod/Default)
TITLE:=SRTP support
DEPENDS:= asterisk18-mod libsrtp +asterisk18-mod-res-crypto
endef
define Package/asterisk18-mod-res-srtp/description
$(call Package/asterisk18-mod/Default/description)
This package provides SRTP support to
Asterisk.
endef
define Package/asterisk18-mod-res-stun
$(call Package/asterisk18-mod/Default)
TITLE:=STUN support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-app-queue
$(call Package/asterisk18-mod/Default)
TITLE:=Queue support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-chan-gtalk
$(call Package/asterisk18-mod/Default)
TITLE:=GTalk support
DEPENDS:= asterisk18-mod +libiksemel
endef
define Package/asterisk18-mod-chan-gtalk/description
$(call Package/asterisk18-mod/Default/description)
This package provides the channel chan_gtalk and res_jabber for GTalk
support to Asterisk.
endef
define Package/asterisk18-mod-res-timing-timerfd
$(call Package/asterisk18-mod/Default)
TITLE:= Timerfd Timing Interface
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-res-timing-pthread
$(call Package/asterisk18-mod/Default)
TITLE:= pthread Timing Interface
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-res-fax
$(call Package/asterisk18-mod/Default)
TITLE:=Generic FAX Resource for FAX technology resource modules
DEPENDS:= asterisk18-mod +asterisk18-mod-res-timing-pthread
endef
define Package/asterisk18-mod-res-fax-spandsp
$(call Package/asterisk18-mod/Default)
TITLE:=Spandsp T.38 and G.711 FAX Resource
DEPENDS:= asterisk18-mod +asterisk18-mod-res-fax +libspandsp
endef
define Package/asterisk18-mod-chan-mgcp
$(call Package/asterisk18-mod/Default)
TITLE:=MGCP channel support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-chan-mgcp/description
$(call Package/asterisk18-mod/Default/description)
This package provides the channel chan_mgcp support to Asterisk.
endef
define Package/asterisk18-mod-chan-skinny
$(call Package/asterisk18-mod/Default)
TITLE:=Skinny channel support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-chan-skinny/description
$(call Package/asterisk18-mod/Default/description)
This package provides the channel chan_skinny support to Asterisk.
endef
define Package/asterisk18-mod-chan-brcm
$(call Package/asterisk18-mod/Default)
TITLE:=Broadcom channel support
DEPENDS:= asterisk18-mod
endef
define Package/asterisk18-mod-chan-brcm/description
$(call Package/asterisk18-mod/Default/description)
This package provides the channel chan_brcm support to Asterisk.
endef
define Package/asterisk18-mod-curl
$(call Package/asterisk18-mod/Default)
TITLE:=CURL support
DEPENDS:= asterisk18-mod +libcurl
endef
define Package/asterisk18-mod-curl/description
$(call Package/asterisk18-mod/Default/description)
This package provides CURL
support to Asterisk.
endef
define Package/asterisk18-mod-mysql
$(call Package/asterisk18-mod/Default)
TITLE:=MySQL support
DEPENDS:= asterisk18-mod +PACKAGE_asterisk18-mysql:libmysqlclient
endef
define Package/asterisk18-mod-mysql/description
$(call Package/asterisk18-mod/Default/description)
This package provides MySQL
support to Asterisk.
endef
define Package/asterisk18-mod-chan-lantiq
$(call Package/asterisk18-mod/Default)
TITLE:=Lantiq TAPI support
DEPENDS:= asterisk18-mod $(LTQ_TAPI_DEPENDS)
URL:=http://git.nanl.de/?p=asterisk_channel_lantiq.git
MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
endef
define Package/asterisk18-mod-chan-lantiq/description
$(call Package/asterisk18-mod/Default/description)
This package provides the channel chan_lantiq support to Asterisk.
endef
CONFIGURE_ARGS+= \
--without-inotify
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-app-meetme),)
CONFIGURE_ARGS+= \
--with-dahdi="$(STAGING_DIR)/usr"
else
CONFIGURE_ARGS+= \
--without-dahdi
endif
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-chan-gtalk),)
CONFIGURE_ARGS+= \
--with-gnutls="$(STAGING_DIR)/usr" \
--with-iksemel="$(STAGING_DIR)/usr"
SITE_VARS+= \
ac_cv_lib_iksemel_iks_start_sasl=yes \
ac_cv_lib_gnutls_gnutls_bye=yes
else
CONFIGURE_ARGS+= \
--without-gnutls \
--without-iksemel
endif
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-curl),)
CONFIGURE_ARGS+= \
--with-curl="$(STAGING_DIR)/usr"
else
CONFIGURE_ARGS+= \
--without-curl
endif
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-mysql),)
CONFIGURE_ARGS+= \
--with-mysqlclient="$(STAGING_DIR)/usr/bin"
else
CONFIGURE_ARGS+= \
--without-mysqlclient
endif
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-res-fax-spandsp),)
CONFIGURE_ARGS+= \
--with-spandsp="$(STAGING_DIR)/usr"
else
CONFIGURE_ARGS+= \
--without-spandsp
endif
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-res-srtp),)
CONFIGURE_ARGS+= \
--with-srtp="$(STAGING_DIR)/usr"
else
CONFIGURE_ARGS+= \
--without-srtp
endif
ifeq ($(CONFIG_TARGET_IBOARDID),"D301")
EXTRA_CFLAGS += -DNTR_SUPPORT
endif
CONFIGURE_ARGS+= \
--without-curses \
--with-gsm=internal \
--without-cap \
--without-gtk \
--without-gtk2 \
--without-isdnnet \
--without-kde \
--without-misdn \
--without-nbs \
--with-ncurses="$(STAGING_DIR)/usr" \
--without-netsnmp \
--without-newt \
--without-odbc \
--without-ogg \
--without-osptk \
--with-popt="$(STAGING_DIR)/usr" \
--without-pri \
--without-qt \
--without-radius \
--without-sdl \
--without-suppserv \
--without-tds \
--without-termcap \
--without-tinfo \
--without-vorbis \
--without-vpb \
--with-z="$(STAGING_DIR)/usr" \
--with-sounds-cache="$(DL_DIR)" \
--disable-xmldoc
# I've had strange errors with -fno-caller-saves
# in global CFLAGS so revert it. /Ronny
EXTRA_CFLAGS+= -O2 -fcaller-saves
EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
EXTRA_LDFLAGS+= $(TARGET_LDFLAGS)
define Build/Prepare
$(call Build/Prepare/Default)
ifneq ($(CONFIG_TARGET_lantiq),)
$(CP) ./src-lantiq/* $(PKG_BUILD_DIR)/
endif
endef
define Build/Configure
-rm $(PKG_BUILD_DIR)/menuselect.makeopts
$(call Build/Configure/Default,,$(SITE_VARS))
endef
define Build/Compile
$(MAKE) -C "$(PKG_BUILD_DIR)" \
include/asterisk/version.h \
include/asterisk/buildopts.h defaults.h \
makeopts.embed_rules
ASTCFLAGS="$(EXTRA_CFLAGS) -DLOW_MEMORY" \
ASTLDFLAGS="$(EXTRA_LDFLAGS)" \
$(MAKE) -C "$(PKG_BUILD_DIR)" \
ASTVARLIBDIR="/usr/lib/asterisk" \
ASTDATADIR="/usr/lib/asterisk" \
ASTKEYDIR="/usr/lib/asterisk" \
ASTDBDIR="/usr/lib/asterisk" \
NOISY_BUILD="1" \
DEBUG="" \
OPTIMIZE="" \
DESTDIR="$(PKG_INSTALL_DIR)" \
all install samples
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/asterisk-1.8/include/asterisk/
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk/*.h $(1)/usr/include/asterisk-1.8/include/asterisk/
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk.h $(1)/usr/include/asterisk-1.8/include/
endef
define Package/asterisk18-mod/conffiles
/etc/asterisk/asterisk.conf
/etc/asterisk/modules.conf
/etc/asterisk/extensions.conf
/etc/asterisk/sip.conf
/etc/asterisk/sip_notify.conf
/etc/asterisk/features.conf
/etc/asterisk/indications.conf
/etc/asterisk/logger.conf
/etc/asterisk/manager.conf
/etc/asterisk/rtp.conf
/etc/default/asterisk
/etc/init.d/asterisk
endef
define Package/asterisk18-mod/install
$(INSTALL_DIR) $(1)/etc/asterisk/ssl
for f in asterisk extensions features \
indications logger manager modules \
sip sip_notify rtp; do \
$(CP) $(PKG_INSTALL_DIR)/etc/asterisk/$$$$f.conf $(1)/etc/asterisk/ ; \
done
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
for f in app_dial app_echo app_playback app_macro \
chan_sip res_rtp_asterisk res_rtp_multicast \
codec_ulaw codec_gsm \
format_gsm format_pcm format_wav format_wav_gsm \
pbx_config \
func_strings func_timeout func_callerid func_logic; do \
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$$$f.so $(1)/usr/lib/asterisk/modules/ ; \
done
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/default
$(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/asterisk.hotplug $(1)/etc/hotplug.d/iface/80-asterisk
endef
define Package/asterisk18-mod-sounds/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/* $(1)/usr/lib/asterisk/sounds/
rm -f $(1)/usr/lib/asterisk/sounds/vm-*
rm -f $(1)/usr/lib/asterisk/sounds/conf-*
endef
define Package/asterisk18-mod-voicemail/conffiles
/etc/asterisk/voicemail.conf
endef
define Package/asterisk18-mod-voicemail/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/voicemail.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*voicemail.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_adsi.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_smdi.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/vm-*.gsm $(1)/usr/lib/asterisk/sounds/
endef
define Package/asterisk18-mod-app-meetme/conffiles
/etc/asterisk/meetme.conf
endef
define Package/asterisk18-mod-app-meetme/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/meetme.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_meetme.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/conf-*.gsm $(1)/usr/lib/asterisk/sounds/
endef
define Package/asterisk18-mod-chan-iax2/conffiles
/etc/asterisk/iax.conf
/etc/asterisk/iaxprov.conf
endef
define Package/asterisk18-mod-cdr/conffiles
/etc/asterisk/cdr.conf
/etc/asterisk/cdr_custom.conf
/etc/asterisk/cdr_manager.conf
/etc/asterisk/cdr_odbc.conf
/etc/asterisk/cdr_pgsql.conf
/etc/asterisk/cdr_tds.conf
endef
define Package/asterisk18-mod-res-musiconhold/conffiles
/etc/asterisk/musiconhold.conf
endef
define Package/asterisk18-mod-chan-iax2/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/iax.conf $(1)/etc/asterisk/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/iaxprov.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_iax2.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-cdr/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/cdr*.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*cdr*.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-musiconhold/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_musiconhold.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-voice/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_voice.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-chan-gtalk/conffiles
/etc/asterisk/gtalk.conf
/etc/asterisk/jabber.conf
endef
define Package/asterisk18-mod-chan-gtalk/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/gtalk.conf $(1)/etc/asterisk/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/jabber.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_gtalk.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_jabber.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-timing-timerfd/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_timing_timerfd.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-timing-pthread/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_timing_pthread.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-fax/conffiles
/etc/asterisk/res_fax.conf
endef
define Package/asterisk18-mod-res-fax/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/res_fax.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_fax.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-fax-spandsp/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_fax_spandsp.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-chan-mgcp/conffiles
/etc/asterisk/mgcp.conf
endef
define Package/asterisk18-mod-chan-mgcp/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/mgcp.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_mgcp.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-chan-skinny/conffiles
/etc/asterisk/skinny.conf
endef
define Package/asterisk18-mod-chan-skinny/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/skinny.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_skinny.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-chan-brcm/conffiles
/etc/asterisk/brcm.conf
endef
define Package/asterisk18-mod-chan-brcm/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/brcm.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_brcm.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-curl/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/func_curl.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_curl.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-app-transfer/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_transfer.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-app-softhangup/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_softhangup.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-mysql/conffiles
/etc/asterisk/app_mysql.conf
/etc/asterisk/res_config_mysql.conf
/etc/asterisk/cdr_mysql.conf
endef
define Package/asterisk18-mod-mysql/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/app_mysql.conf $(1)/etc/asterisk/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/res_config_mysql.conf $(1)/etc/asterisk/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/cdr_mysql.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_mysql.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/cdr_mysql.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_config_mysql.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-chan-lantiq/conffiles
/etc/asterisk/lantiq.conf
endef
define Package/asterisk18-mod-chan-lantiq/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/lantiq.conf $(1)/etc/asterisk/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_lantiq.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-srtp/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_srtp.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-res-stun/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_stun_monitor.so $(1)/usr/lib/asterisk/modules/
endef
define Package/asterisk18-mod-app-queue/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_queue.so $(1)/usr/lib/asterisk/modules/
endef
define Buildasterisk18-modModuleTemplate
define Package/asterisk18-mod-$(subst _,-,$(1))
$$(call Package/asterisk18-mod/Default)
TITLE:=$(2) support
DEPENDS:= asterisk18-mod $(4)
endef
define Package/asterisk18-mod-$(subst _,-,$(1))/description
$$(call Package/asterisk18-mod/Default/description)
This package provides support $(3) in Asterisk.
endef
define Package/asterisk18-mod-$(subst _,-,$(1))/install
$(INSTALL_DIR) $$(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$(1).so $$(1)/usr/lib/asterisk/modules/
endef
$$(eval $$(call BuildPackage,asterisk18-mod-$(subst _,-,$(1))))
endef
$(eval $(call BuildPackage,asterisk18-mod))
$(eval $(call BuildPackage,asterisk18-mod-voicemail))
$(eval $(call BuildPackage,asterisk18-mod-sounds))
$(eval $(call BuildPackage,asterisk18-mod-app-meetme))
$(eval $(call BuildPackage,asterisk18-mod-app-transfer))
$(eval $(call BuildPackage,asterisk18-mod-app-softhangup))
$(eval $(call BuildPackage,asterisk18-mod-chan-iax2))
$(eval $(call BuildPackage,asterisk18-mod-cdr))
$(eval $(call BuildPackage,asterisk18-mod-res-musiconhold))
$(eval $(call BuildPackage,asterisk18-mod-res-voice))
$(eval $(call BuildPackage,asterisk18-mod-chan-gtalk))
$(eval $(call BuildPackage,asterisk18-mod-res-fax))
$(eval $(call BuildPackage,asterisk18-mod-res-fax-spandsp))
$(eval $(call BuildPackage,asterisk18-mod-res-timing-timerfd))
$(eval $(call BuildPackage,asterisk18-mod-res-timing-pthread))
$(eval $(call BuildPackage,asterisk18-mod-chan-mgcp))
$(eval $(call BuildPackage,asterisk18-mod-chan-skinny))
$(eval $(call BuildPackage,asterisk18-mod-chan-brcm))
$(eval $(call BuildPackage,asterisk18-mod-curl))
$(eval $(call BuildPackage,asterisk18-mod-mysql))
$(eval $(call BuildPackage,asterisk18-mod-chan-lantiq))
$(eval $(call BuildPackage,asterisk18-mod-res-srtp))
$(eval $(call BuildPackage,asterisk18-mod-res-stun))
$(eval $(call BuildPackage,asterisk18-mod-app-queue))
$(eval $(call Buildasterisk18-modModuleTemplate,app_authenticate,Authenticate,support for executing arbitrary authenticate commands))
$(eval $(call Buildasterisk18-modModuleTemplate,app_chanisavail,Channel availability check,support for checking if a channel is available))
$(eval $(call Buildasterisk18-modModuleTemplate,app_chanspy,Channel listen in,support for listening in on any channel))
$(eval $(call Buildasterisk18-modModuleTemplate,app_directed_pickup,Directed call pickup,support for directed call pickup))
$(eval $(call Buildasterisk18-modModuleTemplate,app_exec,Exec application,support for application execution))
$(eval $(call Buildasterisk18-modModuleTemplate,app_minivm,Minimal voicemail system,a voicemail system in small building blocks working together based on the Comedian Mail voicemail system))
$(eval $(call Buildasterisk18-modModuleTemplate,app_readexten,Extension to variable,a trivial application to read an extension into a variable))
$(eval $(call Buildasterisk18-modModuleTemplate,app_read,Variable read,a trivial application to read a variable))
$(eval $(call Buildasterisk18-modModuleTemplate,app_sayunixtime,Say Unix time,an application to say Unix time))
$(eval $(call Buildasterisk18-modModuleTemplate,app_sms,SMS,SMS support (ETSI ES 201 912 protocol 1)))
$(eval $(call Buildasterisk18-modModuleTemplate,app_stack,Stack applications, stack applications Gosub Return etc., +asterisk18-res-agi))
$(eval $(call Buildasterisk18-modModuleTemplate,app_system,System exec,support for executing system commands))
$(eval $(call Buildasterisk18-modModuleTemplate,app_talkdetect,File playback with audio detect,for file playback with audio detect))
$(eval $(call Buildasterisk18-modModuleTemplate,app_waituntil,Sleep,support sleeping until the given epoch))
$(eval $(call Buildasterisk18-modModuleTemplate,app_while,While loop,a while loop implementation))
$(eval $(call Buildasterisk18-modModuleTemplate,chan_agent,Agents proxy channel, an implementation of agents proxy channel))
$(eval $(call Buildasterisk18-modModuleTemplate,chan_local,Local proxy channel, an implementation of local proxy channel))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_alaw,Signed linear to alaw translation,translation between signed linear and alaw codecs))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_ulaw,Signed linear to ulaw translation,translation between signed linear and ulaw codecs))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_a_mu,Alaw to ulaw translation,translation between alaw and ulaw codecs))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_g722,G.722,a high bit rate 48/56/64Kbps ITU standard codec))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_g726,Signed linear to G.726 translation,translation between signed linear and ITU G.726-32kbps codecs))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_ilbc,iLBC,internet Low Bitrate Codec))
$(eval $(call Buildasterisk18-modModuleTemplate,codec_gsm,GSM,GSM codec))
$(eval $(call Buildasterisk18-modModuleTemplate,format_g726,G.726,support for headerless G.726 16/24/32/40kbps data format))
$(eval $(call Buildasterisk18-modModuleTemplate,format_g729,G.729,support for raw headerless G729 data))
$(eval $(call Buildasterisk18-modModuleTemplate,format_sln,Raw slinear format,support for raw slinear format))
$(eval $(call Buildasterisk18-modModuleTemplate,format_sln16,Raw slinear 16 format,support for Raw slinear 16 format))
$(eval $(call Buildasterisk18-modModuleTemplate,func_db,Database interaction,functions for interaction with the database))
$(eval $(call Buildasterisk18-modModuleTemplate,func_devstate,Blinky lights control,functions for manually controlled blinky lights))
$(eval $(call Buildasterisk18-modModuleTemplate,func_vmcount,vmcount dialplan,a vmcount dialplan function))
$(eval $(call Buildasterisk18-modModuleTemplate,func_extstate,Hinted extension state,retrieving the state of a hinted extension for dialplan control))
$(eval $(call Buildasterisk18-modModuleTemplate,func_global,Global variable,global variable dialplan functions))
$(eval $(call Buildasterisk18-modModuleTemplate,func_shell,Shell,support for shell execution))
$(eval $(call Buildasterisk18-modModuleTemplate,pbx_ael,Asterisk Extension Logic,support for symbolic Asterisk Extension Logic))
$(eval $(call Buildasterisk18-modModuleTemplate,res_ael_share,Shareable AEL code,support for shareable AEL code mainly between internal and external modules))
$(eval $(call Buildasterisk18-modModuleTemplate,pbx_spool,Call Spool,outgoing call spool support))
$(eval $(call Buildasterisk18-modModuleTemplate,res_agi,Asterisk Gateway Interface,support for the Asterisk Gateway Interface extension))
$(eval $(call Buildasterisk18-modModuleTemplate,res_crypto,Provide Crypto,Cryptographic Signature capability))
$(eval $(call Buildasterisk18-modModuleTemplate,app_alarmreceiver,Alarm receiver,Central Station Alarm receiver for Ademco Contact ID))
$(eval $(call Buildasterisk18-modModuleTemplate,app_setcallerid,Set callerid,support for setting callerid))
$(eval $(call Buildasterisk18-modModuleTemplate,app_verbose,Verbose logging,Verbose logging application))
$(eval $(call Buildasterisk18-modModuleTemplate,func_channel,Channel info,Channel info dialplan function))
$(eval $(call Buildasterisk18-modModuleTemplate,func_blacklist,Blacklist on callerid,looking up the callerid number and see if it is blacklisted))
$(eval $(call Buildasterisk18-modModuleTemplate,app_originate,Originate a call,originating an outbound call and connecting it to a specified extension or application))
$(eval $(call Buildasterisk18-modModuleTemplate,func_uri,URI encoding and decoding,Encodes and decodes URI-safe strings))
$(eval $(call Buildasterisk18-modModuleTemplate,app_disa,Direct Inward System Access,Direct Inward System Access))
$(eval $(call Buildasterisk18-modModuleTemplate,app_senddtmf,Send DTMF digits,Sends arbitrary DTMF digits))
$(eval $(call Buildasterisk18-modModuleTemplate,func_cut,CUT function,CUT function))
$(eval $(call Buildasterisk18-modModuleTemplate,res_clioriginate,Calls via CLI,Originate calls via the CLI))
$(eval $(call Buildasterisk18-modModuleTemplate,app_mixmonitor,Record a call and mix the audio,record a call and mix the audio during the recording))
$(eval $(call Buildasterisk18-modModuleTemplate,app_playtones,Playtones application,play a tone list))
$(eval $(call Buildasterisk18-modModuleTemplate,app_record,Record sound file,to record a sound file))

View File

@@ -0,0 +1,4 @@
## startup options for /etc/init.d/asterisk
ENABLE_ASTERISK="yes"
OPTIONS=""

View File

@@ -0,0 +1,19 @@
#!/bin/sh
[ "$ACTION" = ifup ] || exit 0
config_load voice_client
config_get bindintf SIP bindintf
[ "$INTERFACE" == "$bindintf" ] || exit 0
. /lib/functions/network.sh
if [ -n "$bindintf" ]; then
network_get_ipaddr bindaddr "$bindintf"
[ -z "$bindaddr" ] && network_get_ipaddr6 bindaddr "$bindintf"
bindaddr="${bindaddr:-0.0.0.0}"
sed -i "s/bindaddr=.*/bindaddr=$bindaddr/g" /etc/asterisk/sip.conf
[ -e /var/run/asterisk/asterisk.ctl ] && /etc/init.d/asterisk reload
fi

View File

@@ -0,0 +1,56 @@
#!/bin/sh /etc/rc.common
START=98
STOP=10
. /usr/share/libubox/jshn.sh
. /lib/functions/network.sh
USE_PROCD=1
NAME=asterisk
PROG=/usr/sbin/asterisk
DEFAULT=/etc/default/asterisk
CONFDIR=/etc/asterisk
init_asterisk() {
[ -f $DEFAULT ] && . $DEFAULT
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
[ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk
# does the board have a fxs relay?
local fxsRelayGpio=$(db -q get hw.board.fxsRelayGpio)
if [ "$fxsRelayGpio" != "" ]; then
/sbin/brcm_fw_tool set -x $fxsRelayGpio -p 1
fi
}
service_triggers() {
procd_add_reload_trigger voice_client
}
start_service() {
init_asterisk
procd_open_instance
procd_set_param command "$PROG" -f
procd_set_param respawn
procd_close_instance
# service_start /usr/sbin/asterisk
}
reload_service() {
asterisk -rx "config reload $CONFDIR/sip.conf"
sleep 1
asterisk -rx "core reload"
asterisk -rx "dialplan reload"
asterisk -rx "brcm reload"
}
restart() {
reload
}
stop_service() {
service_stop /usr/sbin/asterisk
}

67
ated/Makefile Normal file
View File

@@ -0,0 +1,67 @@
#
# Copyright (C) 2016 inteno
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ated
PKG_VERSION:=1.2.2
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=f614cba983d827d5185c60a6a5a35530621d44d2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se:/ated
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
# support parallel build
#PKG_BUILD_PARALLEL:=1
#re create configure scripts if not present.
#PKG_FIXUP:=autoreconf
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
# this way we don't need to pick out the resulting files from the build dir.
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/ated
CATEGORY:=Utilities
TITLE:=Daemon for handling wifi calibration
URL:=
DEPENDS:= libc
endef
define Package/ated/description
Daemon for handling wifi calibration
endef
#TARGET_CFLAGS += -I$(LINUX_DIR)/include -I$(LINUX_DIR)/arch/mips/include
MAKE_FLAGS += \
v=2 \
m=3
#TARGET_CPPFLAGS := \
# -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
# -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
# $(TARGET_CPPFLAGS)
# we donot wwant to have any install.
define Build/Install/Default
endef
define Package/ated/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ated $(1)/sbin/
endef
$(eval $(call BuildPackage,ated))

View File

@@ -13,9 +13,6 @@ PKG_MD5SUM:=b72c17870bfab2fd791b1f6de4d79f9e
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=none
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)

View File

@@ -1,23 +0,0 @@
config BBF_VENDOR_EXTENSION
bool "Enable Vendor Extension"
default y
config BBF_VENDOR_LIST
string "Vendor List"
default "iopsys"
config BBF_VENDOR_PREFIX
string "Vendor Prefix"
default "X_IOPSYS_EU_"
config BBF_TR143
bool "Enable TR-143 Data Model Support"
default y
config BBF_TR471
bool "Enable TR-471 Data Model Support"
default y
config BBF_MAX_OBJECT_INSTANCES
int "Maximum number of instances per object"
default 255

View File

@@ -1,251 +0,0 @@
#
# Copyright (C) 2023 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm
PKG_VERSION:=1.4.23
USE_LOCAL:=0
ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=c10303fc51a1034cb87040e0eaf23c95d2b1c658
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libbbfdm-api
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
ABI_VERSION:=1.0
endef
define Package/libbbfdm/default
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Library for broadband forum data model support
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbfdm-api \
+BBF_TR471:obudpst
endef
define Package/libbbfdm
$(Package/libbbfdm/default)
TITLE += (default)
VARIANT:=default
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
DEFAULT_VARIANT:=1
endef
define Package/libbbfdm-mbedtls
$(Package/libbbfdm/default)
TITLE += (mbedtls)
DEPENDS += +PACKAGE_libbbfdm-mbedtls:libmbedtls
VARIANT:=mbedtls
CONFLICTS := libbbfdm libbbfdm-openssl libbbfdm-wolfssl
endef
define Package/libbbfdm-openssl
$(Package/libbbfdm/default)
TITLE += (openssl)
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
VARIANT:=openssl
CONFLICTS := libbbfdm libbbfdm-mbedtls libbbfdm-wolfssl
endef
define Package/libbbfdm-wolfssl
$(Package/libbbfdm/default)
TITLE += (wolfssl)
DEPENDS += +PACKAGE_libbbfdm-wolfssl:libwolfssl
VARIANT:=wolfssl
CONFLICTS := libbbfdm libbbfdm-mbedtls libbbfdm-openssl
endef
define Package/bbfdmd
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Datamodel ubus backend
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api +PACKAGE_libbbfdm-mbedtls:libbbfdm-mbedtls \
+PACKAGE_libbbfdm-openssl:libbbfdm-openssl +PACKAGE_libbbfdm-wolfssl:libbbfdm-wolfssl \
+PACKAGE_libbbfdm:libbbfdm
endef
define Package/userinterface
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=Package to add Device.UserInterface. datamodel support
endef
define Package/userinterface/description
Package to add Device.UserInterface. datamodel support
endef
define Package/libbbfdm/config
source "$(SOURCE)/Config_bbfdm.in"
endef
define Package/libbbfdm-api/description
Library contains the API(UCI, UBUS, JSON, CLI and Browse) of libbbfdm
endef
define Package/libbbfdm/description
Library contains the data model tree. It includes TR181, TR143 data models
endef
ifeq ($(USE_LOCAL),1)
define Build/Prepare
$(CP) ~/git/bbfdm/* $(PKG_BUILD_DIR)/
endef
endif
CMAKE_OPTIONS += \
-DBBF_TR181=ON
-DBBF_WIFI_DATAELEMENTS=ON
ifeq ($(CONFIG_BBF_TR143),y)
CMAKE_OPTIONS += \
-DBBF_TR143=ON
endif
ifeq ($(CONFIG_BBF_TR471),y)
CMAKE_OPTIONS += \
-DBBF_TR471=ON
endif
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
CMAKE_OPTIONS += \
-DBBF_VENDOR_EXTENSION=ON
CMAKE_OPTIONS += \
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
endif ##CONFIG_BBF_VENDOR_EXTENSION
ifeq ($(BUILD_VARIANT),default)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
endif
ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
endif
ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
endif
ifeq ($(CONFIG_PACKAGE_bbfdmd),y)
CMAKE_OPTIONS += \
-DBBFDMD_MAX_MSG_LEN:Integer=10485760
endif
define Package/libbbfdm-api/install
$(INSTALL_DIR) $(1)/lib
$(CP) $(PKG_BUILD_DIR)/libbbfdm-api/libbbfdm-api.so $(1)/lib/
endef
define Package/libbbfdm/default/install
$(INSTALL_DIR) $(1)/lib
$(INSTALL_DIR) $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(CP) $(PKG_BUILD_DIR)/libbbfdm/libbbfdm.so $(1)/lib/
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
$(INSTALL_BIN) ./files/etc/uci-defaults/95-portmap-firewall $(1)/etc/uci-defaults/95-portmap-firewall
$(INSTALL_BIN) ./files/etc/uci-defaults/97-firewall-service $(1)/etc/uci-defaults/97-firewall-service
$(INSTALL_BIN) ./files/etc/uci-defaults/99-link-core-plugins $(1)/etc/uci-defaults/99-link-core-plugins
$(INSTALL_BIN) ./files/etc/firewall.portmap $(1)/etc/firewall.portmap
$(INSTALL_BIN) ./files/etc/firewall.service $(1)/etc/firewall.service
ifeq ($(CONFIG_BBF_TR143),y)
$(INSTALL_DIR) $(1)/usr/share/bbfdm
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libbbfdm/scripts/* $(1)/usr/share/bbfdm
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
endif
endef
define Package/libbbfdm/default/prerm
#!/bin/sh
rm -rf /etc/bbfdm/dmmap/*
exit 0
endef
define Package/bbfdmd/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/bbfdm
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
$(INSTALL_DATA) ./files/etc/bbfdm/input.json $(1)/etc/bbfdm/
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
$(INSTALL_BIN) ./files/etc/bbfdm/bbfdm_services.sh $(1)/etc/bbfdm/
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
endef
define Package/userinterface/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_DATA) ./files/etc/config/userinterface $(1)/etc/config/userinterface
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/userinterface $(1)/lib/upgrade/keep.d/userinterface
$(INSTALL_BIN) ./files/etc/init.d/userinterface $(1)/etc/init.d/userinterface
$(INSTALL_BIN) ./files/etc/uci-defaults/93-userinterface-firewall $(1)/etc/uci-defaults/93-userinterface-firewall
$(INSTALL_BIN) ./files/etc/uci-defaults/94-userinterface-json $(1)/etc/uci-defaults/94-userinterface-json
$(INSTALL_BIN) ./files/etc/firewall.userinterface $(1)/etc/firewall.userinterface
endef
Package/libbbfdm/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
Package/libbbfdm/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-openssl/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-wolfssl/install = $(Package/libbbfdm/default/install)
Package/libbbfdm-mbedtls/install = $(Package/libbbfdm/default/install)
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
$(INSTALL_DIR) $(1)/usr/include/libbbfdm-api
$(INSTALL_DIR) $(1)/usr/include/libbbf_api
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/*.h $(1)/usr/include/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm/dmtree/tr181/device.h $(1)/usr/include/libbbfdm/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/vendor.h $(1)/usr/include/libbbfdm/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbfdm-api/
# Work around for backward compatibility
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/*.h $(1)/usr/include/libbbf_api/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbfdm-api/include/libbbfdm_api.h $(1)/usr/include/libbbf_api.h
endef
$(eval $(call BuildPackage,libbbfdm-api))
$(eval $(call BuildPackage,libbbfdm))
$(eval $(call BuildPackage,libbbfdm-openssl))
$(eval $(call BuildPackage,libbbfdm-wolfssl))
$(eval $(call BuildPackage,libbbfdm-mbedtls))
$(eval $(call BuildPackage,bbfdmd))
$(eval $(call BuildPackage,userinterface))

View File

@@ -1,9 +0,0 @@
#
# Copyright (C) 2023 IOPSYS
#
define BbfdmInstallPlugin
$(INSTALL_DIR) $(1)/etc/bbfdm/plugins
$(INSTALL_DATA) $(2) $(1)/etc/bbfdm/plugins/
endef

View File

@@ -1,47 +0,0 @@
#!/bin/sh
BBFDMD="/usr/sbin/bbfdmd"
bbfdm_add_service()
{
local name path
name="${1}"
path="${2}"
if [ -z "${name}" -o -z "$path" ]; then
return 0;
fi
ubus call service add "{'name':'bbfdm.services','instances':{'$name':{'command':['$BBFDMD','-m','$path']}}}"
}
bbfdm_stop_service()
{
local name
name="${1}"
if [ -z "${name}" ]; then
return 0;
fi
if ubus call service list '{"name":"bbfdm.services"}' |grep -q "bbfdm.$name"; then
ubus call service delete "{'name':'bbfdm.services','instance':'bbfdm.$name'}"
fi
}
usages()
{
echo "Usages $0: <OPTIONS>..."
echo
echo " -h show help"
echo " -k micro-service name to stop"
echo
}
while getopts "s:k:h" opts; do
case "$opts" in
h) usages; exit 0;;
k) bbfdm_stop_service "${OPTARG}";;
esac
done

View File

@@ -1,28 +0,0 @@
{
"daemon": {
"config": {
},
"input": {
"type": "DotSo",
"name": "/lib/libbbfdm.so",
"plugin_dir": "/etc/bbfdm/plugins"
},
"output": {
"type": "UBUS",
"name": "bbfdm"
}
},
"cli": {
"config": {
"proto": "both",
"instance_mode": 0
},
"input": {
"type": "UBUS",
"name": "bbfdm"
},
"output": {
"type": "CLI"
}
}
}

View File

@@ -1,8 +0,0 @@
config bbfdmd 'bbfdmd'
option enabled '1'
option loglevel '1'
option refresh_time '10'
option transaction_timeout '30'
option subprocess_level '2'

View File

@@ -1,3 +0,0 @@
config userinterface 'global'
option enable '1'

View File

@@ -1,74 +0,0 @@
#!/bin/sh
. /lib/functions.sh
log() {
echo "${@}"|logger -t firewall.dnat -p info
}
exec_cmd() {
if ! eval "$*"; then
log "Failed to run [$*]"
fi
}
reorder_dnat_rules() {
nat_chains=$(iptables -t nat -S | grep -E "^-N zone[a-zA-Z0-9_]+prerouting$" | cut -d' ' -f 2)
for chain in ${nat_chains}; do
# Collect empty remote host & empty dport rules
EMPTY_HOST_PORT=$(iptables -t nat -S ${chain} | grep -E "REDIRECT|DNAT" | grep -v "\-\-dport" | grep -v "\-s ")
if [ -n "${EMPTY_HOST_PORT}" ]; then
echo "${EMPTY_HOST_PORT}" | while read cmd; do
cmd1="iptables -t nat $(echo $cmd | sed 's/-A /-D /g')"
exec_cmd $cmd1
done
fi
# Collect empty remote host but non empty dport rules
EMPTY_HOST=$(iptables -t nat -S ${chain} | grep -E "REDIRECT|DNAT" | grep "\-\-dport" | grep -v "\-s ")
if [ -n "${EMPTY_HOST}" ]; then
echo "${EMPTY_HOST}" | while read cmd; do
cmd1="iptables -t nat $(echo $cmd | sed 's/-A /-D /g')"
exec_cmd $cmd1
done
fi
# Collect non empty remote host but empty dport rules
EMPTY_PORT=$(iptables -t nat -S ${chain} | grep -E "REDIRECT|DNAT" | grep -v "\-\-dport" | grep "\-s ")
if [ -n "${EMPTY_PORT}" ]; then
echo "${EMPTY_PORT}" | while read cmd; do
cmd1="iptables -t nat $(echo $cmd | sed 's/-A /-D /g')"
exec_cmd $cmd1
done
fi
# Now add rules as per datamodel precedence shown below
## Non empty remote host, empty dport
## empty remote host, non empty dport
## empty remote host, empty dport
if [ -n "${EMPTY_PORT}" ]; then
echo "${EMPTY_PORT}" | while read cmd; do
cmd1="iptables -t nat $(echo $cmd)"
exec_cmd $cmd1
done
fi
if [ -n "${EMPTY_HOST}" ]; then
echo "${EMPTY_HOST}" | while read cmd; do
cmd1="iptables -t nat $(echo $cmd)"
exec_cmd $cmd1
done
fi
if [ -n "${EMPTY_HOST_PORT}" ]; then
echo "${EMPTY_HOST_PORT}" | while read cmd; do
cmd1="iptables -t nat $(echo $cmd)"
exec_cmd $cmd1
done
fi
done
}
# Re-order portmapping rules according to precedence hierarchy
reorder_dnat_rules

View File

@@ -1,163 +0,0 @@
#!/bin/sh
. /lib/functions.sh
log() {
echo "${@}"|logger -t firewall.service -p info
}
exec_cmd() {
if ! eval "$*"; then
log "Failed to run [$*]"
echo "-1"
return 0
fi
echo "0"
return 0
}
add_iptable_rule() {
chain_name=$1
protocol=$2
dest_port=$3
icmp_type=$4
family=$5
src_prefix=$6
action=$7
res=-1
cmd="-I ${chain_name}"
if [ -n "${protocol}" ]; then
cmd="${cmd} -p $protocol"
if [ "${protocol}" -eq 41 ] || [ "${protocol}" -eq 43 ] || [ "${protocol}" -eq 44 ] ||
[ "${protocol}" -eq 58 ] || [ "${protocol}" -eq 59 ] || [ "${protocol}" -eq 60 ]; then
# Explicit v6 protocols
if [ "${family}" = "ipv4" ]; then
echo $res
return 0
else
family="ipv6"
fi
elif [ "${protocol}" -eq 1 ]; then
# Explicit v4 protocols
if [ "${family}" = "ipv6" ]; then
echo $res
return 0
else
family="ipv4"
fi
fi
# Limitation:: iptables do not accept dport without specific protocol
count=$(echo "${dest_port}" | sed -n "/-1/p" | wc -l)
if [ "${count}" -eq 0 ]; then
# dest_port not contains -1 so need to have this match criteria
count=$(echo "${dest_port}" | wc -w)
if [ "${count}" -gt 1 ]; then
# multiple ports present
port=$(echo "${dest_port}" | sed "s/ /,/g")
cmd="${cmd} -m multiport --dports ${port}"
else
cmd="${cmd} --dport ${dest_port}"
fi
fi
fi
if [ "${family}" = "ipv4" ] || [ "${family}" = "-1" ]; then
if [ "${protocol}" -eq 1 ] && [ "${icmp_type}" -ge 0 ]; then
cmd="${cmd} --icmp-type ${icmp_type}"
fi
if [ -z "${src_prefix}" ]; then
res=$(exec_cmd "iptables ${cmd} -m comment --comment IPtables_service_rule -j ${action}")
else
#Add ipv4 sources if any
src_list=""
for src in $src_prefix; do
ret=$(echo $src | grep ":" | wc -l)
if [ "${ret}" -eq 0 ]; then
src_list="$src,$src_list"
fi
done
if [ -n "$src_list" ]; then
src_list=$(echo "${src_list}" | sed "s/,$//")
res=$(exec_cmd "iptables -s $src_list ${cmd} -m comment --comment IPtables_service_rule -j ${action}")
fi
fi
fi
if [ "${family}" = "ipv6" ] || [ "${family}" = "-1" ]; then
if [ "${protocol}" -eq 58 ] && [ "${icmp_type}" -ge 0 ]; then
cmd="${cmd} --icmpv6-type ${icmp_type}"
fi
if [ -z "${src_prefix}" ]; then
res=$(exec_cmd "ip6tables ${cmd} -m comment --comment IP6tables_service_rule -j ${action}")
else
#Add ipv6 sources if any
src_list=""
for src in $src_prefix; do
ret=$(echo $src | grep ":" | wc -l)
if [ "${ret}" -eq 1 ]; then
src_list="$src,$src_list"
fi
done
if [ -n "$src_list" ]; then
src_list=$(echo "${src_list}" | sed "s/,$//")
res=$(exec_cmd "ip6tables -s $src_list ${cmd} -m comment --comment IP6tables_service_rule -j ${action}")
fi
fi
fi
echo $res
}
add_service() {
local enable proto family dest_port interface target icmp_type
config_get enable "$1" enable "0"
config_get icmp_type "$1" icmp_type "-1"
config_get target "$1" target "Accept"
config_get interface "$1" interface ""
config_get family "$1" family "-1"
config_get dest_port "$1" dest_port "-1"
config_get proto "$1" proto "-1"
config_get src_prefix "$1" src_prefix ""
if [ "${enable}" -eq 0 ] || [ -z "${interface}" ]; then
return 0
fi
action=$(echo "${target}" | tr a-z A-Z)
chain_name="zone_${interface}_input"
res=0
count=$(echo "${proto}" | sed -n "/-1/p" | wc -l)
if [ "${count}" -eq 0 ]; then
# proto not contains -1 so need to have this match criteria
for protocol in $proto; do
res=$(add_iptable_rule "$chain_name" "$protocol" "$dest_port" "$icmp_type" "$family" "$src_prefix" "$action")
done
else
# proto contains -1 so no need to have this match criteria
res=$(add_iptable_rule "$chain_name" "" "$dest_port" "$icmp_type" "$family" "$src_prefix" "$action")
fi
if [ "${res}" -ne 0 ]; then
uci -q set firewall."${1}".status="Error"
else
uci -q set firewall."${1}".status=""
fi
uci commit firewall
}
config_load firewall
config_foreach add_service "service"

View File

@@ -1,125 +0,0 @@
#!/bin/sh
. /lib/functions.sh
IDENTIFIER="UI-REMOTE-ACCESS-WAN"
log() {
echo "${@}"|logger -t firewall.userinterface -p info
}
if [ ! -f "/etc/config/userinterface" ] || [ ! -f "/etc/config/nginx" ]; then
exit 0;
fi
exec_cmd() {
if ! "$@"; then
log "Failed to run [$*]"
fi
}
delete_ui_firewall_rules() {
input_chains=$(iptables -S | grep -E "^-N zone[a-zA-Z0-9_]+input$" | cut -d' ' -f 2)
output_chains=$(iptables -S | grep -E "^-N zone[a-zA-Z0-9_]+output$" | cut -d' ' -f 2)
for chain in ${input_chains}; do
CMD="iptables -w 1 -t filter -nL ${chain} --line-numbers"
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
if [ -n "${rule_num}" ]; then
exec_cmd iptables -w 1 -t filter -D "${chain}" "${rule_num}";
fi
done
done
for chain in ${output_chains}; do
CMD="iptables -w 1 -t filter -nL ${chain} --line-numbers"
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
if [ -n "${rule_num}" ]; then
exec_cmd iptables -w 1 -t filter -D "${chain}" "${rule_num}";
fi
done
done
input6_chains=$(ip6tables -S | grep -E "^-N zone[a-zA-Z0-9_]+input$" | cut -d' ' -f 2)
output6_chains=$(ip6tables -S | grep -E "^-N zone[a-zA-Z0-9_]+output$" | cut -d' ' -f 2)
for chain in ${input6_chains}; do
CMD="ip6tables -w 1 -t filter -nL ${chain} --line-numbers"
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
if [ -n "${rule_num}" ]; then
exec_cmd ip6tables -w 1 -t filter -D "${chain}" "${rule_num}";
fi
done
done
for chain in ${output6_chains}; do
CMD="ip6tables -w 1 -t filter -nL ${chain} --line-numbers"
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
if [ -n "${rule_num}" ]; then
exec_cmd ip6tables -w 1 -t filter -D "${chain}" "${rule_num}";
fi
done
done
}
configure_ui_firewall_rule() {
local sec="${1}"
local enabled access interface
local port=""
config_get_bool enabled "${sec}" uci_enable '1'
config_get access "${sec}" uci_access ""
config_get interface "${sec}" uci_interface ""
if [ "${enabled}" -eq "1" ] && [ "${access}" == "remote" ] && [ -n "${interface}" ]; then
port_list=$(uci -q show nginx."${1}".listen|cut -d'=' -f 2|sed "s/'/ /g"|sed "s/\[\:\:\]\://g")
for item in ${port_list}; do
if [ -z "${item##[0-9]*}" ]; then
port="${item}"
break
fi
done
if [ -z "${port}" ]; then
return 0
fi
zone="zone_${interface}_input"
iptables -w 1 -t filter -nL ${zone} 2>/dev/null 1>&2
if [ "$?" -eq 0 ]; then
iptables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
fi
ip6tables -w 1 -t filter -nL ${zone} 2>/dev/null 1>&2
if [ "$?" -eq 0 ]; then
ip6tables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
fi
zone="zone_${interface}_output"
iptables -w 1 -t filter -nL "${zone}" 2>/dev/null 1>&2
if [ "$?" -eq 0 ]; then
iptables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
fi
ip6tables -w 1 -t filter -nL "${zone}" 2>/dev/null 1>&2
if [ "$?" -eq 0 ]; then
ip6tables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
fi
fi
}
# Delete existing remote access rules
delete_ui_firewall_rules
config_load userinterface
config_get_bool serv_enable global enable 1
if [ "${serv_enable}" -eq "1" ]; then
config_load nginx
# Configure the User Interface rule
config_foreach configure_ui_firewall_rule server
fi

View File

@@ -1,17 +0,0 @@
#!/bin/sh
[ "$ACTION" = "ifup" ] || exit 0
apply_sysctl_configuration() {
local sysctl_conf
sysctl_conf="/etc/bbfdm/sysctl.conf"
[ -f "${sysctl_conf}" ] || touch "${sysctl_conf}"
sysctl -e -p "${sysctl_conf}" >&-
}
ubus -t 10 wait_for network.device
apply_sysctl_configuration

View File

@@ -1,76 +0,0 @@
#!/bin/sh /etc/rc.common
START=65
STOP=10
USE_PROCD=1
PROG=/usr/sbin/bbfdmd
BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
BBFDM_TEMP_JSON="/tmp/bbfdm/input.json"
log() {
echo "${@}"|logger -t bbfdmd.init -p info
}
validate_bbfdm_bbfdmd_section()
{
uci_validate_section bbfdm bbfdmd "bbfdmd" \
'enabled:bool:true' \
'sock:string' \
'debug:bool:false' \
'loglevel:uinteger:1' \
'refresh_time:uinteger:0' \
'transaction_timeout:uinteger:30' \
'subprocess_level:uinteger'
}
configure_bbfdmd()
{
local enabled debug sock update
local jlog jrefresh jtimeout jlevel
update=0
config_load bbfdm
validate_bbfdm_bbfdmd_section || {
log "Validation of bbfdmd section failed"
return 1;
}
[ "${enabled}" -eq 0 ] && return 0
if [ -f "${BBFDM_JSON_INPUT}" ]; then
echo "$(jq --arg log ${loglevel} --arg tran ${transaction_timeout} --arg refresh ${refresh_time} --arg level ${subprocess_level} '.daemon.config += {"loglevel": $log, "refresh_time": $refresh, "transaction_timeout": $tran, "subprocess_level": $level}' ${BBFDM_JSON_INPUT})" > ${BBFDM_TEMP_JSON}
fi
procd_set_param command ${PROG}
if [ "${debug}" -eq 1 ]; then
procd_set_param stdout 1
procd_set_param stderr 1
fi
if [ -f "${sock}" ]; then
procd_append_param command -s "${sock}"
fi
}
start_service()
{
mkdir -p /tmp/bbfdm
procd_open_instance "bbfdm"
configure_bbfdmd
procd_set_param respawn
procd_close_instance "bbfdm"
ubus call service state '{"name":"bbfdm.services", "spawn":true}'
}
stop_service()
{
ubus call service state '{"name":"bbfdm.services", "spawn":false}'
}
service_triggers()
{
procd_add_reload_trigger "bbfdm"
}

View File

@@ -1,33 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=01
USE_PROCD=1
start_service() {
local enable
config_load userinterface
config_get_bool enable global enable 1
if [ ! -f "/etc/config/nginx" ]; then
return 0
fi
if [ "${enable}" -eq "1" ]; then
ubus call service state '{"name":"nginx", "spawn":true}'
else
ubus call service state '{"name":"nginx", "spawn":false}'
fi
# Inject firewall rules
procd_open_instance userinterface
/etc/firewall.userinterface
procd_close_instance
}
service_triggers()
{
procd_add_reload_trigger "userinterface" "nginx"
}

View File

@@ -1,12 +0,0 @@
#!/bin/sh
uci -q batch <<-EOT
delete firewall.userinterface
set firewall.userinterface=include
set firewall.userinterface.path=/etc/firewall.userinterface
set firewall.userinterface.reload=1
commit firewall
EOT
exit 0

View File

@@ -1,9 +0,0 @@
#!/bin/sh
# This deletes the userinterface json plugin if exists in case of upgrade
if [ -f "/etc/bbfdm/json/UserInterface.json" ]; then
rm /etc/bbfdm/json/UserInterface.json
fi
exit 0

View File

@@ -1,12 +0,0 @@
#!/bin/sh
uci -q batch <<-EOT
delete firewall.port_hook
set firewall.port_hook=include
set firewall.port_hook.path=/etc/firewall.portmap
set firewall.port_hook.reload=1
commit firewall
EOT
exit 0

View File

@@ -1,62 +0,0 @@
#!/bin/sh
. /lib/functions.sh
bbfdm_sysctl_conf="/etc/bbfdm/sysctl.conf"
update_device_section() {
local section="${1}"
local dev_name="${2}"
local ipv6="${3}"
local name
# Get name value
config_get name "${section}" name
# Retrun if the name value is different to the dev_name value
[ "${name}" != "${dev_name}" ] && return
if [ "${ipv6}" = "0" ]; then
ipv6="1"
else
ipv6="0"
fi
# Add ipv6 option
uci -q set network.${section}.ipv6="${ipv6}"
}
parse_bbfdm_sysctl_conf_file() {
# Check if the file exists
[ -f "${bbfdm_sysctl_conf}" ] || return
# Create a temporary file
tmpfile=$(mktemp)
# Load network config
config_load network
# Read each line of the file
while read -r line; do
if echo "$line" | grep -Eq '^net\.ipv6\.conf\.(.+)\.disable_ipv6=([0-1])$'; then
name=$(echo "$line" | sed -n 's/^net\.ipv6\.conf\.\(.*\)\.disable_ipv6=[0-1]$/\1/p')
value=$(echo "$line" | sed -n 's/^net\.ipv6\.conf\.\(.*\)\.disable_ipv6=\([0-1]\)$/\2/p')
config_foreach update_device_section device "${name}" "${value}"
else
# If the line doesn't match, preserve it in the temporary file
echo "$line" >> "$tmpfile"
fi
done < "${bbfdm_sysctl_conf}"
# Replace the original file with the modified content
mv "$tmpfile" "${bbfdm_sysctl_conf}"
# Apply the changes
uci commit network
sysctl -e -p "${bbfdm_sysctl_conf}" >&-
}
parse_bbfdm_sysctl_conf_file
exit 0

View File

@@ -1,12 +0,0 @@
#!/bin/sh
uci -q batch <<-EOT
delete firewall.service_hook
set firewall.service_hook=include
set firewall.service_hook.path=/etc/firewall.service
set firewall.service_hook.reload=1
commit firewall
EOT
exit 0

View File

@@ -1,18 +0,0 @@
#!/bin/sh
UNIFIED_PATH="/etc/bbfdm/plugins/"
# Link JSON plugins
for f in `ls -1 /etc/bbfdm/json/*.json`; do
echo "# BBFDM JSON plugin ${f} not aligned #"
ln -s ${f} "${UNIFIED_PATH}"
done
# Link DotSo plugins
for f in `ls -1 /usr/lib/bbfdm/*.so`; do
echo "# BBFDM DotSO plugin ${f} not aligned #"
ln -s ${f} "${UNIFIED_PATH}"
done
exit 0

View File

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

View File

@@ -1 +0,0 @@
/etc/nginx/allow_host_*

View File

@@ -1,42 +0,0 @@
#
# Copright (C) 2018 The Internet Foundation In Sweden
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bbk_cli
PKG_SOURCE_VERSION:=7b810a696c78b746185c11282bdbe3fb7f8c5d4b
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/dotse/bbk.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/bbk_cli
CATEGORY:=Utilities
DEPENDS:=+libpthread +libstdcpp
TITLE:=Bredbandskollen CLI - A bandwidth measurement tool
endef
define Package/bbk_cli/description
To measure connection speed in an environment that is missing a web browser,
for example, in a server, you can use our command line interface bbk_cli,
which is available for some of the most common operating systems.
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR)/src/cli CROSS_COMPILE="$(TARGET_CROSS)"
endef
define Package/bbk_cli/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cli/cli $(1)/sbin/bbk_cli
endef
$(eval $(call BuildPackage,bbk_cli))

View File

@@ -1,25 +0,0 @@
diff --git a/src/framework/engine.h b/src/framework/engine.h
index 57a48ad..9e1bc36 100644
--- a/src/framework/engine.h
+++ b/src/framework/engine.h
@@ -10,6 +10,7 @@
#include <map>
#include <vector>
#include <string>
+#include <sys/select.h>
#include "logger.h"
diff --git a/src/framework/mk.inc b/src/framework/mk.inc
index 793e211..13275be 100644
--- a/src/framework/mk.inc
+++ b/src/framework/mk.inc
@@ -7,7 +7,7 @@ OS:=$(shell uname)
CXXFLAGS += -O2 -W -Wall -I$(DIRLEVEL)
ifeq ($(OS),Linux)
-CXX = g++
+CXX = $(CROSS_COMPILE)g++
endif
ifeq ($(OS),Darwin)

View File

@@ -18,9 +18,6 @@ PKG_SOURCE_VERSION:=3ab81137cafe25c2ca4bc3a5f322a63646f9ce8d
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=none
include $(INCLUDE_DIR)/package.mk
define Package/bootchart2

47
brcmslic/Makefile Normal file
View File

@@ -0,0 +1,47 @@
#
# 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.1
PKG_SOURCE_URL:=git@private.inteno.se:brcmslic
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=837ec19e37650e424e77c921672a0806e198ba7b
PKG_NAME:=brcmslic
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
include $(INCLUDE_DIR)/package.mk
define Package/brcmslic
CATEGORY:=Utilities
TITLE:=Brcmslic
URL:=
DEPENDS:=
endef
define Package/brcmslic/description
Brcmslic
endef
define Package/brcmslic/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/brcmslic $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/endpt $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,brcmslic))

View File

@@ -0,0 +1,4 @@
config dect 'dect'
option radio 'auto'

View File

@@ -1,52 +0,0 @@
#
# Copyright (C) 2022 iopsys Software Solutions AB
#
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bulkdata
PKG_VERSION:=2.1.3
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bulkdata.git
PKG_SOURCE_VERSION:=f556410b51a2248f11358793f11ae54d3e53e85e
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=BBF BulkData Collection
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json +zlib
endef
TARGET_CFLAGS += \
-D_GNU_SOURCE \
-Wall -Werror
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) -rf ~/git/bulkdata/* $(PKG_BUILD_DIR)/
endef
endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/bulkdata
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbf_plugin/*.json $(1)/etc/bulkdata
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@@ -1,15 +0,0 @@
{
"daemon": {
"input": {
"type": "JSON",
"name": "/etc/bulkdata/bulkdata.json"
},
"output": {
"type": "UBUS",
"name": "bbfdm.bulkdata",
"parent_dm": "Device.",
"object": "BulkData",
"root_obj": "bbfdm"
}
}
}

View File

@@ -1,6 +0,0 @@
config bulkdata 'bulkdata'
option enable '0'
#Log levels: Error=1, Warning=2, Info=3, Debug=4
option log_level '3'

View File

@@ -1,36 +0,0 @@
#!/bin/sh /etc/rc.common
START=60
STOP=10
. /etc/bbfdm/bbfdm_services.sh
USE_PROCD=1
PROG="/usr/sbin/bulkdatad"
BULKDATA_JSON_INPUT="/etc/bulkdata/input.json"
start_service() {
local enable
config_load bulkdata
config_get_bool enable bulkdata enable 1
[ "$enable" -eq "1" ] && {
procd_open_instance "bulkdata"
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance "bulkdata"
}
bbfdm_add_service "bbfdm.bulkdata" "${BULKDATA_JSON_INPUT}"
}
reload_service() {
stop
start
}
service_triggers()
{
procd_add_reload_trigger bulkdata
}

View File

@@ -1,75 +0,0 @@
#!/bin/sh
. /lib/functions.sh
PROFILE_COUNT=1
get_next_count()
{
local config="$1"
local default_name="${2}"
local count=${3}
local found=0
if [ -z "$count" ]; then
count=1
fi
while [ "${found}" -ne 1 ]; do
uci -q get "${config}"."${default_name}"_${count} >/dev/null
if [ "$?" -eq 0 ]; then
count=$((count + 1))
else
found=1;
fi
done
echo "${default_name}_${count}"
}
translate_profile_id_to_profile_name() {
local section="${1}"
local profile_id="${2}"
local profile_name="${3}"
local curr_profile_id
config_get curr_profile_id "${section}" profile_id
[ -n "${curr_profile_id}" ] || return
[ "${curr_profile_id}" != "${profile_id}" ] && return
uci -q set bulkdata."${section}".profile_name="${profile_name}"
uci -q set bulkdata."${section}".profile_id=""
}
update_profile_sections() {
local section="${1}"
local default="${2}"
local profile_name
config_get profile_id "${section}" profile_id
[ -n "${profile_id}" ] || return
case "${section}" in
"cfg"*)
profile_name="$(get_next_count bulkdata "${default}" ${PROFILE_COUNT})"
uci_rename bulkdata "${section}" "${profile_name}"
;;
esac
PROFILE_COUNT=$((PROFILE_COUNT + 1))
[ -n "$profile_name" ] && section="${profile_name}"
uci -q set bulkdata."${section}".profile_id=""
config_foreach translate_profile_id_to_profile_name profile_parameter "${profile_id}" "${profile_name}"
config_foreach translate_profile_id_to_profile_name profile_http_request_uri_parameter "${profile_id}" "${profile_name}"
}
config_load bulkdata
config_foreach update_profile_sections profile profile
uci commit bulkdata
exit 0

View File

@@ -1,38 +0,0 @@
#
# Copyright (C) 2019 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bulut
PKG_VERSION:=0.2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bulut/bulut-gw-client.git
PKG_SOURCE_VERSION:=227700c44817afa2c392fa08bf4cf70fa6177f01
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/bulut
CATEGORY:=Utilities
DEPENDS:=
TITLE:=bulut
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include
define Package/bulut/description
obuspa keys
endef
define Package/bulut/install
$(CP) $(PKG_BUILD_DIR)/files/* $(1)/
endef
$(eval $(call BuildPackage,bulut))

View File

@@ -1,57 +0,0 @@
#
# Copyright (C) 2021-2023 IOPSYS
#
include $(TOPDIR)/rules.mk
PKG_NAME:=capiagent
PKG_VERSION:=2.1.0
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=3e671db8f567b19c109fc13b25bc571c4c73a962
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/capiagent.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_LICENSE:=PROPRIETARY IOPSYS
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
#define Package/capiagent/config
# source "$(SOURCE)/Config.in"
#endef
define Package/capiagent
TITLE+= capiagent (daemon implementing Wi-Fi Alliance's CAPI commands)
DEPENDS= +libubox +libuci +libubus +libnl-genl +libeasy +libwifi \
+libjson-c +libblobmsg-json +ubus +libieee1905
endef
define Package/capiagent/description
This package provides agent for the WiFi Alliance's CAPI specification.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-D_GNU_SOURCE
MAKE_PATH:=src
define Package/capiagent/install
$(CP) ./files/* $(1)/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/lib/wifi/capi
$(CP) $(PKG_BUILD_DIR)/src/capiagent $(1)/usr/sbin
$(CP) $(PKG_BUILD_DIR)/src/scripts/* $(1)/lib/wifi/capi
endef
$(eval $(call BuildPackage,capiagent))

View File

@@ -1,35 +0,0 @@
#!/bin/sh /etc/rc.common
START=98
STOP=20
USE_PROCD=1
start_service() {
if [ -e "/etc/config/mapagent" -o -e "/etc/config/mapcontroller" ]; then
config_load mapagent
config_get_bool agent_enabled agent enabled 1
config_load mapcontroller
config_get_bool controller_enabled controller enabled 1
if [ $agent_enabled -eq 1 -o $controller_enabled -eq 1 ]; then
procd_open_instance
procd_set_param command "/usr/sbin/capiagent" "-p 9000"
procd_set_param limits core="unlimited"
#procd_set_param respawn
#procd_set_param stdout 1
#procd_set_param stderr 1
procd_close_instance
fi
fi
}
service_triggers()
{
procd_add_reload_trigger "capiagent"
}
reload_service() {
stop
start
}

View File

@@ -1,19 +1,9 @@
#
# Copyright (C) 2018 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=catv
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=none
include $(INCLUDE_DIR)/package.mk
define Package/catv

Binary file not shown.

View File

@@ -1,4 +1,7 @@
#!/bin/sh /etc/rc.common
#
# Copyright (C) 2015 inteno.org
#
START=71
USE_PROCD=1

31
crashlog/Makefile Normal file
View File

@@ -0,0 +1,31 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=crashlog
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/crashlog
CATEGORY:=Utilities
TITLE:=Handling kernel crash logs
endef
define Package/crashlog/description
Handling kernel crash logs.
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./files/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
endef
define Package/crashlog/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,crashlog))

Binary file not shown.

View File

@@ -0,0 +1,11 @@
#!/bin/sh /etc/rc.common
START=01
start()
{
if [ -e /proc/sys/kernel/core_pattern ]
then
echo "|/sbin/logcore %e %s" > /proc/sys/kernel/core_pattern
fi
}

View File

@@ -0,0 +1,56 @@
#!/bin/sh /etc/rc.common
START=99
send_log()
{
nr=$(db get hw.board.serialNumber)
hw=$(db get hw.board.hardware)
hwv=$(db get hw.board.hardwareVersion)
bid=$(db get hw.board.boardId)
sw=$(db get hw.board.iopVersion)
server=$(/sbin/uci get system.crashlog.server)
while true
do
scp -S /usr/sbin/logssh /proc/last_kmsg log@${server}:log/${bid}_${hwv}_${hw}_${sw}_${nr}
if [ $? == 0 ]
then
break;
fi
# wait for another minute then try again
sleep 60
done
}
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=crashlog
/sbin/uci set system.crashlog.enable=no
/sbin/uci set system.crashlog.server="crash.inteno.se"
/sbin/uci commit
}
boot()
{
# is crashlog enabled ?
enable=$(/sbin/uci get system.crashlog.enable)
case $enable in
0|no|NO|false|FALSE)
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
# is this boot a result from a crash ?
reason=$(cat /etc/boot_reason)
case $reason in
HW|WD)
send_log&
;;
esac
}

61
crashlog/files/sbin/logcore Executable file
View File

@@ -0,0 +1,61 @@
#! /bin/sh
TMP_CORE=/tmp/new_core
# first test if we can contact the log server.
# if not abort directly the core file takes up memory
alive()
{
ping -c1 $server
if [ $? != 0 ]
then
# drain core file from kernel
cat >/dev/null
exit 0
fi
}
fill_in_default()
{
/sbin/uci add system log
/sbin/uci rename system.@log[-1]=corelog
/sbin/uci set system.corelog.enable=no
/sbin/uci set system.corelog.server="crash.inteno.se"
/sbin/uci commit
}
# is corelog enabled ?
enable=$(/sbin/uci get system.corelog.enable)
case $enable in
0|no|NO|false|FALSE)
# drain core file from kernel
cat >/dev/null
exit 0
;;
"")
fill_in_default
exit 0
;;
esac
server=$(/sbin/uci get system.corelog.server)
alive
# dump out the core to disk we need this as scp needs a size before we send data
# and this is the only way to know how much data there is
cat >$TMP_CORE
# in case filesystem/memory is full at least kill the core in the kernel memory should give us some
# more memory to work with. normally this would do nothing.
cat >/dev/null
nr=$(db get hw.board.serialNumber)
hw=$(db get hw.board.hardware)
hwv=$(db get hw.board.hardwareVersion)
bid=$(db get hw.board.boardId)
sw=$(db get hw.board.iopVersion)
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${bid}_${hwv}_${hw}_${sw}_${nr}
rm $TMP_CORE

6
crashlog/files/usr/sbin/logssh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
# we need to have the -y option to dropbear to not halt the scp when
# transfering the log file to a new server for the first time.
# since we already need this also put in the keyfile
ssh -y -i /etc/dropbear/logid $@

42
crashlog/readme Normal file
View File

@@ -0,0 +1,42 @@
Install scp server.
Create a user account on a server and make sure it's possible to login to it
using ssh.
For now the user has to be called "log"
USER is the user name of the account
HOME is the user home directory.
Both should be changed to the correct value in all following example commands.
create HOME/bin
Put scp_upload in HOME/bin
make it executable "chmod a+x HOME/bin/scp_upload"
create home/.ssh (observer the dot .shh)
create an empty file HOME/.ssh/authorized_keys
-------------------------------
Now everyhting is setup for use but we have not added any clients.
What we need is the public key for the clients.
For dropbear "dropbearkey -y -f files/etc/dropbear/logid" will generate the public key.
----------
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwn9RaDAzxW1dTmIhXgFBnpi1lhj8xhYpCVQiPxxdk9IEmH8zjo4y9j3sPkqKOlRnkwjpZIpLEKBnpQTwVIMCU/AG7nDJX3OH9RfS9mLJQLfFL8HyGCyqDezFWldbyovhJZvdUeK4tAXJWv2W3OVHiz2L8IlncBgP/E9DJElsyhhQHsM96UE6tBkXsvXkoDbMSYXFcLbgiUwBKfmM2BF/aPDL45iznGur7/2j9v95PwJ0gtMu9jjNRq+pXCXhTh3bsnczm0MpZC1aiRc9nJAeGIMmhrf15E4jBKgTnrstzJxGVAdajKeR954KcNsS33cS2Wmui2YjmPbBXjqf1frzJ log@inteno
----------
The public key should be just one line. Add that line to the
HOME/.ssh/authorized_keys file on the scp server. Then add the follwoing as
the first text on the same line. that is insert before the key data.
command="HOME/bin/scp_upload",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
Do not forget to change HOME to the correct value for the server and there
should be one space separating the key data and the above text.
---------------------------------
Now test to make sure that you can upload new files, not download files
and not overwrite files from the client.

53
crashlog/scp_upload Normal file
View File

@@ -0,0 +1,53 @@
#! /bin/bash
# authorized_keys command="/home/boxi/my_scp",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
val=`expr match "$SSH_ORIGINAL_COMMAND" "scp"`
if [ $val != 3 ]
then
echo "only scp is allowed for this rsa key"
exit 1
fi
#strip out "scp" as getopts barf on anything not an option
args=${SSH_ORIGINAL_COMMAND:3}
# we must set args to positional paramters otherwise it's next to impossible
# to get to the rest of the line that is not arguments.
set -- $args
while getopts "rftdvpq" Option
do
case $Option in
r ) echo "recursive not allowed";exit 1;;
f ) echo "reading files not allowed";exit 1;;
t ) ;;
d ) ;;
v ) ;;
p ) ;;
q ) ;;
* ) ;; # Default.
esac
done
shift $(($OPTIND - 1))
file="$*"
dir=$(dirname "$file")
if [ "$dir" != "log" ]
then
echo "only allowed to write to log/"
exit 1
fi
# try to create uniq files
EXTRA=$((0))
while [ -e "${file}_${EXTRA}" ]
do
EXTRA=$((EXTRA +1))
done
logger -t scp_upload "${SSH_ORIGINAL_COMMAND}_${EXTRA}"
exec ${SSH_ORIGINAL_COMMAND}_${EXTRA}

View File

@@ -1,7 +0,0 @@
menu "Configuration"
config DECOLLECTOR_EASYMESH_VERSION
int "Support Easymesh version"
default 4
endmenu

View File

@@ -1,80 +0,0 @@
#
# Copyright (C) 2021-2023 IOPSYS Software Solutions AB
#
include $(TOPDIR)/rules.mk
PKG_NAME:=decollector
PKG_VERSION:=4.2.1.1
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=ae836adb0779979686d0dad34b941f319ffed1b8
PKG_SOURCE_URL:=https://dev.iopsys.eu/multi-ap/decollector.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/decollector
SECTION:=utils
CATEGORY:=Utilities
TITLE:=WiFi DataElements Collector Proxy
DEPENDS:=+libuci +libubox +ubus +libpthread +libnl-genl \
+libeasy +libwifiutils +libieee1905 +map-plugin
endef
define Package/decollector/description
It implements the WiFi DataElements Agent as defined in the Wi-Fi Alliance's
DataElements specification.
endef
define Package/decollector/config
source "$(SOURCE)/Config.in"
endef
ifneq (,$(findstring ALPHA,$(CONFIG_VERSION_CODE)))
MAKE_FLAGS += DEBUG=1
endif
ifneq (,$(findstring BETA,$(CONFIG_VERSION_CODE)))
MAKE_FLAGS += DEBUG=1
endif
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-D_GNU_SOURCE
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -r --exclude=.* ~/git/decollector/ $(PKG_BUILD_DIR)/
endef
endif
MAKE_PATH:=src
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_DECOLLECTOR_EASYMESH_VERSION)
EXECS := \
$(if $(CONFIG_PACKAGE_decollector),decollector)
MAKE_FLAGS += EXECS="$(EXECS)"
define Package/decollector/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/decollector.init $(1)/etc/init.d/decollector
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/decollector $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,decollector))

View File

@@ -1,30 +0,0 @@
#!/bin/sh /etc/rc.common
START=98
STOP=11
USE_PROCD=1
PROG=/usr/sbin/deagent
service_running() {
ubus -t 2 wait_for wifi ieee1905 ieee1905.map
}
start_service() {
procd_open_instance
procd_set_param command "$PROG" "-d" "-t 10"
#procd_set_param stdout 1
#procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}
reload_service() {
stop
start
}
service_triggers()
{
procd_add_reload_trigger wireless
}

View File

@@ -1,43 +0,0 @@
#!/bin/sh /etc/rc.common
START=98
STOP=11
USE_PROCD=1
PROG=/usr/sbin/decollector
service_running() {
ubus -t 2 wait_for ieee1905 ieee1905.map
}
start_service() {
sleep 3
[ -e "/etc/config/mapcontroller" ] && {
local en
config_load mapcontroller
config_get en controller enabled "0"
config_get collect_int controller de_collect_interval
[ -n "$collect_int" -a $collect_int -lt 30 ] && collect_int=""
[ $en -gt 0 ] && {
procd_open_instance
procd_set_param command "$PROG" "-d" "${collect_int:+-t $collect_int}"
#procd_set_param stdout 1
#procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}
}
}
reload_service() {
stop
start
}
service_triggers()
{
procd_add_reload_trigger mapcontroller
}

View File

@@ -1,11 +0,0 @@
if PACKAGE_dectmngr
menu "Configuration"
config ENABLE_LINE_SETTINGS_EXTENSION
bool "Enable Line Settings List extension "
default y
endmenu
endif

View File

@@ -1,19 +1,23 @@
#
# 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_NAME:=dectmngr
PKG_RELEASE:=3
PKG_VERSION:=3.6.4
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
PKG_RELEASE:=1
PKG_VERSION:=1.0.23
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=d9cc11c81ce1ff625e4e789afa180b301c7fcf74
PKG_MIRROR_HASH:=skip
endif
PKG_SOURCE_VERSION:=90aff0da98c626d58201c14c34b3b3a64878ceee
PKG_NAME:=dectmngr
PKG_LICENSE:=PROPRIETARY
PKG_LICENSE_FILES:=LICENSE
LDFLAGS+= \
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
-Wl,-rpath-link=$(STAGING_DIR)/lib
RSTRIP:=true
export BUILD_DIR
@@ -21,48 +25,42 @@ export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=DECT Manager
DEPENDS:= +libubox +ubus +uci +libxml2 +libjson-c +gpiod-tools
define Package/dectmngr
CATEGORY:=Utilities
TITLE:=Broadcom endpoint test application
URL:=
DEPENDS:= +libevent2 +libjson +natalie-dect-h bcmkernel
endef
define Package/$(PKG_NAME)/description
DECT manager is a daemon that provides UBUS RPC objects and sends UBUS events for communication with the DECT chip.
define Package/dectmngr/description
Dect proxy, manager and tools
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
define Package/dectmngr/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_DIR) $(1)/etc/hotplug.d/
$(INSTALL_DIR) $(1)/etc/hotplug.d/dect
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_DIR) $(1)/etc/dect/
$(INSTALL_DIR) $(1)/etc/config/
cp $(PKG_BUILD_DIR)/dectmngr $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/atohx $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/dectproxy $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/dectdbgd $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/dect $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/dectcalib $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/dect_testmode $(1)/usr/bin/
cp files/etc/init.d/* $(1)/etc/init.d/
cp files/etc/hotplug.d/dect/* $(1)/etc/hotplug.d/dect/
cp files/etc/dect/* $(1)/etc/dect/
cp files/etc/config/* $(1)/etc/config/
cp files/sbin/dectreg $(1)/sbin/
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -av --exclude=.* ~/git/voip/dectmngr/* $(PKG_BUILD_DIR)/
endef
endif
TARGET_CFLAGS += \
-Wall \
-Werror \
-I$(STAGING_DIR)/usr/include/libxml2
ifeq ($(CONFIG_ENABLE_LINE_SETTINGS_EXTENSION),y)
TARGET_CFLAGS += -DENABLE_LINE_SETTINGS_EXTENSION
endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app/dectmngr $(1)/usr/sbin/
$(STRIP) $(1)/usr/sbin/dectmngr
$(CP) ./files/etc/* $(1)/etc/
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/dect $(1)/lib/upgrade/keep.d/dect
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackage,dectmngr))

6
dectmngr/files/etc/config/dect Normal file → Executable file
View File

@@ -1,3 +1,3 @@
config dect 'global'
option log_dect_cmbs 'syslog'
option log_level 'realtime,warning,error'
config dect 'dect'
option 'radio' 'auto'

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,15 @@
#!/bin/sh
if [ "$ACTION" == "led_blink" ]; then
ubus call led.dect set '{"state":"notice"}'
fi
if [ "$ACTION" == "led_on" ]; then
ubus call led.dect set '{"state":"ok"}'
fi
if [ "$ACTION" == "led_off" ]; then
ubus call led.dect set '{"state":"off"}'
fi

60
dectmngr/files/etc/init.d/dect Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh /etc/rc.common
START=97
STOP=10
USE_PROCD=1
DEST=
DEFAULT=
OPTIONS=""
start_service() {
# avoid fp timing problem
echo 1 > /proc/sys/kernel/printk_with_interrupt_enabled
# setup board specific dect parameters
cat /proc/nvram/rfpi | tr -d ' ' | atohx > /tmp/rfpi
cat /proc/nvram/fixed_emc | tr -d ' ' | atohx > /tmp/fixed_emc
cat /proc/nvram/bcm_def_freq | tr -d ' ' | atohx > /tmp/bcm_def_freq
DECTANTDIV=`db get hw.board.DectAntennaDiversity`
case "$DECTANTDIV" in
1|off) echo -ne "\x01" > /tmp/dect_antenna_diversity ;;
2) echo -ne "\x02" > /tmp/dect_antenna_diversity ;;
*) echo -ne "\x00" > /tmp/dect_antenna_diversity ;;
esac
if [ ! -f /etc/dect/nvs ]; then
cp /etc/dect/nvs_default /etc/dect/nvs
dd of=/etc/dect/nvs if=/tmp/rfpi conv=notrunc bs=1 seek=0
dd of=/etc/dect/nvs if=/tmp/fixed_emc conv=notrunc bs=1 seek=10
dd of=/etc/dect/nvs if=/tmp/bcm_def_freq conv=notrunc bs=1 seek=6
dd of=/etc/dect/nvs if=/tmp/dect_antenna_diversity conv=notrunc bs=1 seek=32
fsync /etc/dect/nvs
fi
# init dectproxy
dectproxy > /dev/null 2>&1 &
dectmngr > /tmp/dectmngr 2>&1 &
}
stop_service() {
killall -9 dectproxy
killall -9 dectmngr
}
restart_service() {
echo "restarting dect"
killall dectmngr
dectmngr > /tmp/dectmngr 2>&1 &
}
reload_service() {
# reload config
dect -c
}
service_triggers() {
procd_add_reload_trigger dect
}

View File

@@ -1,137 +0,0 @@
#!/bin/sh /etc/rc.common
source /lib/functions/uci-defaults.sh
START=70
STOP=12
USE_PROCD=1
PROG=/usr/sbin/dectmngr
LOG_PATH=/var/log/dectmngr
DB_PATH=/etc/dect
DCX81_UART_DT_ALIAS=/proc/device-tree/aliases/dcx81-uart
DECT_GPIO="$(gpiofind DCX81_RSTN | cut -d ' ' -f 2 2>/dev/null)"
# Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process.
stop_and_wait_dectmngr() {
dect_pid=$(pidof $PROG)
[ -n "$dect_pid" ] && kill $dect_pid
pidof $PROG > /dev/null 2>&1 && sleep 2 # wait for the process to stop gracefully
while pidof $PROG > /dev/null 2>&1; do
dect_pid=$(pidof $PROG)
[ -n "$dect_pid" ] && kill -9 $dect_pid
sleep 1
done
}
has_dect() {
[ -f "$DCX81_UART_DT_ALIAS" ]
}
get_dcx81_device() {
readonly dcx81_uart_dt_node="/proc/device-tree/$(cat "$DCX81_UART_DT_ALIAS" 2>/dev/null)"
[ -e "$dcx81_uart_dt_node" ] || return 1
for tty_dt_node in /sys/class/tty/*/device/of_node; do
if [ "$tty_dt_node" -ef "$dcx81_uart_dt_node" ]; then
readonly uevent_file="${tty_dt_node%%/device/of_node}/uevent"
local device_name_line
device_name_line="$(grep '^DEVNAME=' "$uevent_file")" || return 1
readonly device="/dev/${device_name_line##DEVNAME=}"
[ -c "$device" ] || return 1
printf "%s" "$device"
return 0
fi
done
return 1
}
start_service() {
local opt_ext=
local rfpi=
local model_id=
local rxtun=
if ! has_dect; then
logger -t "$PROG" "Not starting because no DECT hardware is available."
return 0
fi
local dcx81_uart_device
if ! dcx81_uart_device="$(get_dcx81_device)"; then
logger -t "$PROG" -p daemon.warning "Could not determine DCX81 UART device. Falling back to default ttyH0."
dcx81_uart_device=/dev/ttyH0
fi
[ -n "$DECT_GPIO" ] && echo 1 > /sys/class/gpio/gpio${DECT_GPIO}/value
rfpi=$(db -q get hw.board.dect_rfpi)
[ -n "$rfpi" -a ${#rfpi} -eq 14 ] && opt_ext="$opt_ext -rfpi $rfpi"
model_id=$(db -q get hw.board.dect_model_id)
[ -n "$model_id" -a ${#model_id} -eq 8 ] || {
echo "Invalid hw.board.dect_model_id:$model_id. Set to 30.3B.06"
model_id="30.3B.06"
}
opt_ext="$opt_ext -model $model_id"
rxtun=$(db -q get hw.board.dect_rxtun)
[ -n "$rxtun" -a ${#rxtun} -eq 2 ] && opt_ext="$opt_ext -rxtun $rxtun"
config_load dect
config_get log_dect_cmbs global log_dect_cmbs syslog
procd_open_instance
# dectmngr takes expects device without /dev
readonly dcx81_uart_device_wo_dev="${dcx81_uart_device##/dev/}"
case "$log_dect_cmbs" in
none)
echo "Starting dectmngr with cmbs logging disabled"
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" $opt_ext
rm -f $LOG_PATH/*
;;
file)
echo "Starting dectmngr with cmbs logging enabled to file"
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" -log $LOG_PATH/dect-cmbs.log $opt_ext
;;
*)
echo "Starting dectmngr with cmbs logging enabled to syslog"
procd_set_param command "$PROG" -comname "$dcx81_uart_device_wo_dev" -syslog $opt_ext
rm -f $LOG_PATH/*
;;
esac
procd_set_param respawn 6 2 3
procd_set_param term_timeout 20
procd_set_param triggers asterisk
procd_close_instance
}
stop_service() {
has_dect || return 0
[ -n "$DECT_GPIO" ] && echo 0 > /sys/class/gpio/gpio${DECT_GPIO}/value
stop_and_wait_dectmngr
}
reload_service() {
ubus call dect reload
}
service_triggers() {
procd_add_config_trigger "config.change" "asterisk" /etc/init.d/dectmngr restart
procd_add_config_trigger "config.change" "dect" /etc/init.d/dectmngr reload
}
boot() {
[ -n "$DECT_GPIO" ] && {
echo ${DECT_GPIO} > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio${DECT_GPIO}/direction
}
[ ! -d $LOG_PATH ] && mkdir -p $LOG_PATH
[ ! -d $DB_PATH ] && mkdir -p $DB_PATH
start
}

View File

@@ -1 +0,0 @@
/etc/dect/LA_DB

17
dectmngr/files/sbin/dectreg Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
# This script is likely not used. Just exit with
# an error and see if someone screems... If not,
# we can delete this file.
exit 1
[ -f /var/dectisregistering ] || {
touch /var/dectisregistering 2>/dev/null
/usr/bin/dectmngr -r
ubus call led.dect set '{"state" : "notice"}'
sleep 20
rm /var/dectisregistering 2>/dev/null
/usr/bin/dectmngr -s
ubus call led.dect set '{"state" : "ok"}'
}

53
dectmngr2/Makefile Normal file
View File

@@ -0,0 +1,53 @@
#
# 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:=1.1.0
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=13da1568d57b8e6732dadc16de828d64c81906b8
PKG_NAME:=dectmngr2
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
include $(INCLUDE_DIR)/package.mk
define Package/dectmngr2
CATEGORY:=Utilities
TITLE:=Dectmngr2
URL:=
DEPENDS:= +natalie-dect-h bcmkernel +libubox +ubus
endef
define Package/dectmngr2/description
Dectmngr2
endef
define Package/dectmngr2/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/dect/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dectmngr2 $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/target.bin $(1)/etc/dect/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/nvs_default $(1)/etc/dect/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dect $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dectmngr-wrapper.sh $(1)/usr/sbin/
$(CP) ./files/dect.config $(1)/etc/config/dect
endef
$(eval $(call BuildPackage,dectmngr2))

View File

@@ -0,0 +1,4 @@
config dect 'dect'
option radio 'auto'

View File

@@ -1,79 +0,0 @@
#
# Copyright (C) 2018 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=dslmngr
PKG_VERSION:=1.2.0
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=43dec92b1c86be7859521da337e7bd1168848b26
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dslmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_brcmbca),y)
TARGET_PLATFORM=BROADCOM
else
$(info Unexpected CONFIG_TARGET)
endif
export TARGET_PLATFORM
define Package/dslmngr
SECTION:=utils
CATEGORY:=Utilities
TITLE:=XDSL status and configration utility
DEPENDS:=+libdsl +libuci +libubox +ubus +libpthread +libnl-genl +libeasy
endef
define Package/dslmngr/description
This package can be used to configure and provide status about
the XDSL subsystem through UBUS.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-I$(STAGING_DIR)/usr/include/xdsl \
-D_GNU_SOURCE
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
FPIC="$(FPIC)"
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -r --exclude=.* ~/git/dslmngr/ $(PKG_BUILD_DIR)/
endef
endif
define Build/Compile
+$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
endef
define Package/dslmngr/install
$(CP) ./files/common/* $(1)/
ifeq ($(CONFIG_TARGET_brcmbca),y)
$(CP) ./files/broadcom/* $(1)/
endif
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
endef
$(eval $(call BuildPackage,dslmngr))

View File

@@ -1,313 +0,0 @@
#!/bin/sh
. /lib/functions.sh
# ATM #
check_pvc() {
local vpi=$1
local vci=$2
local ret
ret=$(xtmctl operate conn --show | awk -v test="$vpi/$vci" '{if ($3==test ) print $5 }')
case $ret in
''|*[!0-9]*) return 0 ;;
*) return $ret ;;
esac
}
check_xtm_list() {
local qclass=$1
local pcr scr mbs
local ret
case $# in
1)
pcr=0
scr=0
mbs=0
;;
2)
pcr=$2
scr=0
mbs=0
;;
4)
pcr=$2
scr=$3
mbs=$4
;;
esac
ret=$(xtmctl operate tdte --show | awk -v test="$qclass" -v pcr="$pcr" -v scr="$scr" -v mbs="$mbs" '{if ($2==test && $3==pcr && $4==scr && $5==mbs ) print $1 }')
case $ret in
''|*[!0-9]*) return 0 ;;
*) return $ret ;;
esac
}
configure_atm_device() {
local name vpi vci device link_type encapsulation qos_class pcr mbs scr i
config_get name $1 name "ATM"
config_get vpi $1 vpi "8"
config_get vci $1 vci "35"
config_get device $1 device "atm0"
config_get link_type $1 link_type "eoa"
config_get encapsulation $1 encapsulation "llc"
config_get qos_class $1 qos_class "ubr"
config_get pcr $1 pcr
config_get mbs $1 mbs
config_get scr $1 scr
check_pvc $vpi $vci
ret=$?
if [ "$ret" -eq 0 ]; then
check_xtm_list $qos_class $pcr $scr $mbs
ret=$?
if [ "$ret" -eq 0 ]; then
case $qos_class in # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
ubr)
xtmctl operate tdte --add "$qos_class"
;;
ubr_pcr|ubr+)
xtmctl operate tdte --add "$qos_class" $pcr
;;
cbr)
xtmctl operate tdte --add "$qos_class" $pcr
;;
nrtvbr|vbr-nrt)
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
;;
rtvbr|vbr-rt)
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
;;
gfr)
;;
abr)
;;
esac
fi
case $link_type in # EoA, IPoA, PPPoA, CIP
EoA|eoa)
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_eth" || encapsulation="llcsnap_eth"
;;
PPPoA|pppoa)
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_pppoa" || encapsulation="llcencaps_ppp"
;;
IPoA|ipoa)
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_ipoa" || encapsulation="llcsnap_rtip"
;;
CIP|cip)
;;
esac
check_xtm_list $qos_class $pcr $scr $mbs
ret="$?"
xtmctl operate conn --add 1.$vpi.$vci aal5 $encapsulation 0 1 $ret
for i in `seq 0 7`; do
xtmctl operate conn --addq 1.$vpi.$vci $i wrr 1 dt # queue priority 0-7
done
xtmctl operate conn --createnetdev 1.$vpi.$vci $device
xtmctl operate intf --state 1 enable
fi
}
remove_atm_devices() {
local vpi vci rest
local vpivci=`xtmctl operate conn --show | grep "ATM\|mode" | awk '{if (NR!=1 && $1!="PTM") {print $3}}'`
for i in $vpivci
do
rest=${i#\/}
vpi=${rest%%\/*}
vci=${rest#*\/}
echo "xtmctl operate conn --delete 1.$vpi.$vci"
xtmctl operate conn --delete 1.$vpi.$vci
echo "xtmctl operate conn --deletenetdev 1.$vpi.$vci"
xtmctl operate conn --deletenetdev 1.$vpi.$vci
done
}
create_atm_devices() {
echo "Creating ATM Device(s)"
config_load dsl
config_foreach configure_atm_device atm-device
}
# ATM END #
# PTM #
check_ptm() {
local ret
local ptmprio=$1
local dslat=$2
if [ "$ptmprio" -eq 2 ]; then
ptmprio="high"
else
ptmprio="low"
fi
ret=$(xtmctl operate conn --show | awk -v dslat="$dslat" -v ptmprio="$ptmprio" '{if ($2 == dslat && $3 == ptmprio ) print $2 }')
case $ret in
''|*[!0-9]*) return 0 ;;
*) return $ret ;;
esac
}
configure_ptm_device() {
local name device priority portid i
config_get name $1 name "PTM"
config_get device $1 device "ptm0"
config_get priority $1 priority 1
config_get portid $1 portid 1
check_ptm $priority $portid
ret=$?
if [ "$ret" -eq 0 ]; then
xtmctl operate conn --add $portid.$priority
for i in `seq 0 7`; do
xtmctl operate conn --addq $portid.$priority $i wrr 1 dt -1 -1 3000 # queue priority 0-7
done
echo "xtmctl operate conn --createnetdev $portid.$priority $device"
xtmctl operate conn --createnetdev $portid.$priority $device
xtmctl operate intf --state 1 enable
fi
}
remove_ptm_devices() {
local delptm
local x=0
IFS=$'\n'
for i in `xtmctl operate conn --show | grep "PTM\|mode"`
do
if [ $x -eq 1 ]; then
delptm=$(echo $i | awk '{if ($1!="ATM") print $2"."$11}')
echo "xtmctl operate conn --delete $delptm"
xtmctl operate conn --delete $delptm
xtmctl operate conn --deletenetdev $delptm
fi
x=1
done
unset IFS
}
create_ptm_devices() {
echo "Creating PTM Device(s)"
config_load dsl
config_foreach configure_ptm_device ptm-device
}
# PTM END #
prioritize_arp()
{
ebtables -t nat -D POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
ebtables -t nat -A POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
}
xtm_remove_devices() {
remove_atm_devices
remove_ptm_devices
}
xtm_create_devices() {
local tpstc="$(xdslctl info --show | grep TPS-TC)"
if echo "$tpstc" | grep -q "ATM Mode"; then
create_atm_devices
elif echo "$tpstc" | grep -q "PTM Mode"; then
create_ptm_devices
fi
}
xdsl_configure() {
local VDSL=0
local GFAST=0
local mod=""
local modes=""
local profile=""
config_load dsl
# Modes
config_get mode line mode
for mod in $mode; do
[ $mod == "gdmt" ] && modes="${modes}d"
[ $mod == "glite" ] && modes="${modes}l"
[ $mod == "t1413" ] && modes="${modes}t"
[ $mod == "adsl2" ] && modes="${modes}2"
[ $mod == "adsl2p" ] && modes="${modes}p"
[ $mod == "annexl" ] && modes="${modes}e"
[ $mod == "annexm" ] && modes="${modes}m"
[ $mod == "vdsl2" ] && modes="${modes}v" && VDSL=1
[ $mod == "gfast" ] && modes="${modes}f" && GFAST=1
done
# VDSL Profiles
config_get profile line profile
# Capabilities
config_get_bool bitswap line bitswap 1
[ $bitswap -eq 1 ] && bitswap="on" || bitswap="off"
config_get_bool sra line sra 1
[ $sra -eq 1 ] && sra="on" || sra="off"
# config_get_bool trellis line trellis 1
config_get_bool sesdrop line sesdrop 0
[ $sesdrop -eq 1 ] && sesdrop="on" || sesdrop="off"
# VDSL2 only
config_get_bool us0 line us0 1
[ $us0 -eq 1 ] && us0="on" || us0="off"
# config_get_bool dynamicd line dynamicd 1
# config_get_bool dynamicf line dynamicf 1
config_get_bool sos line sos 0
[ $sos -eq 1 ] && sos="on" || sos="off"
config_get_bool phyReXmtUs line phyReXmtUs 0
config_get_bool phyReXmtDs line phyReXmtDs 1
phyReXmt=$(( $((phyReXmtUs<<1)) + phyReXmtDs))
if [ $VDSL -eq 1 -o $GFAST -eq 1 ]; then
echo "xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0 --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt"
xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0 --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt
# G.Fast hardware to VDSL hardware, to set the driver bit kPhyCfg2EnableGfastVdslMMTimeOut0.
# Enable V43 tone for GFAST.
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400"
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400
else
echo "xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt"
xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt
fi
if [ $GFAST -eq 1 ]; then
# G.Fast hardware to VDSL hardware, to set the driver bit kPhyCfg2EnableGfastVdslMMTimeOut0.
# Enable V43 tone for GFAST.
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400"
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400
fi
}
xdsl_stop() {
# echo "Stopping DSL"
# stop causes IRQ issues
# xdslctl stop
return 0
}
xdsl_init() {
[ -d /sys/class/net/dsl0/ ] || exit
prioritize_arp
echo "Starting DSL"
xtmctl start
xtmctl operate intf --state 1 enable
}

View File

@@ -1,53 +0,0 @@
# OEM specific parameters
config oem-parameters 'oem'
# option country_code "0000" # 2 bytes hex
# option vendor_id "IO" # 4 bytes string
# option vendor_suffix "0000" # 2 bytes hex
# option sw_version "iopsys" # 16 bytes string
# option serial_nr "00000000" # 32 bytes string
# DSL Modes
config dsl-line line
list mode gdmt
list mode glite
list mode t1413
list mode adsl2
list mode adsl2p
list mode annexl
list mode annexm
list mode vdsl2
# VDSL2 profiles
list profile 8a
list profile 8b
list profile 8c
list profile 8d
list profile 12a
list profile 12b
list profile 17a
list profile 30a
option bitswap 1
option sra 1
option us0 1 # VDSL2 only
option sesdrop 0
option sos 0
option phyReXmtUs 0
option phyReXmtDs 1
config atm-device atm0
option name 'ATM'
option vpi '8'
option vci '35'
option device atm0
option link_type 'eoa' # EoA, IPoA, PPPoA, CIP
option encapsulation 'llc' # llc, vcmux
option qos_class 'ubr' # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
# option pcr '512'
# option scr '256'
# option mbs '1024'
config ptm-device ptm0
option name 'PTM'
option device 'ptm0'
option priority '1'
option portid '1'

View File

@@ -1,7 +0,0 @@
[ "$STATUS" == "up" -o "$STATUS" == "down" ] || exit 0
. /lib/functions.sh
include /lib/dsl
xtm_remove_devices
xtm_create_devices

View File

@@ -1,7 +0,0 @@
if [ "$STATUS" == "up" ]; then
ubus call led.dsl set '{"state":"ok"}'
elif [ "$STATUS" == "down" ]; then
ubus call led.dsl set '{"state":"off"}'
elif [ "$STATUS" == "training" ]; then
ubus call led.dsl set '{"state":"alert"}'
fi

View File

@@ -1,41 +0,0 @@
#!/bin/sh /etc/rc.common
. /lib/functions.sh
include /lib/dsl
START=20
USE_PROCD=1
DSLMNGR=$(which dslmngr)
start_service() {
[ -n "$DSLMNGR" ] && {
procd_open_instance
procd_set_param command "$DSLMNGR"
procd_set_param respawn
procd_close_instance
}
xdsl_configure
xtm_create_devices
}
stop_service() {
xtm_remove_devices
xdsl_stop
}
boot() {
xdsl_init
start
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger dsl
}

View File

@@ -1,47 +0,0 @@
#
# Copyright (C) 2019 iopsys Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=easy-qos
PKG_VERSION:=1.1
PKG_RELEASE:=0
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=none
include $(INCLUDE_DIR)/package.mk
define Package/easy-qos
SECTION:=net
CATEGORY:=Network
TITLE:=Easy QoS
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
endef
define Package/easy-qos/description
This package contains Easy QoS utility
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./files/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
endef
define Package/easy-qos/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(CP) ./files/etc/config/easy_qos $(1)/etc/config/
$(CP) ./files/etc/init.d/easy_qos.iptables $(1)/etc/init.d/easy_qos
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
$(CP) ./files/etc/firewall.easyqos $(1)/etc/firewall.easyqos
endef
$(eval $(call BuildPackage,easy-qos))

View File

@@ -1 +0,0 @@
/etc/init.d/easy_qos reload

View File

@@ -1,140 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
log() {
echo "${@}"|logger -t easy_qos.ebtable -p debug
}
exec_log() {
${@}
if [ "${?}" -ne 0 ]; then
log "Failed to create ${@}";
fi
}
get_priority() {
local prio=$(echo $1|tr 'A-Z' 'a-z');
case "${prio}" in
"lowest")
echo 0;;
"low")
echo 1;;
"besteffort")
echo 2;;
"normal")
echo 3;;
"video")
echo 4;;
"medium")
echo 5;;
"high")
echo 6;;
"highest")
echo 7;;
esac
}
validate_rule_section()
{
uci_validate_section easy_qos rule "${1}" \
'priority:string' \
'macaddr:string' \
'proto:string:none' \
'port:list(uinteger)' \
'comment:string:none'
}
# Clear existing rules before applying new rules
clear_existing_rules() {
local rule=$(ebtables -t broute -L BROUTING|grep -m 1 mark)
while [ -n "${rule}" ]; do
exec_log ebtables -t broute -D BROUTING ${rule}
rule=$(ebtables -t broute -L BROUTING|grep -m 1 mark)
done
}
create_rule() {
local protocol=$1; shift
local mac=$1; shift
local mark="0x$1"; shift
local forward_port=$1;
local cmd="";
local protocol_number
cmd="-j mark --mark-or ${mark}";
if [ -n "${forward_port}" ]; then
cmd="--ip-destination-port ${forward_port} ${cmd}";
fi
case "${protocol}" in
"tcp")
protocol_number=6;;
"udp")
protocol_number=17;;
"dccp")
protocol_number=33;;
"sctp")
protocol_number=132;;
*)
log "Protocol ${protocol} not supported in ebtables"
return;;
esac
cmd="--ip-proto ${protocol_number} $cmd"
cmd="-p ip $cmd"
cmd="-s ${mac} $cmd"
exec_log ebtables -t broute -A BROUTING ${cmd}
}
manage_rule() {
local cfg="$1"
local priority macaddr proto port comment prio_num protocol
validate_rule_section "${1}" || {
log "Validation of section failed"
return 1;
}
protocol=$(echo ${proto}|tr 'A-Z' 'a-z')
prio_num=$(get_priority ${priority})
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
for p in ${port}; do
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
create_rule tcp ${macaddr} ${prio_num} ${p}
create_rule udp ${macaddr} ${prio_num} ${p}
else
create_rule ${protocol} ${macaddr} ${prio_num} ${p}
fi
done
# Create rule for all ports if port is not mentioned in uci
if [ -z "${port}" ]; then
if [ "${protocol}" == "none" -o "${protocol}" == "tcpudp" ]; then
create_rule tcp ${macaddr} ${prio_num}
create_rule udp ${macaddr} ${prio_num}
else
create_rule ${protocol} ${macaddr} ${prio_num}
fi
fi
fi
}
reload_service() {
# Do not apply rules if ebtables is not present in system
[ -x /usr/sbin/ebtables ] || return;
clear_existing_rules
config_load easy_qos
config_foreach manage_rule rule
}
start_service() {
reload_service
}
service_triggers() {
procd_add_reload_trigger "easy_qos"
}

View File

@@ -1,186 +0,0 @@
#!/bin/sh /etc/rc.common
. /usr/share/libubox/jshn.sh
START=99
USE_PROCD=1
CLIENT_LIST="/tmp/easy_qos_client.list"
log() {
echo "${@}"|logger -t easy_qos -p debug
}
exec_log() {
${@}
if [ "${?}" -ne 0 ]; then
log "Failed to create ${@}";
fi
}
get_priority() {
local prio=$(echo $1|tr 'A-Z' 'a-z');
case "${prio}" in
"lowest")
echo 0;;
"low")
echo 1;;
"besteffort")
echo 2;;
"normal")
echo 3;;
"video")
echo 4;;
"medium")
echo 5;;
"high")
echo 6;;
"highest")
echo 7;;
esac
}
clean_client_entries() {
[ -f ${CLIENT_LIST} ] && rm ${CLIENT_LIST}
}
map_client_entries() {
local clients ip mac host
json_load "$(ubus call router.network 'clients')"
json_get_keys keys
for key in ${keys};
do
json_select ${key}
json_get_vars ipaddr macaddr hostname
clients="${macaddr} ${ipaddr} ${hostname};${clients}"
json_select ..
done
json_init
# json_add_array "clients"
IFS=";"
for client in ${clients};
do
macaddr=$(echo ${client} | cut -d" " -f1)
json_add_object "${macaddr//:/_}"
json_add_string "ip" "$(echo ${client} | cut -d" " -f2)"
json_add_string "macaddr" "$(echo ${client} | cut -d" " -f1)"
json_add_string "host" "$(echo ${client} | cut -d" " -f3)"
json_close_object
done
IFS=' '
echo `json_dump` > ${CLIENT_LIST}
json_cleanup
}
# Find the IP of a corresponding mac from arp table
get_ipaddress() {
local clients ip mac host
json_load "$(cat ${CLIENT_LIST})"
json_get_keys keys
# jshn seems a bit iffy on having : in key, replace by _
json_select "${1//:/_}" 2 > /dev/null
json_get_var ip ip
echo "$ip"
}
validate_rule_section()
{
uci_validate_section easy_qos rule "${1}" \
'priority:string' \
'macaddr:string' \
'proto:string:none' \
'port:list(uinteger)' \
'comment:string:none'
}
# Clear existing rules before applying new rules
clear_existing_rules() {
local rule=$(iptables -t mangle -S PREROUTING | grep -m 1 MARK |sed 's/-A/-D/1')
while [ -n "${rule}" ]; do
exec_log iptables -t mangle ${rule}
rule=$(iptables -t mangle -S PREROUTING | grep -m 1 MARK |sed 's/-A/-D/1')
done
}
check_and_create() {
iptables -t mangle -C PREROUTING ${@} 2>/dev/null
# Create rule if not exists
if [ ${?} -ne 0 ]; then
exec_log iptables -t mangle -A PREROUTING ${@}
else
log "Rule exists for ${@}"
fi
}
create_rule() {
local proto=$1; shift
local src_ip=$1; shift
local mark="0x$1/0x$1"; shift
local ports=$1;
local cmd="";
cmd="-j MARK --set-xmark ${mark}";
if [ -n "${ports}" ]; then
cmd="--match multiport --dports ${ports} ${cmd}";
fi
if [ "${proto}" == "icmp" ]; then
cmd="-p icmp -m icmp --icmp-type 8 $cmd"
elif [ "${proto}" == "all" ]; then
cmd="-p all $cmd"
else
cmd="-p ${proto} -m ${proto} $cmd"
fi
cmd="-s ${src_ip} $cmd"
check_and_create ${cmd}
}
manage_rule() {
local cfg="$1"
local priority macaddr proto port comment prio_num ip port_list
validate_rule_section "${1}" || {
log "Validation of section failed"
return 1;
}
prio_num=$(get_priority ${priority})
ip=$(get_ipaddress ${macaddr})
port_list=$(echo ${port}|sed 's/ /,/g')
if [ -n "${ip}" -a -n "${prio_num}" ]; then
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
create_rule tcp ${ip} ${prio_num} ${port_list}
create_rule udp ${ip} ${prio_num} ${port_list}
else
create_rule ${proto} ${ip} ${prio_num} ${port_list}
fi
fi
}
reload_service() {
clear_existing_rules
map_client_entries
config_load easy_qos
config_foreach manage_rule rule
clean_client_entries
}
start_service() {
reload_service
echo "Easy QoS installed">/dev/console;
}
service_triggers() {
procd_add_reload_trigger "easy_qos"
}

View File

@@ -1,8 +0,0 @@
# Add firewall include
uci -q batch <<-EOT
delete firewall.easyqos
set firewall.easyqos=include
set firewall.easyqos.path=/etc/firewall.easyqos
set firewall.easyqos.reload=1
commit firewall
EOT

View File

@@ -1,110 +0,0 @@
# All rights reserved.
# See LICENSE for more information.
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=easy-soc-events
PKG_VERSION:=1.1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git@dev.iopsys.eu:iopsys/easy-soc-events.git
PKG_SOURCE_VERSION:=5c582b0165b574dc94e4865f82e0bb91fa561754
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/easy-soc-events-$(PKG_VERSION)
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
include $(INCLUDE_DIR)/package.mk
-include $(TOPDIR)/.config
ifneq ($(CONFIG_TARGET_brcmbca),)
LINUX_DIR=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.1
LINUX_VERSION := 4.1.52
LINUXINCLUDE=-Iarch/$(LINUX_KARCH)/mach-bcm963xx/include
BCM_BS_PROFILE := $(patsubst "%",%,$(CONFIG_BCM_KERNEL_PROFILE))
FS_DIR := $(BUILD_DIR)/bcmkernel/bcm963xx/targets/$(BCM_BS_PROFILE)/fs
MODULES_SUBDIR:=lib/modules/$(LINUX_VERSION)/extra
TARGET_MODULES_DIR:=/$(MODULES_SUBDIR)
endif
define KernelPackage/easy-soc-events/default
SUBMENU:=Other modules
endef
define KernelPackage/easy-soc-events
$(KernelPackage/easy-soc-events/default)
TITLE:=Helper module for netlink event notification
FILES:=$(PKG_BUILD_DIR)/easyevent.ko
AUTOLOAD:=$(call AutoLoad,11,easyevent)
endef
define KernelPackage/easy-soc-events-test
$(KernelPackage/easy-soc-events/default)
TITLE:=Test module for event notification through easyevent
DEPENDS+=+kmod-easy-soc-events
FILES+=$(PKG_BUILD_DIR)/test/testevent.ko
endef
define KernelPackage/easy-soc-events/description
This is a helper module to generate and pass netlink events from
kernel to user applications.
endef
#NOSTDINC_FLAGS :=
ifdef CONFIG_PACKAGE_kmod-easy-soc-events
PKG_MAKE_FLAGS += CONFIG_EASYEVENT=y
endif
LINUXINCLUDE += \
-I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/$(LINUX_UAPI_DIR) \
-Iarch/$(LINUX_KARCH)/include \
-Iarch/$(LINUX_KARCH)/include/generated \
-Iarch/$(LINUX_KARCH)/include/generated/$(LINUX_UAPI_DIR) \
-I$(LINUX_DIR)/include/generated/uapi \
-Iarch/$(LINUX_KARCH)/include/$(LINUX_UAPI_DIR) \
-include ./include/linux/kconfig.h
define Build/Prepare
$(call Build/Prepare/Default)
endef
define Build/Compile
$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
$(KERNEL_MAKE_FLAGS) V=1 \
$(PKG_MAKE_FLAGS) \
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
LINUXINCLUDE="$(LINUXINCLUDE)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
modules
endef
ifneq ($(CONFIG_TARGET_brcmbca),)
define KernelPackage/easy-soc-events/install-extra
cp $(PKG_BUILD_DIR)/easyevent.ko $(FS_DIR)/lib/modules/$(LINUX_VERSION)/extra
endef
endif
define KernelPackage/easy-soc-events/install
$(call KernelPackage/easy-soc-events/install-extra)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)/usr/include
#$(INSTALL_DIR) $(STAGING_DIR)/usr/include/linux
#$(CP) $(PKG_BUILD_DIR)/easysoc-event.h $(STAGING_DIR)/usr/include/linux/
#$(CP) $(PKG_BUILD_DIR)/easysoc-event.h $(LINUX_DIR)/include/linux/
$(CP) $(PKG_BUILD_DIR)/easyevent.h $(STAGING_DIR)/usr/include/
$(CP) $(PKG_BUILD_DIR)/wifievent.h $(STAGING_DIR)/usr/include/
$(CP) $(PKG_BUILD_DIR)/easyevent.h $(LINUX_DIR)/include/generated/uapi
$(CP) $(PKG_BUILD_DIR)/wifievent.h $(LINUX_DIR)/include/generated/uapi
endef
$(eval $(call KernelPackage,easy-soc-events-test))
$(eval $(call KernelPackage,easy-soc-events))

4
endptcfg/Config.in Normal file
View File

@@ -0,0 +1,4 @@
config ENDPT_OPEN
bool "Use pre-compiled version for Open SDK"
default n

92
endptcfg/Makefile Normal file
View File

@@ -0,0 +1,92 @@
#
# 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_NAME:=endptcfg
PKG_VERSION:=0.2
PKG_SOURCE_VERSION:=1194b05278bd0945ca5c76436e56617b86871a65
ifeq ($(CONFIG_ENDPT_OPEN),y)
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
PKG_NAME:=endptcfg-open
else
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=git@private.inteno.se:endptcfg
PKG_SOURCE_PROTO:=git
endif
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
LDFLAGS+= \
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
-Wl,-rpath-link=$(STAGING_DIR)/lib
BCMKERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
export BCMKERNEL_DIR
TARGET_LDFLAGS += $(BCMKERNEL_DIR)/userspace/private/apps/vodsl/telephonyProfiles/telephonyProfiles.o \
$(BCMKERNEL_DIR)/userspace/private/apps/vodsl/voip/util/log/vodslLog.o \
$(BCMKERNEL_DIR)/userspace/private/apps/vodsl/endpoint/endpoint_user.o \
$(BCMKERNEL_DIR)/userspace/private/apps/vodsl/bos/bos.o \
-lpthread
TARGET_CFLAGS += -DFAKE_SSP
RSTRIP:=true
export BUILD_DIR
include $(INCLUDE_DIR)/package.mk
define Package/endptcfg
CATEGORY:=Utilities
TITLE:=Broadcom endpoint driver configuration application
URL:=
DEPENDS:=+libpthread bcmkernel
endef
define Package/endptcfg/description
Broadcom endpoint driver configuration application
endef
define Package/endptcfg/config
source "$(SOURCE)/Config.in"
endef
ifneq ($(CONFIG_ENDPT_OPEN),y)
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) \
-I$(LINUX_DIR)/include \
-I$(STAGING_DIR)/usr/include \
-DRS_ENDIAN_TYPE=RS_BIG_ENDIAN \
-DBOS_OS_LINUXUSER -DBOS_CFG_TIME \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc \
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc \
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser"
endef
else
define Build/Compile
endef
endif
define Package/endptcfg/install
$(INSTALL_DIR) $(1)/usr/bin
cp $(PKG_BUILD_DIR)/endptcfg $(1)/usr/bin/
endef
$(eval $(call BuildPackage,endptcfg))

View File

@@ -1,53 +0,0 @@
#
# Copyright (C) 2020 Iopsys
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ethmngr
PKG_VERSION:=2.1.1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=b81d06867d895245ef47004c6949f9d6dedd10ef
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ethmngr.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/ethmngr
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Ethernet status and configration utility
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_ipq53xx||TARGET_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
endef
define Package/ethmngr/description
This package can be used to configure and provide status about
the ethernet interfaces and ports through UBUS.
It uses APIs from the libethernet.so library.
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-I$(STAGING_DIR)/usr/include/libnl3 \
-D_GNU_SOURCE
ifeq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_ipq53xx)$(CONFIG_TARGET_mediatek),)
define Build/Compile
endef
endif
define Package/ethmngr/install
$(CP) ./files/* $(1)/
ifneq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_ipq53xx)$(CONFIG_TARGET_mediatek),)
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
endif
endef
$(eval $(call BuildPackage,ethmngr))

View File

@@ -1,28 +0,0 @@
#!/bin/sh /etc/rc.common
START=15
STOP=90
USE_PROCD=1
PROG=/usr/sbin/ethmngr
. /lib/functions.sh
include /lib/ethernet
start_service() {
if [ -f $PROG ]; then
procd_open_instance
procd_set_param command ${PROG}
procd_set_param respawn
procd_close_instance
fi
}
reload_service() {
stop
start
}
service_triggers() {
procd_add_reload_trigger network
}

49
eventlog/Makefile Normal file
View File

@@ -0,0 +1,49 @@
#
# Copyright (C) 2009-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_NAME:=eventlog
PKG_VERSION:=0.2.9
PKG_RELEASE:=2
PKG_SOURCE_URL:=http://www.balabit.com/downloads/files/eventlog/0.2/
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
PKG_MD5SUM:=76e3d7a0b8f335c12099e9b91191fbf1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libeventlog
SECTION:=libs
CATEGORY:=Libraries
TITLE:=A new API to format and send structured log messages.
endef
define Package/eventlog/description
A new API to format and send structured log messages. It supports multiple message
representations (plain, XML attributes and XML tags) and multiple output methods
(local syslogd).
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/eventlog $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/eventlog.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libeventlog/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libeventlog))

View File

@@ -1,7 +1,7 @@
#
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v3.
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
@@ -20,9 +20,6 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
# support parallel build
#PKG_BUILD_PARALLEL:=1

View File

@@ -1,48 +0,0 @@
#
# Copyright (C) 2021 IOPSYS Software Solutions AB
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fdtextract
PKG_RELEASE:=1
PKG_VERSION:=1.0
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/fdtextract.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=e3cefda3b26c9aea3021b20725ce7b31b33eebc4
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=GPLv2
PKG_LICENSE_FILES:=LICENSE
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=fdtextract
DEPENDS:= +libfdt
endef
define Package/$(PKG_NAME)/description
Command to extract sub images from FIT images.
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fdtextract $(1)/usr/sbin/
$(STRIP) $(1)/usr/sbin/fdtextract
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

54
fping/Makefile Normal file
View File

@@ -0,0 +1,54 @@
#
# Copyright (C) 2016 Nikil Mehta <nikil.mehta@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fping
PKG_VERSION:=4.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://fping.org/dist/
PKG_HASH:=67eb4152b98ad34f99d2eec4e1098a0bb52caf13c0c89cd147349d08190fe8ce
PKG_MAINTAINER:=Nikil Mehta <nikil.mehta@gmail.com>
PKG_LICENSE:=BSD-4-Clause
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/fping
SECTION:=net
CATEGORY:=Network
TITLE:=sends ICMP ECHO_REQUEST packets to network hosts
URL:=http://fping.org/
endef
define Package/fping/description
fping is a ping like program which uses the Internet Control Message Protocol
(ICMP) echo request to determine if a target host is responding. fping
differs from ping in that you can specify any number of targets on the command
line, or specify a file containing the lists of targets to ping. Instead of
sending to one target until it times out or replies, fping will send out a
ping packet and move on to the next target in a round-robin fashion.
endef
CONFIGURE_ARGS+= \
--enable-ipv4 \
--enable-ipv6
TARGET_CFLAGS += -std=gnu99
define Package/fping/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fping $(1)/usr/bin/
endef
$(eval $(call BuildPackage,fping))

View File

@@ -1,42 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-only
include $(TOPDIR)/rules.mk
PKG_NAME:=fscryptctl
PKG_VERSION:=1.1.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/google/fscryptctl.git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Encryption
TITLE:=Fscryptctl
endef
define Package/$(PKG_NAME)/description
fscryptctl is a low-level tool written in C that handles raw keys and manages policies for Linux filesystem encryption,
specifically the "fscrypt" kernel interface which is supported by the ext4, f2fs, and UBIFS filesystems
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
fscryptctl
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fscryptctl $(1)/usr/bin/fscryptctl
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

3
gigaset-elements/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
git-src

65
gigaset-elements/Makefile Normal file
View File

@@ -0,0 +1,65 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gigaset-elements
PKG_VERSION:=2.4.2
# PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_GIGASET_ELEMENTS_SRC_URL ?= git@public.inteno.se:gigaset-elements.git
PKG_GIGASET_ELEMENTS_VERSION ?= v$(PKG_VERSION)
PKG_SOURCE_URL:=$(PKG_GIGASET_ELEMENTS_SRC_URL)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=aa906b37062b6d7937a9c0f8e7b62b32afe4bdeb
PKG_MAINTAINER:=Magier Marcin, Figlarek Piotr
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
include $(INCLUDE_DIR)/package.mk
######################################################
define Package/gigaset-elements
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libjson-c +libcurl +libpthread
TITLE:=Gigaset elements
endef
######################################################
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) all
endef
define Package/gigaset-elements/install
$(CP) -r $(PKG_BUILD_DIR)/sysroot_common/* $(1)/
$(CP) -r $(PKG_BUILD_DIR)/sysroot_$(CONFIG_ARCH)/* $(1)/
endef
define Package/gigaset-elements/preinst
#!/bin/sh
mkdir -p $${IPKG_INSTROOT}/usr/gigaset/data/cert
mkdir -p $${IPKG_INSTROOT}/usr/gigaset/data/fw
endef
define Package/gigaset-elements/postrm
#!/bin/sh
rm -rf $${IPKG_INSTROOT}/usr/gigaset/data
rm -rf /usr/share/gigaset
endef
######################################################
$(eval $(call BuildPackage,gigaset-elements))

View File

@@ -1,66 +0,0 @@
# Copyright (c) 2017 Genexis B.V.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=gryphon-led-kernel-module
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
define KernelPackage/$(PKG_NAME)
SUBMENU:=LED modules
TITLE:=LED driver for Gryphon
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
DEPENDS:= +(TARGET_brcmbca):bcmkernel
PKG_LICENSE:=GPLv2
PKG_LICENSE_URL:=
endef
define KernelPackage/$(PKG_NAME)/description
This package contains the LED driver for Gryphon devices.
endef
EXTRA_KCONFIG:= CONFIG_RGB_LED=m
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
# support compilation against BCM SDK kernel
include ../../broadcom/bcmkernel/bcm-kernel-toolchain.mk
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/
$(CP) -s `pwd`/src/* $(PKG_BUILD_DIR)/kdevlinks/
$(CP) src/* $(PKG_BUILD_DIR)
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="-DKERNEL_MODULE $(BUILDFLAGS) -I$(LINUX_DIR)/include -include generated/autoconf.h $(MODULE_INCLUDE)" \
modules
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
endef
$(eval $(call KernelPackage,$(PKG_NAME)))

View File

@@ -1,26 +0,0 @@
# Copyright (c) 2017 Genexis B.V.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
MODULE_NAME = gryphon-led-kernel-module
obj-m := $(MODULE_NAME).o
GENEXIS_FILES= \
main.o \
sk9822.o \
sk9822_bitbang.o
$(MODULE_NAME)-objs := $(GENEXIS_FILES)

View File

@@ -1,330 +0,0 @@
/*
* Copyright (c) 2017 Genexis B.V.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#define DEBUG 1
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/printk.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/gpio/consumer.h>
#include <linux/of.h>
#include <linux/version.h>
#include "sk9822.h"
#define DRIVER_NAME "canyon_led"
#define DRIVER_AUTHOR "Genexis B.V."
#define DRIVER_DESC "Canyon LED driver for SK9822"
#define DRIVER_VERSION "1"
/**
* sysfs interfaces
*/
static ssize_t get_led_color(struct device *dev,
struct device_attribute *attr, char *buf)
{
int len;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
len = scnprintf(buf, PAGE_SIZE, "%02x%02x%02x\n", sk9822->led_colors[0].r, sk9822->led_colors[0].g, sk9822->led_colors[0].b);
if (len <= 0) {
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
return -EIO;
}
return len;
}
/**
* @brief Set complete LED strip to a specific color
* @retval count number of bytes written
* @retval -EMSGSIZE if the message is too big
* @retval -EIO for all other errors (e.g. leds cannot be configured)
*/
static ssize_t set_led_color(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int ret = 0;
size_t buflen = count;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
/* strip newline */
if ((count > 0) && (buf[count-1] == '\n')) {
buflen--;
}
if (buflen != 6) { // RRGGBB\0
return -EMSGSIZE;
}
// Update the LED array here
ret = sk9822_set_color_str(sk9822, buf);
if (ret != 0) {
printk(KERN_ERR "Failed to set led color\n");
return -EIO;
}
// Now push to the HW
ret = sk9822_update(sk9822);
if (ret != 0) {
printk(KERN_ERR "Failed to update led\n");
return -EIO;
}
return count;
}
static DEVICE_ATTR(led_color, S_IRUGO | S_IWUSR, get_led_color, set_led_color);
static ssize_t get_led_brightness(struct device *dev,
struct device_attribute *attr, char *buf)
{
int len;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
len = scnprintf(buf, PAGE_SIZE, "%x\n", sk9822->led_brightness);
if (len <= 0) {
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
return -EIO;
}
return len;
}
/**
* @brief Set LED brightness
* @retval count number of bytes written
* @retval -EINVAL if the message is not a valid hexadecimal number
* @retval -EIO for all other errors (e.g. leds cannot be configured)
*/
static ssize_t set_led_brightness(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int ret = 0;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
unsigned long val = SK9822_DEFAULT_BRIGHTNESS;
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
}
if (kstrtoul(buf, 16, &val)) {
return -EINVAL;
}
if(val > SK9822_DEFAULT_BRIGHTNESS) {
val = SK9822_DEFAULT_BRIGHTNESS;
}
sk9822->led_brightness = (uint8_t)val;
// Now push to the HW
ret = sk9822_update(sk9822);
if (ret != 0) {
printk(KERN_ERR "Failed to update led\n");
return -EIO;
}
return count;
}
static DEVICE_ATTR(led_brightness, S_IRUGO | S_IWUSR, get_led_brightness, set_led_brightness);
static struct attribute *sk9822_dev_attrs[] = {
&dev_attr_led_color.attr,
&dev_attr_led_brightness.attr,
NULL
};
static struct attribute_group sk9822_dev_attr_group = {
.name = "sk9822",
.attrs = sk9822_dev_attrs,
};
/**
* device prope and removal
*/
static int canyon_led_probe(struct platform_device *pdev)
{
int ret;
struct sk9822_leds *leds;
leds = devm_kzalloc(&pdev->dev, sizeof(*leds), GFP_KERNEL);
if (!leds) {
return -ENOMEM;
}
leds->dev = &pdev->dev;
leds->led_brightness = SK9822_DEFAULT_BRIGHTNESS;
ret = of_property_read_u16(pdev->dev.of_node, "led-count", &leds->led_count);
if (ret < 0) {
dev_warn(&pdev->dev, "Could not read led-count property\n");
leds->led_count = SK9822_DEFAULT_NUM_LEDS;
} else {
printk(KERN_INFO "Got led count: %u\n", leds->led_count);
}
leds->led_colors = devm_kzalloc(&pdev->dev,
(sizeof(cRGB) * leds->led_count), GFP_KERNEL);
if (!leds->led_colors) {
return -ENOMEM;
}
platform_set_drvdata(pdev, leds);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
leds->clock_gpio = gpiod_get_index(&pdev->dev, "led", 0);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
leds->clock_gpio = gpiod_get_index(&pdev->dev, "led", 0, GPIOD_OUT_HIGH);
#else
dev_warn(&pdev->dev, "Kernel version Not supported\n");
exit(1);
#endif
if (IS_ERR(leds->clock_gpio)) {
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
PTR_ERR(leds->clock_gpio));
return PTR_ERR(leds->clock_gpio);
}
gpiod_direction_output(leds->clock_gpio, 1);
if (IS_ERR(leds->clock_gpio)) {
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
PTR_ERR(leds->clock_gpio));
return PTR_ERR(leds->clock_gpio);
} else {
printk(KERN_INFO "Got clock gpio\n");
gpiod_set_value(leds->clock_gpio, 0);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
leds->data_gpio = gpiod_get_index(&pdev->dev, "led", 1);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
leds->data_gpio = gpiod_get_index(&pdev->dev, "led", 1, GPIOD_OUT_HIGH);
#else
dev_warn(&pdev->dev, "Kernel version Not supported\n");
exit(1);
#endif
if (IS_ERR(leds->data_gpio)) {
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
PTR_ERR(leds->data_gpio));
return PTR_ERR(leds->data_gpio);
}
gpiod_direction_output(leds->data_gpio, 1);
if (IS_ERR(leds->data_gpio)) {
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
PTR_ERR(leds->data_gpio));
return PTR_ERR(leds->data_gpio);
} else {
printk(KERN_INFO "Got data gpio\n");
gpiod_set_value(leds->data_gpio, 0);
}
printk(KERN_INFO "Attempt to set filefs stuff\n");
ret = sysfs_create_group(&pdev->dev.kobj, &sk9822_dev_attr_group);
if (ret) {
dev_err(&pdev->dev, "sysfs creation failed\n");
return ret;
}
#if 0
printk(KERN_INFO "Flash LEDs to verify they work\n");
sk9822_set_color_str(leds, "00FF00");
sk9822_update(leds);
msleep(200);
sk9822_set_color_str(leds, "000000");
sk9822_update(leds);
#endif
printk(KERN_INFO "canyon led successfully probed\n");
return 0;
}
static int canyon_led_remove(struct platform_device *pdev)
{
struct sk9822_leds *leds;
sysfs_remove_group(&pdev->dev.kobj, &sk9822_dev_attr_group);
leds = platform_get_drvdata(pdev);
if (IS_ERR(leds)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -1;
}
if (leds->clock_gpio) {
gpiod_put(leds->clock_gpio);
}
if (leds->data_gpio) {
gpiod_put(leds->data_gpio);
}
printk(KERN_NOTICE "Bye, bye\n");
return 0;
}
/**
* platform driver metadata
*/
static const struct of_device_id canyon_led_of_ids[] = {
{ .compatible = "canyon,led" },
{ }
};
static struct platform_driver canyon_led = {
.probe = &canyon_led_probe,
.remove = &canyon_led_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = canyon_led_of_ids,
},
};
MODULE_DEVICE_TABLE(of, canyon_led_of_ids);
module_platform_driver(canyon_led);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL");

Some files were not shown because too many files have changed in this diff Show More