Skip to content

Commit

Permalink
EXPERIMENTAL: wifibroadcast: add monitor txbf support
Browse files Browse the repository at this point in the history
  • Loading branch information
libc0607 committed Nov 29, 2024
1 parent f541bf6 commit 0bc46b0
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-EXTRA_CFLAGS += -O1
+EXTRA_CFLAGS += -Os
#EXTRA_CFLAGS += -O3
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DCONFIG_BEAMFORMING_MONITOR
#EXTRA_CFLAGS += -Wall
#EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Werror
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-EXTRA_CFLAGS += -O1
+EXTRA_CFLAGS += -Os
#EXTRA_CFLAGS += -O3
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DCONFIG_BEAMFORMING_MONITOR
#EXTRA_CFLAGS += -Wall
#EXTRA_CFLAGS += -Wextra
#EXTRA_CFLAGS += -Werror
44 changes: 44 additions & 0 deletions general/package/wifibroadcast/files/bf_mon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/sh

OP=$1
WLAN_DRV=$2
NIC=$3
LOCAL_MAC=$4
REMOTE_MAC=$5
BW=$6
ACK_TIMEOUT=$7
INTERVAL=$8

TOKEN=0

if [ "$OP" = "stop" ]; then
echo "bf_mon: stop, reset status... "
echo "0 00:00:00:00:00:00 0 0" > /proc/net/$WLAN_DRV/$NIC/bf_monitor_conf
echo 33 > /proc/net/$WLAN_DRV/$NIC/ack_timeout # Realtek default
exit
fi

if [ "$OP" = "start" ]; then
echo "bf_mon: start... "
echo "1 $REMOTE_MAC 0 0" > /proc/net/$WLAN_DRV/$NIC/bf_monitor_conf
echo $ACK_TIMEOUT > /proc/net/$WLAN_DRV/$NIC/ack_timeout
while true; do
echo "$LOCAL_MAC $REMOTE_MAC 0 0 $TOKEN $BW" > /proc/net/$WLAN_DRV/$NIC/bf_monitor_trig
TOKEN=$((TOKEN + 1))
if [ $TOKEN -eq 64 ]; then
TOKEN=0
fi
sleep $INTERVAL
echo "1" > /proc/net/$WLAN_DRV/$NIC/bf_monitor_en
done
exit
fi


echo "Usage:"
echo " bf_mon.sh start <WLAN_DRV> <NIC> <LOCAL_MAC> <REMOTE_MAC> <BW:20/40/80> <ACK_TIMEOUT:33~255> <INTERVAL:s>"
echo " bf_mon.sh stop <WLAN_DRV> <NIC>"
echo ""
echo "e.g. "
echo " bf_mon.sh start rtl88x2eu wlan0 00:11:22:33:44:55 00:66:77:88:99:ab 20 255 0.1"
echo " bf_mon.sh stop rtl88x2eu wlan0"
4 changes: 4 additions & 0 deletions general/package/wifibroadcast/files/wfb_drone.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ dis_cca=0
edcca_thresh_override_en=0
edcca_thresh_override=-40
tx_npath=0
bf_en=0
bf_remote_mac=00:11:22:33:44:55
bf_ackto=100
bf_interval=0.1

12 changes: 12 additions & 0 deletions general/package/wifibroadcast/files/wifibroadcast
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ load_interface() {
;;
esac
fi
if [ "$driver" = "88x2cu" ] || [ "$driver" = "8812eu" ]; then
if [ "$bf_mon_en" -eq 1 ]; then
bf_local_mac=$(iw "$wlan" info|grep addr|cut -d " " -f 2)
if [ "$driver" = "88x2cu" ]; then
driver_path=rtl88x2cu
elif [ "$driver" = "8812eu" ]; then
driver_path=rtl88x2eu
fi
bf_mon.sh start "$driver_path" "$wlan" "$bf_local_mac" "$bf_remote_mac" "$bandwidth" "$bf_ackto" "$bf_interval" &
fi
fi
}
start_drone_wfb() {
Expand Down
1 change: 1 addition & 0 deletions general/package/wifibroadcast/wifibroadcast.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ define WIFIBROADCAST_INSTALL_TARGET_CMDS
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(@D)/wfb_tun
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(WIFIBROADCAST_PKGDIR)/files/setmcs
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(WIFIBROADCAST_PKGDIR)/files/wifibroadcast
$(INSTALL) -m 755 -t $(TARGET_DIR)/usr/bin $(WIFIBROADCAST_PKGDIR)/files/bf_mon.sh
endef

$(eval $(generic-package))

0 comments on commit 0bc46b0

Please sign in to comment.