Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] WiFi Scanning is not working on some models/WiFi Chip Revisions #33

Open
ananjaser1211 opened this issue Aug 9, 2023 · 10 comments
Labels
bug Something isn't working Fixed in next release Bug has been resolved and will be shipped with the next release High Priority Critical BUG

Comments

@ananjaser1211
Copy link
Member

Describe the bug
Multiple N910C/N910H Models face an issue with WiFi where the WiFi is ON, but does not show any networks.
The only way to scan is by disabling SIM or setting the device to airplane mode

Workaround
Current workarounds are the following :

1- Turn on airplane mode
2- restart the phone
3- connect to WiFi network
4- disable the airplane mode

The issue will return when WiFi disconnects

Another workaround is not using SIMCard, obviously not ideal.

Smartphone model (please complete the following information):

  • Unclear if all models are affected, so far two N910C and N910H devices have the issue

Additional context

  • My suspicion is that the issue is related to a certain WiFi chip revision that does not work properly with the new bcmdhd_a3 wifi driver we use in our kernel universal5433/android_kernel_samsung_universal5433@9651661
  • I dont remember why i did this, and not sure if its relevant or not to the problem, logs would be ideal to figure out if those affected devices use a different revision as opposed to my N910C device
  • Both users who reported the issue use middle eastern models (XSG in particular, the same model i use)
@ananjaser1211 ananjaser1211 added bug Something isn't working High Priority Critical BUG labels Aug 9, 2023
@godzellax
Copy link

Hi Sir,
I will provide the log asap
Thank you Sir so much

@godzellax
Copy link

@
log_ball.zip
Here we go Sir. I hope the log will be useful and lead to fix the issue once and for all.
I tried to cover all scenarios while recording the log, switch on/off WiFi and airplane mode one after another.
God bless you, I'm not a developer but I'm sure the issue is not easy to fix but I hope you will be our hero and fix it.

P.S I'm ready to help at any time, thanks.

@ananjaser1211
Copy link
Member Author

I might have found the coloration between your issue and the other person on telegram, both use syrian revision (possibly the wifi chip gatherers it from Mobile network)

It seems that the ROM sends a request to to set the country to SY

08-10 00:14:38.953 16670 16670 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=SY

08-10 00:14:39.020     0     0 I         : [c3] WLDEV-INFO) wldev_set_country: Current country SY rev 0

08-10 00:14:39.021     0     0 W [c1] wl_android_priv_cmd: fccpwrlimit2g is deactivated

08-10 00:14:38.960  4824  5809 D WifiCountryCode: Succeeded to set country code to: SY

On my device however, it sets to WLDEV-INFO) wldev_set_country: set country for AE as AE rev 6

i dont know exactly what this revision entails, but it seems to be something to do with TX/RX Power regulation,

Anyway, after that we get this error

08-10 00:15:34.861  4300  4300 D WifiHAL : Start get packet fate command

08-10 00:15:34.862  4300  4300 D WifiHAL : createRequest Monitor packet fate request

08-10 00:15:34.862  4300  4300 E WifiHAL : Failed to register get pkt fate response; result = -95

and the wifi chip restarts, and so on and so fourth,

I think, when the region is set to SY, it disables packet filtering, which seems to be required by the ROM , and thus errors out wifi when a sim is installed or ccode=SY

08-10 00:15:34.959     0     0 W [c6] dhd_wl_ioctl: WLC_SET_VAR: pkt_filter_add, ret = -2

08-10 00:15:34.959     0     0 W [c6] net_os_enable_packet_filter: val = 1

08-10 00:15:34.960     0     0 W [c6] dhd_set_suspend: Remove extra suspend setting

08-10 00:15:34.960     0     0 W [c6] dhd_enable_packet_filter: enter, value = 0

my device on the other hand reports dhd_enable_packet_filter as 1

this weekend ill wrap my head around the issue, and i think this time i might be able to solve it, hopefully.

Thanks for the very valuable log.

@godzellax
Copy link

godzellax commented Aug 10, 2023

It seems its and issue with the WiFi country code as you suggest, can you check please the following links, I think it might help:

https://stackoverflow.com/questions/2637606/how-do-i-change-the-mobile-country-code-mcc-in-the-android-emulator

https://forum.xda-developers.com/t/app-beta-root-4-wifi-codes-change-country-codes-enable-wireless-channels.1982149/

I found some people taking about finding some custom Roms for their different phones have WiFi advance settings as an option to change WiFi country code, they have the exact issue and confirmed that it is because of the their country block the wifi somehow and they confirmed that they solve it by changing or spoofing the wifi/telephony country code, can you check that Sir.

Screenshot_20230810-183812_Termux

Moreover to above, please note that I changed some wifi prop through commands as you see in attached screenshot but unfortunately didn't help.

@godzellax
Copy link

godzellax commented Aug 10, 2023

