Developing lightweight computation at the DSG edge

Commit 8e49f856 authored by hakais's avatar hakais
Browse files

Fixed driver selection issue

parent 994c3cb3
......@@ -24,18 +24,17 @@ define Package/qmp-small-node
DEPENDS:= \
+uhttpd +luci +luci-lib-nixio \
+luci-ssl \
+horst \
+iputils-arping +iputils-clockdiff +iputils-ping +iputils-tracepath \
+ahcpd \
+radvd \
+wireless-tools +iw +hostapd \
+wireless-tools +iw \
+wide-dhcpv6-client +wide-dhcpv6-control +wide-dhcpv6-server \
+bmx6-qmp +bmx6-qmp-uci-config +bmx6-qmp-json +bmx6-luci \
+olsrd +olsrd-mod-txtinfo +olsrd-mod-httpinfo +olsrd-mod-watchdog \
+olsrd-mod-arprefresh +olsrd-luci \
+luci-i18n-catalan +luci-i18n-spanish +luci-i18n-french \
+babeld \
+ntpclient +ip \
+ip \
+ndisc6 +rdisc6 +rdnssd \
+6in4 +6to4 \
+ip6tables +ip6tables-utils \
......
......@@ -7,15 +7,17 @@ QMP_DIR="/etc/qmp"
configure() {
echo "Starting qmp configuration..."
echo "[Configuring networking]"
. $QMP_DIR/qmp_functions.sh
qmp_configure
echo "[Configuring wireless]"
. $QMP_DIR/qmp_wireless.sh
qmp_configure_wifi_initial
qmp_configure_wifi
wifi
wifi
echo "[Configuring networking]"
. $QMP_DIR/qmp_functions.sh
qmp_configure
touch "$CONTROL_FILE"
echo "Done"
}
......
......@@ -27,3 +27,7 @@ qmp_get_wifi_mac_devices() {
echo "$(ip link | grep -A1 -E ": (wifi|wlan).: " | grep link | cut -d' ' -f6)"
}
reverse_order() {
echo "$@" | awk '{for (i=NF; i>0; i--) printf("%s ",$i);print ""}'
}
......@@ -9,13 +9,35 @@ WIFI_DEFAULT_CONFIG="$QMP_PATH/templates/wireless.default.config"
. $QMP_PATH/qmp_common.sh
qmp_configure_wifi_driver() {
mac80211_modules="mac80211 ath ath5k ath9k_hw ath9k_common ath9k"
madwifi_modules="ath_hal ath_pci"
#Removing all modules
for m in $(reverse_order $mac80211_modules); do
rmmod -f $m
echo "Removing module $m"
done
for m in $(reverse_order $madwifi_modules); do
rmmod -f $m
echo "Removing module $m"
done
rmmod -a
#Loading driver modules
driver="$(qmp_uci_get wireless.driver)"
case $driver in
"madwifi")
mv /etc/modules.d/50-madwifi /etc/modules.d/22-madwifi 2>/dev/null
for m in $madwifi_modules; do
insmod $m
done
;;
"mac80211")
mv /etc/modules.d/22-madwifi /etc/modules.d/50-madwifi 2>/dev/null
for m in $mac80211_modules; do
insmod $m
done
;;
*)
qmp_error "Driver $driver not found"
......@@ -66,6 +88,9 @@ qmp_configure_wifi_device() {
qmp_configure_wifi() {
#This function search for all wifi devices and leave them configured according qmp config file
echo "Configuring driver..."
qmp_configure_wifi_driver
echo "Backuping wireless config file to: $OWRT_WIRELESS_CONFIG.qmp_backup"
cp $OWRT_WIRELESS_CONFIG $OWRT_WIRELESS_CONFIG.qmp_backup
echo "" > $OWRT_WIRELESS_CONFIG
......@@ -83,8 +108,7 @@ qmp_configure_wifi() {
done
i=$(( $i + 1 ))
done
echo "Configuring driver..."
qmp_configure_wifi_driver
echo "Done. All devices configured according qmp configuration"
}
......
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