diff --git a/luckfox-sdk-patches/board/patches/0008-usb-gadget-compose-once.patch b/luckfox-sdk-patches/board/patches/0008-usb-gadget-compose-once.patch index 5793027..efe05b0 100644 --- a/luckfox-sdk-patches/board/patches/0008-usb-gadget-compose-once.patch +++ b/luckfox-sdk-patches/board/patches/0008-usb-gadget-compose-once.patch @@ -20,14 +20,25 @@ host loses usb0 and ttyACM0 and the halt times out (issue #145). UAC1_EN=off UAC2_EN=off UVC_EN=off -@@ -73,6 +79,24 @@ +@@ -73,6 +79,46 @@ mkdir ${USB_FUNCTIONS_DIR}/hid.usb0 } -+# flare-edge: the stable, serial-derived RNDIS MAC, applied BEFORE the gadget -+# is bound. S51usbmac used to set this afterwards, which meant tearing down a -+# live gadget purely to change two strings (issue #145). It still runs and is -+# now a no-op that confirms the result. ++# flare-edge: the stable, serial-derived RNDIS MAC. MUST be applied before ++# bind_functions links rndis.gs0 into the config, NOT merely before the UDC ++# bind: rndis_alloc() runs at link time, takes opts->refcnt and immediately ++# captures the MAC via gether_get_host_addr_u8(). After that the configfs ++# store returns -EBUSY (u_ether_configfs.h guards on opts->refcnt), so a write ++# here is silently discarded and the gadget enumerates with the kernel's ++# random MAC (issue #157). ++# ++# S51usbmac used to repair that afterwards by tearing down a live gadget purely ++# to change two strings (issue #145), which is the second enumeration a host ++# sees on every boot. It still runs and is now a no-op that confirms the result. ++# ++# The writes are checked. Losing the stable MAC is not fatal, so this does not ++# abort the boot, but it must never fail silently again: silence is exactly how ++# #157 survived. +flare_stamp_rndis_mac() +{ + RN=${USB_FUNCTIONS_DIR}/rndis.gs0 @@ -38,8 +49,19 @@ host loses usb0 and ttyACM0 and the halt times out (issue #145). + A=$(echo "$H" | cut -c1-2); B=$(echo "$H" | cut -c3-4) + C=$(echo "$H" | cut -c5-6); D=$(echo "$H" | cut -c7-8) + E=$(echo "$H" | cut -c9-10) -+ echo "02:$A:$B:$C:$D:$E" > "$RN/host_addr" 2>/dev/null -+ echo "06:$A:$B:$C:$D:$E" > "$RN/dev_addr" 2>/dev/null ++ WANT="02:$A:$B:$C:$D:$E" ++ # Already ours: S26usbhost re-runs this script on a role switch, and the ++ # second run finds configfs present, so configfs_init is skipped and the ++ # function is still linked from the first run. The MAC was set correctly ++ # then, so writing it again would be refused with -EBUSY and warn about a ++ # random MAC that is not in use. Nothing to do, and nothing to report. ++ [ "$(cat "$RN/host_addr" 2>/dev/null)" = "$WANT" ] && return 0 ++ if ! echo "$WANT" > "$RN/host_addr" 2>/dev/null; then ++ echo "S50usbdevice: rndis host_addr write refused and the MAC is NOT already correct; the function is linked, so the gadget will use a random MAC (#157)" > /dev/kmsg 2>/dev/null ++ return 1 ++ fi ++ echo "06:$A:$B:$C:$D:$E" > "$RN/dev_addr" 2>/dev/null || ++ echo "S50usbdevice: rndis dev_addr write refused (#157)" > /dev/kmsg 2>/dev/null +} + configfs_init() @@ -48,8 +70,8 @@ host loses usb0 and ttyACM0 and the halt times out (issue #145). @@ -426,6 +450,7 @@ use_os_desc echo $PID > ${USB_CONFIGFS_DIR}/idProduct - bind_functions + flare_stamp_rndis_mac + bind_functions pre_run_binary sleep 1 UDC=`ls /sys/class/udc/| awk '{print $1}'` diff --git a/luckfox-sdk-patches/uboot/patches/0003-flare-ab-slots.patch b/luckfox-sdk-patches/uboot/patches/0003-flare-ab-slots.patch index 8a2afda..2b3a3ef 100644 --- a/luckfox-sdk-patches/uboot/patches/0003-flare-ab-slots.patch +++ b/luckfox-sdk-patches/uboot/patches/0003-flare-ab-slots.patch @@ -931,7 +931,7 @@ diff --git a/sysdrv/source/uboot/u-boot/arch/arm/mach-rockchip/board.c b/sysdrv/ +#endif #include #include -@@ -1340,8 +1343,18 @@ +@@ -1340,9 +1343,19 @@ static void bootargs_add_android(bool verbose) { #ifdef CONFIG_ANDROID_AB diff --git a/luckfox-sdk-patches/wifi/patches/0003-aic8800dc-disable-he.patch b/luckfox-sdk-patches/wifi/patches/0003-aic8800dc-disable-he.patch new file mode 100644 index 0000000..17de7d1 --- /dev/null +++ b/luckfox-sdk-patches/wifi/patches/0003-aic8800dc-disable-he.patch @@ -0,0 +1,59 @@ +diff --git a/sysdrv/drv_ko/wifi/insmod_wifi.sh b/sysdrv/drv_ko/wifi/insmod_wifi.sh +--- a/sysdrv/drv_ko/wifi/insmod_wifi.sh ++++ b/sysdrv/drv_ko/wifi/insmod_wifi.sh +@@ -33,7 +33,26 @@ + if [ $? -eq 0 ]; then + insmod cfg80211.ko + insmod aic_load_fw.ko aic_fw_path=/oem/usr/ko/ +- insmod aic8800_fdrv.ko ++ # flare-edge: he_on=0 -- do NOT let this radio negotiate 802.11ax (HE). ++ # ++ # The AIC8800DC associates fine in HE and negotiates high HE-MCS rates, then ++ # silently loses the unicast path while every local indicator still reads ++ # healthy (wpa_state=COMPLETED, carrier 1, lease BOUND, strong signal). Only ++ # beacons and broadcast keep arriving. See flare-edge issue #156. ++ # ++ # Measured on warden-c8a3 against an 802.11ax AP: with HE on, the driver ++ # deinit/reconnect cycle fired every ~965 s indefinitely ++ # ("deinit:macaddr" -> "rwnx_send_sm_connect_req", 154 times in 2.8 days). ++ # he_on=0 makes the chip advertise HT/VHT only (phy reports "HE supp 0") and ++ # the cycle stops. ++ # ++ # This costs Wi-Fi 6 rates, which the radio was never actually delivering ++ # usable throughput at anyway, and costs no compatibility: 802.11ax APs serve ++ # n/ac clients normally, so the panel still joins modern networks. ++ # ++ # Remove only when the HE path is actually fixed in the driver or the AIC ++ # firmware blob, and re-verify with a multi-hour soak against an ax AP. ++ insmod aic8800_fdrv.ko he_on=0 + insmod bcmdhd.ko + fi + +@@ -117,7 +136,26 @@ + insmod aes_generic.ko + insmod aic8800_bsp.ko + sleep 0.2 +- insmod aic8800_fdrv.ko ++ # flare-edge: he_on=0 -- do NOT let this radio negotiate 802.11ax (HE). ++ # ++ # The AIC8800DC associates fine in HE and negotiates high HE-MCS rates, then ++ # silently loses the unicast path while every local indicator still reads ++ # healthy (wpa_state=COMPLETED, carrier 1, lease BOUND, strong signal). Only ++ # beacons and broadcast keep arriving. See flare-edge issue #156. ++ # ++ # Measured on warden-c8a3 against an 802.11ax AP: with HE on, the driver ++ # deinit/reconnect cycle fired every ~965 s indefinitely ++ # ("deinit:macaddr" -> "rwnx_send_sm_connect_req", 154 times in 2.8 days). ++ # he_on=0 makes the chip advertise HT/VHT only (phy reports "HE supp 0") and ++ # the cycle stops. ++ # ++ # This costs Wi-Fi 6 rates, which the radio was never actually delivering ++ # usable throughput at anyway, and costs no compatibility: 802.11ax APs serve ++ # n/ac clients normally, so the panel still joins modern networks. ++ # ++ # Remove only when the HE path is actually fixed in the driver or the AIC ++ # firmware blob, and re-verify with a multi-hour soak against an ax AP. ++ insmod aic8800_fdrv.ko he_on=0 + sleep 2 + insmod aic8800_btlpm.ko + sleep 0.1