From 6c452ecab5e4490241aa5850f610767a845b919d Mon Sep 17 00:00:00 2001 From: libc0607 Date: Sat, 27 Apr 2024 19:03:19 +0800 Subject: [PATCH] Add RTL8733BU FPV driver & wifibroadcast script support for FPV --- general/package/Config.in | 1 + .../0001-fix-extra-cflags.patch | 11 +++++++++ .../package/rtl8733bu-openipc-fpv/Config.in | 16 +++++++++++++ .../rtl8733bu-openipc-fpv.mk | 24 +++++++++++++++++++ .../package/wifibroadcast/files/wifibroadcast | 7 +++++- 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 general/package/rtl8733bu-openipc-fpv/0001-fix-extra-cflags.patch create mode 100644 general/package/rtl8733bu-openipc-fpv/Config.in create mode 100644 general/package/rtl8733bu-openipc-fpv/rtl8733bu-openipc-fpv.mk diff --git a/general/package/Config.in b/general/package/Config.in index 3bd3de867..78755260e 100644 --- a/general/package/Config.in +++ b/general/package/Config.in @@ -87,6 +87,7 @@ source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8189es-openipc/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8189fs-openipc/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8192eu-openipc/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8733bu-openipc/Config.in" +source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8733bu-openipc-fpv/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/rtl8812au-openipc/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/rtw-hostapd/Config.in" source "$BR2_EXTERNAL_GENERAL_PATH/package/rubyfpv/Config.in" diff --git a/general/package/rtl8733bu-openipc-fpv/0001-fix-extra-cflags.patch b/general/package/rtl8733bu-openipc-fpv/0001-fix-extra-cflags.patch new file mode 100644 index 000000000..4dd1de6f1 --- /dev/null +++ b/general/package/rtl8733bu-openipc-fpv/0001-fix-extra-cflags.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,7 @@ + EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) +-EXTRA_CFLAGS += -O1 ++EXTRA_CFLAGS += -Os + #EXTRA_CFLAGS += -O3 ++EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT + #EXTRA_CFLAGS += -Wall + #EXTRA_CFLAGS += -Wextra + #EXTRA_CFLAGS += -Werror diff --git a/general/package/rtl8733bu-openipc-fpv/Config.in b/general/package/rtl8733bu-openipc-fpv/Config.in new file mode 100644 index 000000000..2bd1bc5c6 --- /dev/null +++ b/general/package/rtl8733bu-openipc-fpv/Config.in @@ -0,0 +1,16 @@ +config BR2_PACKAGE_RTL8733BU_OPENIPC_FPV + bool "rtl8733bu-openipc-fpv" + depends on BR2_LINUX_KERNEL + help + A standalone driver for the RTL8733BU Dual Band + USB Wi-Fi adapter. + + Make sure your target kernel has the CONFIG_WIRELESS_EXT + config option enabled. + + Note: this package needs a firmware loading mechanism to + load the binary blob for the chip to work. + + +comment "rtl8733bu needs a Linux kernel to be built" + depends on !BR2_LINUX_KERNEL diff --git a/general/package/rtl8733bu-openipc-fpv/rtl8733bu-openipc-fpv.mk b/general/package/rtl8733bu-openipc-fpv/rtl8733bu-openipc-fpv.mk new file mode 100644 index 000000000..1193258f6 --- /dev/null +++ b/general/package/rtl8733bu-openipc-fpv/rtl8733bu-openipc-fpv.mk @@ -0,0 +1,24 @@ +################################################################################ +# +# rtl8733bu-openipc-fpv +# +################################################################################ + +ifeq ($(LOCAL_DOWNLOAD),y) +RTL8733BU_OPENIPC_FPV_SITE_METHOD = git +RTL8733BU_OPENIPC_FPV_SITE = https://github.com/libc0607/rtl8733bu-20230626 +RTL8733BU_OPENIPC_FPV_VERSION = $(shell git ls-remote $(RTL8733BU_OPENIPC_FPV_SITE) HEAD | head -1 | cut -f1) +else +RTL8733BU_OPENIPC_FPV_SITE = https://github.com/libc0607/rtl8733bu-20230626/archive +RTL8733BU_OPENIPC_FPV_SOURCE = master.tar.gz +endif + +RTL8733BU_OPENIPC_FPV_LICENSE = GPL-2.0 +RTL8733BU_OPENIPC_FPV_LICENSE_FILES = COPYING + +RTL8733BU_OPENIPC_FPV_MODULE_MAKE_OPTS = CONFIG_RTL8733BU=m \ + KVER=$(LINUX_VERSION_PROBED) \ + KSRC=$(LINUX_DIR) + +$(eval $(kernel-module)) +$(eval $(generic-package)) diff --git a/general/package/wifibroadcast/files/wifibroadcast b/general/package/wifibroadcast/files/wifibroadcast index 8a61770a9..cb89c4add 100755 --- a/general/package/wifibroadcast/files/wifibroadcast +++ b/general/package/wifibroadcast/files/wifibroadcast @@ -43,6 +43,11 @@ detect_wifi_card() { driver="realtek_8812eu" modprobe 8812eu rtw_regd_src=1 rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 ;; + + "0bda:f72b") + driver="realtek_8733bu" + modprobe 8733bu rtw_regd_src=1 rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 + ;; "0cf3:9271" | "040d:3801") driver="atheros" @@ -83,7 +88,7 @@ load_interface() { if [ "$driver" = "realtek" ]; then ifconfig "$wlan" up iwconfig "$wlan" mode monitor - elif [ "$driver" = "realtek_8812eu" ]; then + elif [ "$driver" = "realtek_8812eu" ] || [ "$driver" = "realtek_8733bu" ]; then ifconfig "$wlan" up iwconfig "$wlan" mode monitor iw dev "$wlan" set txpower fixed $((driver_txpower_override * 50))