bcm43430_a1

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EvSt_281971
Level 2
Level 2
First like received First like given

Hi..

i'm use cypress backport driver brcmfmac and firmware (from 05.19) with my kernel (3.10 on samsung a310f) and lineage 7.1 (nogat)

With some kernel editing - now wifi working good but i'm have only 1 problem and cant find fix - after power up wifi or power up phone - wifi cant connect to saved networks but in network list - i'm see "saved" on wifi ssid..

I'm try use clearly wpa_supplicant 2.6 and patching with cypress patches - didnt help.

if i'm delete all files in /data/misc/wifi/* , restart phone and connect to some ssid - in /data/misc/wifi/wpa_supplicant.conf i'm see new network but with string "disabled=1". If i'm remove this string - didnt help fix autoconnect...

Where maybe problem - please help me understand...

0 Likes
1 Solution

I think you are seeing the same thing I saw at one point. This is what I found:

fmac based radios will not reconnect due to scan data being discarded, due to an invalid timestamp comparison implemented in the Android framework.

Android is doing an invalid timestamp check using the BSS TSF (from beacon and probe responses) against the real time of the Android device.  Even worse, the fmac driver always passes zero(0) as the BSS TSF to cfg80211_inform_bss().

Reference on where to find the fault in the Android framework:

See frameworks/base/wifi/java/android/net/wifi/ScanResult.java, where timestamp is initialized using the BSS tsf in several places.

For example:

  this.timestamp = tsf;

See frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java.

The comparison code that is invalid is:

     ScanResult result = nativeResults.get(i).getScanResult();

     long timestamp_ms = result.timestamp / 1000; // convert us -> ms

     if (timestamp_ms > mLastScanSettings.startTime) {

          // <snip> code adds the ScanResult

           …

     } else {

          // was a cached result in wpa_supplicant

          // code doesn’t add the ScanResult – discarded as stale

     }

