Developing lightweight computation at the DSG edge

Commit e4cb46a9 authored by hitz's avatar hitz
Browse files

New autoconfig freatures

parent 6bb062d4
......@@ -54,6 +54,10 @@ define Package/qmp-small-node/description
Addons for small qmp nodes (4MByte flash)
endef
define Package/qmp-small-node/install
$(CP) ./files/* $(1)/
chmod 755 $(1)/etc/init.d/qmp_autoconf
endef
$(eval $(call BuildPackage,qmp-small-node))
......@@ -37,12 +37,14 @@ config qmp networks
#This is only a prototype, not implemented!
config qmp wireless1
option driver madwifi
option channel 44 option country 800
option channel 44
option country 800
option mode mesh
config qmp wireless2
option driver athXk
option channel 10
option country 800 option mode ap
option country 800
option mode ap
#!/bin/sh /etc/rc.common
# Copyright (C) 2011 qmp.cat
START=99
CONTROL_FILE="/qmp_configured"
QMP_PATH="/etc/qmp"
configure() {
echo "Starting qmp configuration..."
. $QMP_PATH/qmp_functions.sh
qmp_configure
touch "$CONTROL_FILE"
echo "Done"
}
start() {
if [ ! -f "$CONTROL_FILE" ]; then
configure
else
echo "QMP configured. Remove $CONTROL_FILE to force reconfiguration"
fi
}
stop() {
echo "Nothing to do"
}
restart() {
stop
start
}
#!/bin/sh
qmp_uci_get() {
echo "$(uci get qmp.$1)" 2>/dev/null
}
qmp_configure_wifi_device() {
echo "Configuring device $1"
}
qmp_configure_wifi() {
devices="$(ip link | grep -E ": (wifi|wlan).: "| cut -d: -f2)"
macs="$(ip link | grep -A1 -E ": (wifi|wlan).: " | grep link | cut -d' ' -f6)"
i=1
for d in $devices; do
m=$(echo $macs | cut -d' ' -f$i)
j=0
configured_mac="$(qmp_uci_get @wireless[$j].mac)"
while [ ! -z "$configured_mac" ]; do
[ "$configured_mac" == "$m" ] && { qmp_configure_wifi_device $j; break; }
j=$(( $j + 1 ))
configured_mac="$(qmp_uci_get @wireless[$j].mac)"
done
i=$(( $i + 1 ))
done
}
config wifi-device #QMP_DEVICE
option type #QMP_TYPE
option macaddr #QMP_MAC
option channel #QMP_CHANNEL
option diversity 0 # 0:off, 1:on
option txantenna 0 # 0:auto, 1:main, 2:aux
option rxantenna 0 # 0:auto, 1:main, 2:aux
option country #QMP_COUNTRY
option outdoor 1
# option txpower 1
config wifi-iface
option device #QMP_DEVICE
option mode #QMP_MODE
option ssid #QMP_SSID
option bssid #QMP_BSSID
option encryption none
../init.d/qmp_autoconf
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment