UDP Broadcast and WLAN Drivers - Android Q&A, Help & Troubleshooting

Hi,
i'm developing a realtime audio streaming client for Android that reproduces audio frames from network.
The server samples, encodes and sends audio over UDP broadcast datagrams, and all works well... until client's screen is turned on!
When screen is turned off(i.e. device goes to sleep) problems begin. I can divide them into two categories (apparently the discriminating factors are ROM/Silicon vendor):
No audio at all: behaviour found mainly on Qualcomm/Samsung devices. The WLAN drivers filters bcast datagrams when device is in sleep mode. The filter can be turned off from WCNSS_qcom_cfg.ini.
This fix apparently solves the problem on Qualcomm-based phones. I have a Marvell-based Samsung device with the same behaviour, but I've not investigated yet.
Stuttering audio: Happened on MTK-based phones. Apparently devices drop parts of UDP broadcast datagrams in sleep mode. Problem can be "solved" running a thread that keeps interface awake by sending dummy UDP datagrams every 100ms, but i don't like this solution.
Is there anybody who knows a way to tweak WLAN drivers on MTK/Marvell/OtherVendors phones to remove power-saving filters and allow broadcast activities in sleep mode(something like WCNSS_qcom_cfg.ini for Qualcomms) ?

UPDATE: Galaxy Xcover 3 (SM-G389F) has an Exynos 3475 and uses bcmdhd wifi driver, that uses dhd_pkt_filter_enable param to enable/disalbe filter.
Unfortunately it's defined with permission 0 (so it can't be accessed from sysfs) and I haven't found a way to pass the parameter to the kernel at boot time.
Recompiled the kernel with permission set to 0644 and it works (can be triggered from /sys/module/dhd/parameters/dhd_pkt_filter_enable).

Related

[Q] troubleshooting WiFi battery consumption. research done.

Hi guys, i flashed my rom to an updated official version not to long ago. after the flash i noticed WiFi is taking up 20-25% of my battery usage. battery life from full to naught is just 6 hours without any use. there's two other higher battery consuming items but they are cell standby and phone idle each at 25++%, but i learnt from my local LG O4X forum that they are nothing to worry about.
I tried to search over the internet for solutions which brought up serveral answers like:
wifi.supplicant_set_scan_interval=300 in build.prop (i had to create this line because there wasn't any, and doesn't help my problem. Line Deleted.)
then i realise whether the above works depends on
config.xml from a folder that also doesn't exists on my phone, which probably means wifi.supplicant_set_scan_interval=300 doesn't work at all.
Then from somewhere i learnt of another file wpa_supplicant.config in system/etc/wifi/
Inside this config file lies a whole load of #'ed texts that descripts what each line does but one caught my attention which is
Code:
# AP scanning/selection
# By default, wpa_supplicant requests driver to perform AP scanning and then
# uses the scan results to select a suitable AP. Another alternative is to
# allow the driver to take care of AP scanning and selection and use
# wpa_supplicant just to process EAPOL frames based on IEEE 802.11 association
# information from the driver.
# 1: wpa_supplicant initiates scanning and AP selection
# 0: driver takes care of scanning, AP selection, and IEEE 802.11 association
# parameters (e.g., WPA IE generation); this mode can also be used with
# non-WPA drivers when using IEEE 802.1X mode; do not try to associate with
# APs (i.e., external program needs to control association). This mode must
# also be used when using wired Ethernet drivers.
# 2: like 0, but associate with APs using security policy and SSID (but not
# BSSID); this can be used, e.g., with ndiswrapper and NDIS drivers to
# enable operation with hidden SSIDs and optimized roaming; in this mode,
# the network blocks in the configuration file are tried one by one until
# the driver reports successful association; each network block should have
# explicit security policy (i.e., only one option in the lists) for
# key_mgmt, pairwise, group, proto variables
[B]ap_scan=2[/B]
this is my current setting.
After trying all these my WiFi seems to be still taking up too much battery and at the 'show processes overlay' i still see 'wpa_supplicant' running on and off with approx 5 seconds intervals in between.
My only worry is the methods i've tried are not applicable for ICS, which my phone is. On the link i've attached there's this newer wpa_supplicant_8 version for ICS. How to determine which version im on?
There seems to be more and more ways to troubleshoot as i look further and further, but im not really willing to risk venturing into unknown area without knowledge. Are there any other ways to fix my WiFi consumption issue? i need a fix desperately.