Please note that I purchased my mobile from UAE, but I'm being in Syria.
I didn't tried before any custom ROM while I was in UAE so I don't know if WiFi issue will happen only in Syria but at least I know that my phone customized to work in UAE because I purchase it there.
But what you are saying might be true and maybe explain why the issue gone if I remove the sim card.
As suggestion, can we spoof WiFi to think that I'm not in Syria and will it solve the issue.
I cannot imagine the issue because of my country cell network provider! Very weird Sir.
Please help us Sir, you are only our hope in such poor country.

ananjaser1211 added a commit to universal5433/android_kernel_samsung_universal5433 that referenced this issue Aug 10, 2023
* There is a chance that the a3 driver is not properly compatible with our A1 Revision chips
* And is causing WiFi not to properly scan while a sim is inserted (Syrian SIM cars so far)
* This seems to be caused by region setter
* More discussion here universal5433/android_device_samsung_trelte-common#33 (comment)
* The issue is possibly related to DHD_SET_COUNTRY_SUPPORT
@ananjaser1211
Copy link
Member Author

@godzellax Try this kernel
boot_bcmdhd4358.zip

unzip, then flash boot_bcmdhd4358.img in recovery (go to flash > press img > select the file > select BOOT for partition)

with enough luck this might fix the issue, if not please send a new log_ball with the new kernel installed

@godzellax
Copy link

OMG, you did it Sir and ended the nightmare. I believe many people facing the same issue but no one fixed it except you.

Now coming to a new questions, is it a permanent solution? Will it hurt my phone in any way? Will you include the fix in your next stable release?

Would you if you don't mind explain to us the cause of the issue please.

May god bless you and your team,

@godzellax
Copy link

Oops, I forgot that I have to re-root my phone so I though there was an issue. After applying root everything seems to be working fine.
I'll keep using my phone for the next couple days and report anything unusual if any.

@ananjaser1211
Copy link
Member Author

ananjaser1211 commented Aug 10, 2023

@godzellax wow i am equally surprised, here is the problem, very long time ago in 2019 i changed the WiFi driver in the kernel from BCM4358 DHD 1.47.42(Stock) to BCM4358a3 DHD 1.47.61 (The newer driver from the galaxy tab S2 with the same wifi chip as us but a newer version, and with android 7 support) , it has new internal features etc,

commit that broke the wifi : universal5433/android_kernel_samsung_universal5433@9651661

commit that fixed wifi : universal5433/android_kernel_samsung_universal5433@560373c

Basically thinking newer = better, and for the most part that is true except this new driver also has a function called "DHD_SET_COUNTRY_SUPPORT" which setting your device to a region that was not actually supported in the code, and then basically would disable network bands (so like 2.4ghz/5ghz was no longer existing) and then when the rom tried to do scan it said wait ? i dont see any radios available

i have no idea how not many people have this problem but there are few people who im sure will be happy now that it is fixed.

I dont see why this can't be a permeant solution, we go back to the hopefully more stable wifi driver and call it a day, and yes i see no problem in including this fix in all the future builds, i will also compile Helios kernel with the fix aswell (the kernel used on my touchwiz ROM) because another person has the problem there too.

if we found any issues, then we can enable the new driver again, and try to disable the DHD_SET_COUNTRY_SUPPORT code that broke everything, once i get some time i might send you a kernel to try later.

Thanks again for testing!

@ananjaser1211 ananjaser1211 added the Fixed in next release Bug has been resolved and will be shipped with the next release label Aug 10, 2023
@godzellax
Copy link

godzellax commented Aug 10, 2023

OK, I'm glad to help and will check your post from time to time. I'm so happy that I revived my old poor phone from death by flashing your custom rom and almost all issues fixed.

In regards to the kernel, I'd like to suggest if you don't mind a very useful and stable custom kernel I used for years without a single issue and fully customized to support almost everything we imagine to have.
Would you please check it and tell me your opinion about it:

https://forum.xda-developers.com/t/spacelemon-kernel-6-0-1-extended-battery-n910-c-h-u-n910-n915-n916-s-k-l.3506956/

Actually I was using the following version with the latest official XSG rom :
N910C-H-SpaceLemon-v2.91.45-zerolemon-no-root

Any chance that it may work out of the box with your custom rom or it need an optimization for compatibility reason?

Will it hurt if I flash it and check after backup my current kernel? Any risk?

ananjaser1211 added a commit to ananjaser1211/Helios_5433 that referenced this issue Jan 10, 2024
* Causes issues with some regions and disables WiFi freqency
* refer to universal5433/android_device_samsung_trelte-common#33 (comment)

This reverts commit cefe568.
ananjaser1211 added a commit to universal5433/android_kernel_samsung_universal5433 that referenced this issue Jan 27, 2024
* There is a chance that the a3 driver is not properly compatible with our A1 Revision chips
* And is causing WiFi not to properly scan while a sim is inserted (Syrian SIM cars so far)
* This seems to be caused by region setter
* More discussion here universal5433/android_device_samsung_trelte-common#33 (comment)
* The issue is possibly related to DHD_SET_COUNTRY_SUPPORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed in next release Bug has been resolved and will be shipped with the next release High Priority Critical BUG
Projects
None yet
Development

No branches or pull requests

2 participants