Phone AP not in wifi scan results -- AOSP

Hi @Loic

I seem to be experiencing this issue that you fixed for hikey960/wilink8: Wifi does not connect to the router/phone hotspot with AOSP prebuilt image

But I’m now having this problem with db820c.

I kind of understand, superficially, what your patch does wlcore: Set rx_status boottime_ns field on rx - Patchwork – but I’m not sure where or how to add something like that to ath10k.

I made this change in Android and it “kind of” works;

diff --git a/service/java/com/android/server/wifi/scanner/ b/service/java/com/android/server/wifi/scanner/
index e3bd207df..f1befb206 100644
--- a/service/java/com/android/server/wifi/scanner/
+++ b/service/java/com/android/server/wifi/scanner/
@@ -379,14 +379,14 @@ public class WificondScannerImpl extends WifiScannerImpl implements Handler.Call
             for (int i = 0; i < mNativeScanResults.size(); ++i) {
                 ScanResult result = mNativeScanResults.get(i).getScanResult();
                 long timestamp_ms = result.timestamp / 1000; // convert us -> ms
-                if (timestamp_ms > mLastScanSettings.startTime) {
+                //if (timestamp_ms > mLastScanSettings.startTime) {
                     if (mLastScanSettings.singleScanFreqs.containsChannel(
                                     result.frequency)) {
-                } else {
-                    numFilteredScanResults++;
-                }
+                //} else {
+                //    numFilteredScanResults++;
+                //}
             if (numFilteredScanResults != 0) {
                 Log.d(TAG, "Filtering out " + numFilteredScanResults + " scan results.");

By “kind of” I mean that it doesn’t fix the scan results that are shown, but if the network is already saved, it will let it connect to the network anyway.

hi @doitright, maybe something like this:

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index b8a4bbf..1480fcc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2610,6 +2610,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
        if (ieee80211_is_beacon(hdr->frame_control))
                ath10k_mac_handle_beacon(ar, skb);

+       if (ieee80211_is_beacon(hdr->frame_control) ||
+           ieee80211_is_probe_resp(hdr->frame_control))
+               status->boottime_ns = ktime_get_boot_ns();
        ath10k_dbg(ar, ATH10K_DBG_MGMT,
                   "event mgmt rx skb %pK len %d ftype %02x stype %02x\n",
                   skb, skb->len,

Not sure why it would only affect your specific phone AP though.

Thanks @Loic! I’ll give that a shot.

Its not a specific phone that it affects. I’ve tried with two phones (Nexus 6 running AOSP11, Pixel 2XL running AOSP 10 or 11). The symptoms are exactly like that hikey960 thread where you provided a fix before. If the AP is on before the db820c boots up, everything works. If the AP is switched on later, it doesn’t appear in the Android scan, but does appear in iw wlan0 scan

It seems to work, with one very minor change;

That line should read;
status->boottime_ns = ktime_get_boottime_ns();

(because of commit:
kernel/git/stable/linux.git - Linux kernel stable tree)

Thank you so much @Loic !

1 Like