Issues with TDLS (Tunneled Direct Link Setup) prevent use of vlc remote control

Hi,
I am just a Android user, but I believe my observations and questions are interesting and relevant to people in this forum.
I use a Samsung Galaxy A3 (2017) and wanted to use one of the many VLC remote control apps towards my Ubuntu computer that has a Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (Lite-on). Unfortunately none of them worked. All had network issues. I tried different ports and also used several browsers to access the http server of vlc directly, but even the browser had issues: it basically kept synchronised for 4 or 5 seconds, then lost synch and recovered only after roughly 15 seconds just to loose synch again after 4 or 5 seconds.
I checked the TCP connection. It did not break down. However, every 4th or 5th GET request got delayed by around 14 seconds.
I digged into it and found out that the A3 sends a TDLS Setup Request to the QCA9565, gets a TDSL Setup Response and then sends a TDLS Setup Confirm which is replied by the QCA9565 with a TDLS Teardown. After that, the connection between the two hosts is dead for about 14 seconds.
Other hosts in the network did not have such issues, but as far as I can see, they are also not using TDSL. So I suspect that some issues with TDLS between my Samsung A3 and my Ubuntu machine regularly interrupt the local WiFi connection between the two.
So now my question: Is it somehow possible to disable TDLS on my Android phone? Or are there any vlc remote apps around that somehow suppress TDLS for such local WiFi communcation?
Thanks
Michael

is anyone else having issues staying connected to WiFi?

