From b2512f0e210fc3f2d1eeeefa7be37a20b9af26ad Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 4 Jan 2023 19:49:18 -0600 Subject: Add WiFi Station/AP mode --- recipes-kernel/rsi-91x/files/onebox_util.sh | 17 +++++++++ recipes-kernel/rsi-91x/files/rs9113.default | 1 + .../rsi-91x/files/rs9113_load_modules.sh | 11 +++--- .../rsi-91x/files/rs9113_remove_modules.sh | 26 +++++++++++++- recipes-kernel/rsi-91x/files/rsi-91x-sta-ap.patch | 40 ++++++++++++++++++++++ recipes-kernel/rsi-91x/rsi-91x-fw_2.5.1.bb | 2 +- recipes-kernel/rsi-91x/rsi-91x-sta-ap_2.5.1.bb | 39 +++++++++++++++++++++ recipes-kernel/rsi-91x/rsi-91x-utils_2.5.1.bb | 2 +- 8 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 recipes-kernel/rsi-91x/files/rsi-91x-sta-ap.patch create mode 100644 recipes-kernel/rsi-91x/rsi-91x-sta-ap_2.5.1.bb diff --git a/recipes-kernel/rsi-91x/files/onebox_util.sh b/recipes-kernel/rsi-91x/files/onebox_util.sh index 5a20d2b..ce40a12 100755 --- a/recipes-kernel/rsi-91x/files/onebox_util.sh +++ b/recipes-kernel/rsi-91x/files/onebox_util.sh @@ -7,12 +7,29 @@ rpine=$1 cmd=$2 interface=$3 +type=$4 + +sta_ap=0 if [[ $cmd == delete_vap ]] ; then ip link set $interface down || exit 0 exit 0 fi +if [[ $(lsmod) =~ [[:space:]]rsi_91x_sta_ap[[:space:]] ]] ; then + sta_ap=1 +fi + +if [[ $cmd == create_vap ]] && [[ $type == ap ]] && ((sta_ap==1)) ; then + ints=$(iw dev | grep Interface) + if (( $(echo "$ints" | wc -l) == 1)) ; then + [[ $ints =~ Interface[[:space:]]+([^[:space:]]*) ]] + int1="${BASH_REMATCH[1]}" + iw dev "$int1" interface add $interface type __ap || exit 0 + exit 0 + fi +fi + if [[ -L /sys/class/net/$interface ]] ; then exit 0 fi diff --git a/recipes-kernel/rsi-91x/files/rs9113.default b/recipes-kernel/rsi-91x/files/rs9113.default index 7111825..bc74cb1 100644 --- a/recipes-kernel/rsi-91x/files/rs9113.default +++ b/recipes-kernel/rsi-91x/files/rs9113.default @@ -11,6 +11,7 @@ RSI_ANTENNA_DIVERSITY=0 # COEX_MODE options: # 1 WLAN STATION or WLAN ACCESS POINT +# 3 WLAN ACCESS POINT + STATION MODE(on multiple vaps) # 4 BT EDR MODE # 5 WLAN STATION + BT EDR MODE # 6 WLAN ACCESS POINT + BT EDR MODE diff --git a/recipes-kernel/rsi-91x/files/rs9113_load_modules.sh b/recipes-kernel/rsi-91x/files/rs9113_load_modules.sh index 3977a5c..db36f0f 100755 --- a/recipes-kernel/rsi-91x/files/rs9113_load_modules.sh +++ b/recipes-kernel/rsi-91x/files/rs9113_load_modules.sh @@ -53,15 +53,11 @@ if (($# > 1)); then fi if ((${#COEX_MODE}==0)) && [[ -r $defaults ]]; then - set -e . $defaults - set +e fi if (($# > 0)) && [[ -r $1 ]]; then - set -e . $1 - set +e fi err=0 @@ -112,7 +108,12 @@ sdiod="rsi_sdio.ko" rsid="rsi_91x.ko" case ${COEX_MODE} in - 1|2|3) + 1|2) + DEV_OPER_MODE=1 + ;; + 3) + rsid="rsi_91x_sta_ap.ko" + usbd="rsi_usb_sta_ap.ko" DEV_OPER_MODE=1 ;; 4) diff --git a/recipes-kernel/rsi-91x/files/rs9113_remove_modules.sh b/recipes-kernel/rsi-91x/files/rs9113_remove_modules.sh index ba65254..606f069 100755 --- a/recipes-kernel/rsi-91x/files/rs9113_remove_modules.sh +++ b/recipes-kernel/rsi-91x/files/rs9113_remove_modules.sh @@ -5,9 +5,33 @@ killall -9 bluetoothd rm -rf /var/run/wpa_supplicant/ sleep 2 +# Find the wifi interfaces +ints=$(find -L /sys/class/net -maxdepth 2 -name phy80211) + +# Remove the links with the ip command. +for phy in $ints ; do + dir=$(dirname $phy) + vap=$(basename $dir) + echo Setting $vap down + logger -p daemon.alert Setting $vap down + ip link set $vap down +done + +# So ifdown is not confused, +# make sure ifup/ifdown is now +# in the down state. +if [[ -x /sbin/ifdown ]] ; then + for phy in $ints ; do + dir=$(dirname $phy) + vap=$(basename $dir) + logger -p daemon.alert ifdown $vap + ifdown $vap + done +fi + modules=" "$(lsmod)" " ### COMMON HAL MODULES -for mod in bnep rfcomm rsi_btsdio rsi_btusb rsi_bt91x rsi_sdio rsi_usb rsi_91x mac80211 cfg80211 bluetooth ; do +for mod in bnep rfcomm rsi_btsdio rsi_btusb rsi_bt91x rsi_sdio rsi_usb rsi_usb_sta_ap rsi_91x_sta_ap rsi_91x mac80211 cfg80211 bluetooth ; do if [[ ${modules} =~ [[:space:]]${mod}[[:space:]] ]] ; then result+=$(rmmod $mod 2>&1) last=$? diff --git a/recipes-kernel/rsi-91x/files/rsi-91x-sta-ap.patch b/recipes-kernel/rsi-91x/files/rsi-91x-sta-ap.patch new file mode 100644 index 0000000..73c3e1b --- /dev/null +++ b/recipes-kernel/rsi-91x/files/rsi-91x-sta-ap.patch @@ -0,0 +1,40 @@ +diff --git a/rsi/Makefile b/rsi/Makefile +index 64f7742..951b7a1 100644 +--- a/rsi/Makefile ++++ b/rsi/Makefile +@@ -57,7 +57,7 @@ KERNELDIR=/lib/modules/$(KERNELRELEASE)/build + #CONFIG_RSI_P2P=y + + # Uncomment below line for using Concurrent mode +-#CONFIG_STA_PLUS_AP=y ++CONFIG_STA_PLUS_AP=y + + # Uncomment below line for platforms with no SDIO multiblock support + #CONFIG_RSI_NO_SDIO_MULTIBLOCK=y +@@ -190,16 +190,21 @@ ifeq ($(OFFLOAD_SCAN_TO_DEVICE), y) + EXTRA_CFLAGS += -DOFFLOAD_SCAN_TO_DEVICE + endif + +-obj-m := rsi_sdio.o rsi_usb.o rsi_91x.o ++obj-m := rsi_sdio.o rsi_usb_sta_ap.o rsi_91x_sta_ap.o + rsi_sdio-objs := $(COMMON_SDIO_OBJS) +-rsi_usb-objs := $(COMMON_USB_OBJS) +-rsi_91x-objs := $(RSI_91X_OBJS) ++rsi_usb_sta_ap-objs := $(COMMON_USB_OBJS) ++rsi_91x_sta_ap-objs := $(RSI_91X_OBJS) + + all: ++ @echo env is: ++ env + @echo -e "\033[32mCompiling RSI drivers...\033[0m" + make -C$(KERNELDIR)/ M=$(PWD) modules +- @echo -e "application compilation" +- make CC="$(CC)" ROOT_DIR=$(ROOT_DIR) -C $(PWD)/apps ++ # @echo -e "application compilation" ++ # make CC="$(CC)" ROOT_DIR=$(ROOT_DIR) -C $(PWD)/apps ++ ++modules_install: ++ $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install + + clean: + make -C$(KERNELDIR)/ M=$(PWD) clean diff --git a/recipes-kernel/rsi-91x/rsi-91x-fw_2.5.1.bb b/recipes-kernel/rsi-91x/rsi-91x-fw_2.5.1.bb index eb5b6eb..19dca25 100644 --- a/recipes-kernel/rsi-91x/rsi-91x-fw_2.5.1.bb +++ b/recipes-kernel/rsi-91x/rsi-91x-fw_2.5.1.bb @@ -1,6 +1,6 @@ LIC_FILES_CHKSUM = "file://${WORKDIR}/git/rsi/Makefile;beginline=1;endline=29;md5=5eb8ffe925477437d8fcd5e2859c96a1" LICENSE = "BSD-3-Clause" -PR = "r2" +PR = "r3" inherit allarch inherit update-rc.d diff --git a/recipes-kernel/rsi-91x/rsi-91x-sta-ap_2.5.1.bb b/recipes-kernel/rsi-91x/rsi-91x-sta-ap_2.5.1.bb new file mode 100644 index 0000000..56c2de6 --- /dev/null +++ b/recipes-kernel/rsi-91x/rsi-91x-sta-ap_2.5.1.bb @@ -0,0 +1,39 @@ +LICENSE = "GPLv2+|BSD" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +PR = "r1" +PKGR = "${PR}${KERNEL_MODULE_PACKAGE_SUFFIX}${EXTENDPRAUTO}" +RPROVIDES_kernel-module-${PN} = "${PN}" +inherit module + +SRCREV = "v${PV}" +SRC_URI = "git://github.com/SiliconLabs/RS911X-nLink-OSD.git;protocol=https \ + file://rsi-91x-sta-ap.patch;striplevel=2 \ + file://0001_concurrent_compilation_fix.patch \ + file://0002-fix-rsi_handle_card_ready-card-ready.patch \ + " +S = "${WORKDIR}/git/rsi" + +EXTRA_OEMAKE = " KERNELDIR=${STAGING_KERNEL_DIR} \ + CROSS_COMPILE=${TARGET_PREFIX} \ + ARCH=arm \ + WLAN_COMPILE_FLAGS='' \ + V=1 \ + " + +PARALLEL_MAKE = "" +PACKAGES = "kernel-module-${PN} \ + kernel-module-rsi-usb-sta-ap \ + ${PN}-dev \ + ${PN}-dbg \ +" +INSTDIR = "/opt/rs9113/modules" +FILES_kernel-module-${PN} = "${INSTDIR}/rsi_91x_sta_ap.ko" +FILES_kernel-module-rsi-usb-sta-ap = "${INSTDIR}/rsi_usb_sta_ap.ko" + +do_install() { + instdir="${D}/opt/rs9113/modules" + install -m 0755 -d "${instdir}" + # use cp instead of install so the driver doesn't get stripped + cp ${S}/rsi_91x_sta_ap.ko "${instdir}" + cp ${S}/rsi_usb_sta_ap.ko "${instdir}" +} diff --git a/recipes-kernel/rsi-91x/rsi-91x-utils_2.5.1.bb b/recipes-kernel/rsi-91x/rsi-91x-utils_2.5.1.bb index f43d2d7..49cb4d2 100644 --- a/recipes-kernel/rsi-91x/rsi-91x-utils_2.5.1.bb +++ b/recipes-kernel/rsi-91x/rsi-91x-utils_2.5.1.bb @@ -1,6 +1,6 @@ LIC_FILES_CHKSUM = "file://${WORKDIR}/git/rsi/apps/onebox_util.c;beginline=5;endline=17;md5=de9e3b7d092ee142ef090acc79db39c1" LICENSE = "CLOSED" -PR = "r1" +PR = "r2" RDEPENDS_${PN} += "bash" -- cgit v1.2.3