The mLastScanSettings.startTime get set in the LastScanSettings constructor function, also in SupplicantWifiScannerImpl.java:

     private static class LastScanSettings {

          public long startTime;

     public LastScanSettings(long startTime) {

          this.startTime = startTime;

     }

I brought this to the attention of google here:

https://issuetracker.google.com/issues/119027641

Google refuses to see it as a bug.  I worked around it by always returning maxint in cfg80211_inform_bss_data call so that the comparison in the Android Java code will not toss the scan data:

b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 5032db7..e5e2331 100644 
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -2894,7 +2894,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
               bss = cfg80211_inform_bss(wiphy, notify_channel,
                                         CFG80211_BSS_FTYPE_UNKNOWN,
                                         (const u8 *)bi->BSSID,
-                                        0, notify_capability,
+                                        (u64)(0x7FFFFFFFFFFFFFFFLL), notify_capability, notify_interval, notify_ie, notify_ielen, notify_signal, GFP_KERNEL);

Try that and see if it resolves your issue.

View solution in original post

15 Replies
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

hello:

need your help to provide supplicant log , and better fmac log also.

supplicant log should be added  -dd to enable more logs.

Fmac driver has a debug option when do bringing up  like:

insmod  brcmfmac.ko debug = 0x120000e

lock attach
Attachments are accessible only for community members.

This is log from booted phone (before reboot - connected to ssid "kvant-telecom"

/data/misc/wifi/wpa_supplicant.conf:

disable_scan_offload=1

driver_param=use_p2p_group_interface=1

update_config=1

device_name=lineage_a3xeltexx

manufacturer=samsung

model_name=SM-A310F

model_number=SM-A310F

serial_number=3100cb2ce7463291

device_type=10-0050F204-5

config_methods=physical_display virtual_push_button

p2p_listen_reg_class=81

p2p_listen_channel=1

p2p_oper_reg_class=124

p2p_oper_channel=149

p2p_add_cli_chan=1

p2p_disabled=1

ip_addr_go=192.168.49.1

ip_addr_mask=255.255.255.0

ip_addr_start=192.168.49.200

ip_addr_end=192.168.49.254

external_sim=1

tdls_external_control=1

network={

        ssid="KVANT-TELECOM"

        psk="kvant-ub"

        key_mgmt=WPA-PSK

        priority=1

        disabled=1

        id_str="%7B%22creatorUid%22%3A%221000%22%2C%22configKey%22%3A%22%5C%22KVANT-TELECOM%5C%22WPA_PSK%22%7D"

}

0 Likes

I am glad to hear that you are succeed in adding the 43430_a1 to the kernel low than 4.1+, i am dealing with a project with kernel 3.18.y to add the AP6212, these days i had find many informations and some source code,but i find the driver cant compile in the kernel 3.18.y.Can you give me some help?

0 Likes

hello:

    I think you need to have a debug why disabled was set here.   From what i Know if disabled=1 , it can't be reconnected according the mechanism.

09-03 09:21:12.841  3000  3000 D wpa_supplicant: priority=1 (0x1)

09-03 09:21:12.841  3000  3000 D wpa_supplicant: disabled=1 (0x1)

09-03 09:21:12.841  3000  3000 D wpa_supplicant: id_str - hexdump(len=94): 25 37 42 25 32 32 63 72 65 61 74 6f 72 55 69 64 25 32 32 25 33 41 25 32 32 31 30 30 30 25 32 32 ...

09-03 09:21:12.927  3000  3000 D wpa_supplicant: PSK (from passphrase) - hexdump(len=32): [REMOVED]

09-03 09:21:12.927  3000  3000 D wpa_supplicant: Priority group 1

09-03 09:21:12.927  3000  3000 D wpa_supplicant:    id=0 ssid='KVANT-TELECOM'

0 Likes

i'm try research who in android make this flag - but cant find now.. And why wifi framework dont enable this network when i'm connecting manual.

And if i'm remove this flag in wpa_supplicant.conf - this not help - no autoconnect...

All this strange, because with stock bcmdhd and cfg80211 - all working good...

em, I think need more logs when you switch on/off the wifi menu ,  try to catch the reconnect process and find if there exists an error message.

0 Likes

from

frameworks/opt/net/wifi/service/java/com/android/server/wifi/WifiQualifiedNetworkSelector.java

i'm find function -

    public WifiConfiguration selectQualifiedNetwork(boolean forceSelectNetwork,

            boolean isUntrustedConnectionsAllowed, List<ScanDetail>  scanDetails,

            boolean isLinkDebouncing, boolean isConnected, boolean isDisconnected,

            boolean isSupplicantTransient) {

        localLog("==========start qualified Network Selection==========");

        mScanDetails = scanDetails;

        List<Pair<ScanDetail, WifiConfiguration>>  filteredScanDetails = new ArrayList<>();

        if (mCurrentConnectedNetwork == null) {

            mCurrentConnectedNetwork =

                    mWifiConfigManager.getWifiConfiguration(mWifiInfo.getNetworkId());

        }

        // Always get the current BSSID from WifiInfo in case that firmware initiated roaming

        // happened.

        mCurrentBssid = mWifiInfo.getBSSID();

        if (!forceSelectNetwork && !needQualifiedNetworkSelection(isLinkDebouncing, isConnected,

                isDisconnected, isSupplicantTransient)) {

            localLog("Quit qualified Network Selection since it is not forced and current network"

                    + " is qualified already");

            mFilteredScanDetails = filteredScanDetails;

            return null;

        }

i'm see that this block run function needQualifiedNetworkSelection

but from logcat i'm see this:

09-03 11:50:32.949  2556  2628 D WifiQualifiedNetworkSelector:: ==========start qualified Network Selection==========: system_server

09-03 11:50:32.951  2556  2628 D WifiQualifiedNetworkSelector:: empty scan result: system_server

09-03 11:50:32.952  2556  2628 D WifiQualifiedNetworkSelector:: Quit qualified Network Selection since it is not forced and current network is qualified already: system_server

This mean that selectQualifiedNetwork always getting variable scanDetails with 0 results... I'm think this problem maybe.. No other errors i'm find...

0 Likes

I think you are seeing the same thing I saw at one point. This is what I found:

fmac based radios will not reconnect due to scan data being discarded, due to an invalid timestamp comparison implemented in the Android framework.

Android is doing an invalid timestamp check using the BSS TSF (from beacon and probe responses) against the real time of the Android device.  Even worse, the fmac driver always passes zero(0) as the BSS TSF to cfg80211_inform_bss().

Reference on where to find the fault in the Android framework:

See frameworks/base/wifi/java/android/net/wifi/ScanResult.java, where timestamp is initialized using the BSS tsf in several places.

For example:

  this.timestamp = tsf;

See frameworks/opt/net/wifi/service/java/com/android/server/wifi/scanner/SupplicantWifiScannerImpl.java.

The comparison code that is invalid is:

     ScanResult result = nativeResults.get(i).getScanResult();

     long timestamp_ms = result.timestamp / 1000; // convert us -> ms

     if (timestamp_ms > mLastScanSettings.startTime) {

          // <snip> code adds the ScanResult

           …

     } else {

          // was a cached result in wpa_supplicant

          // code doesn’t add the ScanResult – discarded as stale

     }

The mLastScanSettings.startTime get set in the LastScanSettings constructor function, also in SupplicantWifiScannerImpl.java:

     private static class LastScanSettings {

          public long startTime;

     public LastScanSettings(long startTime) {

          this.startTime = startTime;

     }

I brought this to the attention of google here:

https://issuetracker.google.com/issues/119027641

Google refuses to see it as a bug.  I worked around it by always returning maxint in cfg80211_inform_bss_data call so that the comparison in the Android Java code will not toss the scan data:

b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 5032db7..e5e2331 100644 
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -2894,7 +2894,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
               bss = cfg80211_inform_bss(wiphy, notify_channel,
                                         CFG80211_BSS_FTYPE_UNKNOWN,
                                         (const u8 *)bi->BSSID,
-                                        0, notify_capability,
+                                        (u64)(0x7FFFFFFFFFFFFFFFLL), notify_capability, notify_interval, notify_ie, notify_ielen, notify_signal, GFP_KERNEL);

Try that and see if it resolves your issue.

WOW

Yes this help me - very thank..

This related to android 7 ? this mean that only bcmdhd drivers properly works with android not mainlined fmac... 

0 Likes
lock attach
Attachments are accessible only for community members.

i'm make proper patch for this fix:

0 Likes

yes, thanks a lot for your detailed instructions and share .

0 Likes

hello,can you help me with this problen?

yes i use the bsp from cypress website(cypress-firmware-v4.14.77-2019_0503),in the package i find the brcmfmac43430-sdio.bin but i cant find brcmfmac43430-sdio.txt, so i download another txt from internet and then i got the log:

brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43430-sdio.bin for chip 0x00a9a6(43430) rev 0x000001

brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: May  2 2019 02:39:18 version 7.45.98.83 (r714225 CY) FWID 01-e539531f

and then there is no messages more , i dont know what happenned.is that means i got a wrong bin file?

0 Likes

and ? i'm see no errors.

try -

ifconfig -a

show wlan0?

0 Likes
lida_4439816
Level 2
Level 2

for these are no more messages, i think the bin file are fail to loader, ifconfig -a show no wlan0.maybe i got a wrong .bin file and .txt file

0 Likes
lida_4439816
Level 2
Level 2

sorry, i make a mistake, i try ifconfig -a momemt ago , and i find the wlan0, but if i config it ifconfig wlan0 up, my borad will get lose power.

0 Likes