My v60 is connected, but I loose the ability to browse... If I drop WiFi, then reconnect, it's fine, but if it's idle for a few mins, it gets choked with no internet ability.
I even went as far as static IP settings, etc... Never had this issue with my V30.
So far I am disappointed... my wifi icon sometimes has a ! in the icon...but that went away when I put in static IP and static DNS... didn't help though.
please see my next post for the fix to this issue!!!
fixed the problem. Google inexplicably removed the "Keep WiFi on during sleep" setting from Android 10
to fix the problem you can do the following:
To set it:
adb shell settings put global wifi_sleep_policy 2
To find out what it is now:
adb shell settings list global
Keep WiFi on during sleep: Always = 2
Keep WiFi on during sleep: Only When Plugged In = 1
Keep WiFi on during sleep: Never = 0
found the fix here, says for Pixel2, but works on the LG V60 too!
https://www.androidpolice.com/2017/10/24/google-inexplicably-removed-keep-wifi-sleep-toggle-pixel-2/
Problem resolved!! WiFi Sleep issue in Android 10!
please see my previous post for the fix to this issue!!!
you need USB debugging turned on and ADB to fix the problem!
Update on my fix for v60 with WIFI that disconnects after sleep on 802.11N only
Update: My success with this was short lived. Worked for about a week and then back to the same 'ol. Checked the ADB nothing changed. Ended up installing "automate" by llama and creating a flow to check internet via ping and then turn on and turn off the wifi. Few things with that. 1: WiFi Enabled - Yes->Ping 8.8.8.8 - No ->Disable WIFI->Delay 2 sec-> Enable Wifi -> Delay 15 sec->Loop to 1.
Few points:
If Wifi Enabled = No, then loop to 15 sec delay
If Ping = Success, loop to 15 sec delay
After WIFI Enable = Loop to 15 sec delay
15-Sec Delay to "Is Wifi Enabled"
---
Wanted to update my experience on this. I have discovered my v60 fails to work after the phone goes to sleep. This can be reproduced by simply hitting the power button and waiting 15-30 seconds. At the point of wake-up, the phone is connected to wifi, the AP sees the client but the client fails to work. Analysis of the sniffer data shows the phone "SENDS" traffic but fails to receive. This issue was found on FORTIAP units that support the 802.11N protocol and when using A/B/G the issue did not present itself. I also noticed that while the phone was either charging or "awake" that pinging the phone was sub-10ms responses, once the phone went to sleep, pings went well over 100ms (See my theory at the bottom). As noted, if you simply disconnected and reconnected the wifi, the phone would work on WIFI "N" until it went to sleep again.
This post led me into a direction that seems to have resolved the issue. I was able to verify this does not happen on cheaper ISP AP's with "N" only enabled but happens on "smarter" "N" access points in multiple locations and on different APs. The behavior was consistent and after several hours of troubleshooting I have some settings that have 100% stabilized my phone after going to sleep. This issue did not present itself while the phone was charging via USB to the ADB connection or using a standalone charger.
Using ADB and connecting to my phone via USB, I ran the following commands:
adb shell settings put global wifi_on 1
adb shell settings put global wifi_automatically_on_off_wifi_enabled 0
adb shell settings put global wifi_watchdog_poor_network_test_enabled 1
adb shell settings put system power_save_wifi 0
adb shell settings put system power_save_wifi_restore 1
With this post, it was suggested to set the following, however in my phone it was already the case:
adb shell settings get global wifi_sleep_policy = 2
As noted by this posts author, you can change that if needed via:
adb shell settings put global wifi_sleep_policy 2
The original settings were as follows:
global wifi_on=2
global wifi_automatically_on_off_wifi_enabled=2
global wifi_watchdog_poor_network_test_enabled = 0
system power_save_wifi = 1
system power_save_wifi_restore = 0
I sure hope this helps others out there, LG didn't want to own up to this issue that is widely reported but at this point, I think I have settings that are stable and my phone is now usable.
Verizon sent me a new v60 phone and it also had the issue, this allowed me to test and troubleshoot to come up with this solution. This issue happened with both the March 2020 update (as shipped) as well as the June 2020 update.
My theory is the enhancement of the "N" protocol in the IEEE 802.11N enhancements where beam forming is able to reduce power. When the phone goes to sleep, it seems to lose track of the "beam" and the power reduction on the AP may cause this issue. I'm not really sure, but here's where I gathered that from:
Beam forming
As 802.11n systems emerges in the market as an important feature for enterprise Wi-Fi infrastructure. Beam forming is an important companion to 4×4 Multiple Input Multiple Output (MIMO) technologies for Wi-Fi wireless networking. When it is included, it enables dramatic improvement in Wi-Fi 802.11ac/n performance, reliability, range and coverage. Beam forming is an optional feature of 802.11n. In its simplest terms, beam forming allows an access point to effectively concentrate its signal at the clients location. This results in a better signal, SNR and potentially a great throughput. It is a natural extension of the physical layer that has multiple radios and antennas in each station. By controlling the transmit power and phase of the collection of transmission antennas, it is possible to shape the effective gain of the antennas to create a pattern that points towards the receiving station a beam.
Same issue here using Google Wifi
Unfortunately I tried your settings but it is still happening. Not sure if I need to do anything else. I don't have a lot of experience with adb, but I was able to make sure that the settings were set. Is there a way to print out the list of current settings to verify that all is set. I did verify through the commands.
Anyway thanks!! Any other info would be great. I do have the latest July update. Thanks
So I tried slyguy2000's method (the ADB commands) and it worked perfectly. However, now I am getting really poor battery performance. My phone lasts 1 day with moderate use (4-5hrs of SOT) while before I used to get 10hrs of SOT. Is anyone else experiencing this issue.
My V60 seams to be working better. I had one of the settings that were not enabled "watchdog_poor_network_test" once I enabled it seams to work better. It will connect now even after a overnight period.
Yes I confirm that it drains a lot of battery overnight after setting change. Getting 24 hrs per charge, was getting a day and a half before.
I decided to go back in my settings to avoid the battery drain. I put everything back to stock but my battery was still draining. So I did a factory reset and brought back my last backup. Now it's all working fine. Even my wifi and no battery drain either. So not sure why, but it's all good now!
Strange!
I do have issues as well, on some SSIDs. Specifically it has issues with my home mesh network. Not sure if it is the mesh or the beamforming that it has issues with more.

Possible hardware issue with wifi not turning on

There are plenty of wifi issue not turning on under this forum, a lot of them were resolved by turning on and off, reload rom etc. But I narrowed down to some question possibly hardware related and need some clarification on settings.
I am playing with a old HP touchpad (I know it has it's own forum) and wifi was working on a older android mod. After a certain time left the machine, I dug it out recently to use it and wifi is "suck at the turning on phase". Android will also goes into a boot loop after 30 sec after boots.
So I went to recovery and looking at the hardware address , numbers and settings and discover few things.
The adaptor name is not the typical eth0, it's call dummy0. Also there is something call "lo" Link encap:Local Loopback under the hardware.
Here are the numbers:
dummy0 Link encap:Ethernet HWaddr DAlB0:37:5E:9F:93
BROADCASTS NOARP MTU:1500 METRIC:1
(follow by a bunch of 0s on RX packets etc etc)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 METRIC:1
(follow by a bunch of 0s on RX packets etc etc)
Now looking at this information, the dummy0 should be the wifi adapter information right? What is broadcast NOARP means?
I have tried to turn on the dummy0 device and it will show UP Broadcast, also turning on ARP (I read somewhere this should be default) and after booting back into android, these settings will revert back to the information above.
Can anyone shine a light on if this is the right place poking at the wifi adapter setting or it's some type of hardware failure causing the wifi not turning on?
The Wi-Fi settings are stored in Android's settings.db located at
/data/data/com.android.providers.settings/databases.
Note that you cannot access it unless you have root.
The SSIDs and passwords of the Wi-Fi networks are stored to
/data/misc/wifi/wpa_supplicant.conf
HTH

P2P through mobile data's ipv6 network causes battery drain

My moto g 5g plus is on stock android 10 rom.
Although it lacks custom features , the battery performance is quite good.
I got 22 mins /1% on playing local small size 720P videos with brightness 2 sound 10 in mxplayer settings.
So when I perform a torrent download or live stream on twitch, I can observe a large downgrade of battery performance.
The same video only got 12min/1% after torrent download and 17min/1% after watching live stream.
From netstat, it will stuck on showing "tcp..." somewhere , and disconnect mobile data or turn on airplane mode will make it going on and shows "tcp6..." staff.
The downgrade meter may be related to numbers of connected ipv6 clients.
From battery side, this acts like something still try or maintain a disconnected client.
So I set mobile apn protocol to ipv4, somehow "tcp6..." still shows on netstat and battery performance still has a little downgrade (20 mins/1%).
And then I use this method
[GUIDE/APP][ROOT] Disable/Block IPv6 on Android (Prevent IPv6 Leak on VPN)
Note For Moderators:Please move this thread to somewhere in forum.xda-developers.com/android if that's a better fit. Simple App Alternative/Supplement [UNTESTED] With AFWall+ 2.9.0, you can now block IPv6 with iptables. NOTE This only blocks...
forum.xda-developers.com
echo 0 > /proc/sys/net/ipv6/conf/wlan0/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
add them to total commander shell command and excute.
Then battery performance back to normal.
Notice, the two steps are all needed.(APN and shell commands)
Another way is every time may involved p2p , perform an airplane mode on & off.
I tested all on mobile data .(wifi has not been tested)
Normal ipv6 site review doesn't affected.
It only related to p2p (peer-to-peer) on ipv6 network.
Don't know where it occurred , if in firmware driver then customer roms are affected, if in system side then not.
If you're in weired battery drain , you should look into this.(mostly after watching a live stream)

Categories

Resources