yashsingh1/xdaforums huggingface dataset:
[HTC 10 Guides, News, & Discussion] Haldi4803:
There you go.

As long as we don't find any difference from the people here in this thread which are bugged by this Problem, and some other people around the world/Web which are definitely not influenced, like HTC's Lab Team. How do you expect them to fix this?

Come riding on a Unicorn and use their magical Wand to fix your phone?
[HTC 10 Guides, News, & Discussion] ChronoReverse:
Put '1' into /proc/sys/net/ipv6/conf/all/disable_ipv6

But I've already tried that, confirmed IPv6 was off and was still getting this issue.

Again, I don't have the battery drain but my wifi is definitely still doing extra sleep/wakes.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Can you try WiFi Standby in Safemode?

Shutdown, Boot, press Volume down afterwards.

Maybe some App you have prevents the battery drain.
[HTC 10 Guides, News, & Discussion] DoctorB0NG:
Well a paid QA and engineering team should be able to find and address this in my opinion. At least they could hop on here or get in contact with some of us and I'm sure we'd be more than happy to provide logs and router specs/info.

I'd bend over backwards to give them what they need to fix the issue.
[HTC 10 Guides, News, & Discussion] ChronoReverse:
I'll give it a try tonight then. I did just install Leedroid 2.0.1 and while the suspend thing seems to be going on still (but slower) I don't know if I still won't have battery drain.
[HTC 10 Guides, News, & Discussion] es10n:
Regarding battery issues, HTC_UK sent me the following to try (via Twitter):

While the phone's plugged in with the HTC charger, kindly press and hold the Volume Up + Volume Down + Power button for 2 minutes. Please check if it increases your battery life. Thanks, ^MR

I'll keep everyone posted, was struggling to get 3 hours+ SoT - let's hope this now increases
[HTC 10 Guides, News, & Discussion] Haldi4803:
How much I'd love for it to be that way.

But sadly company policies probably will not allow this. Even if they did read this thread (and let's be honest there has been about 2pages of useful information hidden in 23pages off topic/useless data) they're probably not allowed to answer.

Sony had a own forum with a developer subpart and some devs reading and answering there. I know HTC also has a forum... somewhere... and a Taiwanese forum... not sure how many people are there and if they have any knowledge of programming/are involved in the development.

But as Urban Strata has shown us they are aware of the problem and still investigating.

If we can find any way to reproduce this bug on a previously unaffected system, and let them know how, things will probably start rolling.
[HTC 10 Guides, News, & Discussion] Urban Strata:
Just confirmed HTC's QA team is still actively investigating. Thanks for your patience.
[HTC 10 Guides, News, & Discussion] devsk:
You are a good test case. Please respond. Your input is going to be highly useful.
[HTC 10 Guides, News, & Discussion] devsk:
Can you share what you did to get native wpa_supplicant to work? We can generate some ideas around it if it can be repeated on my phone as well!!

This is the best lead we have so far! I am so glad you managed it.

Edit: This also means that its a software issue and not a hardware one.
[HTC 10 Guides, News, & Discussion] live-evil:
I didn't get the one in /system/bin to work i compiled my own.
[HTC 10 Guides, News, & Discussion] devsk:
How did you compile? Did you pass special compile time options? Which source did you use to compile from?

Also, more questions: you are able to get wifi connection for all apps and you don't get any suspend/resume action as long as you don't enable/disable/enable from the Settings->Wifi, right?
[HTC 10 Guides, News, & Discussion] live-evil:
No, apps don't work if wifi isn't enabled in settings.

I compiled it from source from cynogenmod natively using termux's gcc compiler on the device.

its using my own compiled netlink libs ...
[HTC 10 Guides, News, & Discussion] devsk:
One thing that we need to explore is this:

This compile time flag in bcmdhd has been known to be related to wifi battery drain in the past. Unfortunately, I don't have a setup where I can build the kernel module and test it out. If you do, please try.
[HTC 10 Guides, News, & Discussion] live-evil:
I will compile last time i tried it didn't do anything.
[HTC 10 Guides, News, & Discussion] devsk:
May be because there are 2 flags...

So, both SUPPORT_PM2_ONLY and DISABLE_FW_ROAM_SUSPEND need to be taken out from bcmdhd module build.
[HTC 10 Guides, News, & Discussion] live-evil:
-DENABLE_FW_ROAM_SUSPEND

Is in the make file already...
[HTC 10 Guides, News, & Discussion] devsk:
wait...yes, you are right. Only remove PM2_ONLY.
[HTC 10 Guides, News, & Discussion] devsk:
There is another compile time macro which might be interesting for a workaround:

# Early suspend
DHDCFLAGS += -DDHD_USE_EARLYSUSPEND

May be take it out as well and try.
[HTC 10 Guides, News, & Discussion] devsk:
Just a quick update: I am having a communication with flar2 and I am trying some changes in the driver. I think we might be close to a workaround. Will update here as soon as I get something.

Update1: I am cooking flar2's kernel with my change. So, hold on, update will come later today.

Update2: Changed kernel built and booted up. Preliminary results: Awesome! No more repeated suspend/resume action. I am going to use the phone for the day and see how the battery drain with wifi is. If the results look good, I will upload a ZIP for folks to test.

If it all works for all the folks, I will push the change to flar2's repo so that everybody can have it in the next ElementalX kernel.

Update3: Mid-day update - Much much better battery life. Wake time suspend/resume cycles are gone or have reduced so much as to not matter any more. But when the phone turns the screen off, there is still some HTC piece of bloat that's overriding my change but the battery life is still much better than before. I need to track that and fix that part. I am becoming a little familiar with the code and it should be relatively easier. We will see.

So, we are about 75% of the way there.
[HTC 10 Guides, News, & Discussion] Allesa:
Whoa, this has gone a long way since the beginning. Congratz bro, anxiously waiting for the fix+exk combo
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
Oh man, that's awesome news! My wifi decided to take a dump while I was casting a movie using BubbleUPnP today and I almost threw it across the room...
[HTC 10 Guides, News, & Discussion] DoctorB0NG:
I can't wait to use wifi again! Hooray!
[HTC 10 Guides, News, & Discussion] Haldi4803:
There is so much HTC Stuff Messing with this phone.....

I really wonder how an AOSP ROM would run.
[HTC 10 Guides, News, & Discussion] devsk:
The last mile is proving to be rather strenuous. I am going to need more time to figure this out completely. HTC did a bad job with code here. Very complicated, convoluted stuff with literally no documentation (they strip it off). But we are close.
[HTC 10 Guides, News, & Discussion] tonnytech:
keep up the good work fella , look forward to trying kernal when complete. If need any testing happy to help if can :)
[HTC 10 Guides, News, & Discussion] Jump1ng:
Will these "patches" be included in the standard ElementalX build or a standalone?

Going to flash this as soon as its out that's for sure :)
[HTC 10 Guides, News, & Discussion] devsk:
The goal is give it to flar2 to include it in standard ElementalX build. I will ask folks to test it out before I give it to him.

Folks: this will need to wait till the weekend though. There is a bit of a personal emergency I need to deal with right now.
[HTC 10 Guides, News, & Discussion] Jump1ng:
Cool hopefully it will help a lot of people that isn't even aware of the problem that likes to use Flar2's kernel and who knows maybe HTC will use your guys research and fix to sort it out in their official update(s)

I can only speak for myself but don't worry about it taking time to deal with more important things than battery drain on a phone which you can charge quickly with QC3.0 any way. So just take care of your issues and we are ready to test anything when its ready.
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
Yeah I run EX exclusively anyway so I would definitely test any fix that came about for this problem.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Wow.... simply wow... I think this is the worst I've ever had...
[HTC 10 Guides, News, & Discussion] Dr.Jamil:
try turning google back up off and wipe data of google play services and reboot
[HTC 10 Guides, News, & Discussion] Haldi4803:
Because it makes you feel better ;)

Definitely not the Problem.

I think it's a Xfinity Router on Standard settings. Sadly im leaving today so nothing else to test :(
[HTC 10 Guides, News, & Discussion] tkoreaper:
Results from running commands from post #4:

dmesg|grep "msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received" | head

[45501.938373] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45523.415453] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45527.387344] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45529.392760] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45531.825414] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45533.557932] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45535.535490] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45537.969280] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45539.653304] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45541.649115] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received

dmesg|grep "msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received" | tail

[45819.868792] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45821.949451] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45824.008899] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45825.962458] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45828.092248] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45830.148856] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45832.215374] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45834.282854] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45836.342221] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[45838.316335] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received

dmesg|grep "msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received" | wc

145 1160 11020

cat /sys/bus/pci/devices/0000\:01\:00.0/vendor

0x14e4

cat /sys/module/bcmdhd/parameters/firmware_path

/system/etc/firmware/fw_bcm4359.bin

md5sum /system/etc/firmware/fw_bcm4359.bin

edde8438f68e226ad4dd5eb627ebf03b /system/etc/firmware/fw_bcm4359.bin

Just out of curiosity... Could the issues people are having be due to IPv6? I disabled IPv6 some time ago on my router because it cause issues... websites would load and stuff, but for some reason images would refuse to load in the Play Store. After I disabled IPv6 completely on my router things worked as they should. The reason why this stands out to me is that all of my other android devices never had that issue... My Pixel C, Nexus 6P, and all other devices worked perfectly with IPv6 enabled.

EDIT: I should also note that I use Wifi Calling about 99% of the time... There is some kind of dead zone in my area. I get good signal, but I drop calls and everything is slow. If I walk a block away everything is perfect lol.
[HTC 10 Guides, News, & Discussion] silv3rkn1ght:
These wifi drops are getting old fast now. It's totally random, and seems to happen most of the times when I stream or watch something on youtube.

It says it's connected, but nothing goes throught. Signal always strong though

Looking forward for your work. Take your time

Venom 2.2, ex 0.09, 641 s-off
[HTC 10 Guides, News, & Discussion] tkoreaper:
I'm curious, does the app "DNS Changer" fix your issues?
[HTC 10 Guides, News, & Discussion] devsk:
Folks: attached is a ZIP containing a test fix. Note that its a test, not a complete fix. Its built on top of Elemental kernel 0.09 by flar2 (thanks buddy for your help!). I need volunteers (must at least have a working knowledge of recovering boot partition from TWRP) who can use it as daily driver for couple of days and see if things are better (or worse).

Installing:

1. Backup your 'boot' partition NOW. You will need to restore if you run into any issues with wifi.

2. flash the ZIP like any other ZIP from TWRP.

There are two issues with wifi on HTC 10:

1. Holding the rx_wake wakelock for far too long preventing system from going to sleep for long periods of time.

This issue keeps the system from sleeping.

2. OOB interrupt based wakelock is causing heavoc on the system by waking it pretty much every 1 second when the screen is off. This is most likely a hardware issue with the way the gpio pins are programmed by HTC and that may explain why this issue does not affect all phones. This needs very careful evaluation of code.

This issue makes the system wake from sleep too often.

Sort of like two pronged attack on the battery...:)

Changes I made:

1. Reduce rx_wake timeout from an exorbitant 500ms to 100ms.

2. Increase runtime PM timeout

3. Disable OOB host wake completely.

If you notice you are missing some notifications for smartsync/push mail accounts, 3) may be the cause. Move to time based sync for those for now. We will figure it out.

This is not a fix but its a start. I need to spend more time with this code but I didn't get much time so far. And I won't until the second half of this month. If you run into any showstopping issues, please just revert back to your working 'boot' partition. Once we have some inputs from volunteers, we can sort things out.

Also, make sure to compare before and after in a sane environment i.e. same router and settings, same distance from router, same set of apps and same wifi settings (Always ON, power savings both enabled in Advanced settings) etc. Do due diligence, the triple D of life...:)

Standard Disclaimer: I am using this change on my phone without issues. YMMV. I disown any damage this might cause to your phone.
[HTC 10 Guides, News, & Discussion] devsk:
In case, it was not clear from the post, the ZIP is a kernel containing the changes made on top of ElementalX kernel made by flar2.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Mhmmmm... 1h detailed sleep report should be enough? Can do 2tests before I go to sleep. Just need to transfer all the videos from Phone to Tablet xD doing 2h nothing would be way to booring.
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
Thanks for sharing. I'll run it for a few days and report back.
[HTC 10 Guides, News, & Discussion] devsk:
Volunteers: Please download the attached file as /sdcard/reportSuspendResumeAction.sh on the phone and run in the 'adb shell' after letting the phone sleep for a while, immediately after waking it up.

Some of the commands may not be there. I don't remember. If that's the case, install meefik's busybox app from play store but don't install the busybox.

su
source /sdcard/reportSuspendResumeAction.sh
sraPrint | tee -a /sdcard/reportSRaction.log

Then, attach the output /sdcard/reportSRaction.log here.

Note that cutting&pasting the above commands may make them not run across Windows/Mac and the 'adb shell'. So, u need to type if u are using Windows/Mac and you are OK with cut&paste if u are using Linux...:(
[HTC 10 Guides, News, & Discussion] Haldi4803:
Sorry, can't help you with Testing :(

Yesterday I had the worst drain ever.

And today im in a new Hostel with no WiFi drain at all :(

# sh /storage/emulated/0/Download/Scripts/WlanStats
[ 358.161575] c0 1891 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 359.576870] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 361.608512] c1 1891 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 362.896998] c0 1891 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 365.423331] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 370.964054] c0 1891 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 372.595894] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 388.597171] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 392.670290] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 392.959865] c0 1891 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 433.753888] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 436.217280] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 439.279081] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 442.367108] c0 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 444.239492] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 445.862783] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 452.431315] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 459.451227] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 461.024878] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
[ 464.891570] c1 459 msm_pcie_pm_suspend: RC0: PM_Enter_L23 is received
36 324 2736

And that's before flashing your fix.
[HTC 10 Guides, News, & Discussion] devsk:
[MENTION=3056043]Haldi4803[/MENTION]: can you run the above script (function sraPrint) and give me the report from this hotel without my ZIP?

One of the packets that create the oob wake interrupt are the DTIM's that AP forces down the client's throat. So, how the driver handles those matters. The above log will help with whether different APs are pushing different beacon and DTIM intervals to the phone and hence triggering some bugs in the code.
[HTC 10 Guides, News, & Discussion] grega_slo:
Did a test with network without IPv6.

Results are stunning..

This is WHITOUT any fix.

So its not hw issue at all...

I would say that ppl have ipv6 enabled and don't know how to properly disable it.

In my case router advertisements were causing wakelock betveen every 5-20 seconds...

Now phone sleeps like a baby.

Btw, same router same wifi just new vlan..
[HTC 10 Guides, News, & Discussion] Haldi4803:
Does this Output look about right?

# sh /storage/emulated/0/Download/Scripts/SRA
Head of kernel log:
[ 2397.628845] c1 280 [HL] att_n[Far]
[ 2397.628868] c1 280 [cap] [HL] att_n[Far]
[ 2397.628895] c1 280 [S_HUB][CW_MCU] hallsensor_status_handler_func: att_n[Far]
Head of resume action:

Tail of resume action:
Tail of kernel log:
[ 2760.517768] c0 9431 [LED]virtual_key_lut_table_set, down - index = 6 value: 2
[ 2760.517778] c0 9431 [LED]virtual_key_lut_table_set, down - index = 7 value: 2
[ 2760.517789] c0 9431 [LED]virtual_key_lut_table_set, down - index = 8 value: 1

All resume action with cause:
Recent suspend abortion reasons:
DHD host wake interrupt count: 108
DHD wakes in current dmesg: 0
DHD host wakes:

Not done after the sleep, did it after sleep + 5 min browsing then downloading a 4gb Win10PE img over a 4mbps connection ~.~

I've had systemless busybox installed once. Not sure if it still works, or all the commands got executed right. But the script ended with an exit Code 0, no error.

Edit: I see stuff is missing -.-
[HTC 10 Guides, News, & Discussion] devsk:
Yeah, some commands are missing for sure.
[HTC 10 Guides, News, & Discussion] devsk:
As I mentioned in the original post, disabling IPv6 inside the phone does not help. I haven't tried disabling the IPv6 at the router level. That comes with the caveat that I don't control most of the wifi routers that I will be using.

Moreover, the action we are seeing is close to 1 wakeup per second. RAs don't come that fast. Although, they will likely generate the same interrupt.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Just tried again.

It stops at the DHD Host Wakes:

No matter what.

What Kind of busybox do you use?

Could you Upload the script as .sh.zip here? Maybe I failed with copy and paste (tried twice to be sure.)

Edit: same result with meefiks.

Might be because phone hasnt been in deep sleep?
[HTC 10 Guides, News, & Discussion] devsk:
I don't think its your busybox...:) You just don't have the pcie suspend/resume action and you have no oob host wakes in current dmesg either.

Either that or something else is filling your dmesg with junk, but then, I would expect your battery life to be worse.

Can you cat /sdcard/dmesg.out to be certain?

Wait: if you don't sleep or connected to power, you won't see the action. You have to disconnect the phone, power the screen off, let it sit for 5 mins, then wake it up and run the script.
[HTC 10 Guides, News, & Discussion] Haldi4803:
I'll try tomorrow.... still downloading ~.~
[HTC 10 Guides, News, & Discussion] devsk:
The DTIM log is printed only after the screen goes off. Make sure you collect that because it will tell us different APs are behaving differently wrt beacons and DTIMs. I think the first version I cut&pasted did not have that grep.
[HTC 10 Guides, News, & Discussion] tkoreaper:
Does removing IPv6 from router completely stop the issue from occurring? If so, at least we narrowed it down to it being an IPv6 issue.
[HTC 10 Guides, News, & Discussion] DoctorB0NG:
Gotta love it...
[HTC 10 Guides, News, & Discussion] amq:
Just so you guys know how it looks when the issues is not present. On poor signal
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
There's a huge difference... I can't run the commands yet but I can tell you I dumped the dmesg log and cleared it last night and it has 0 power management resets.

Interestingly, that ping is to my Comcast gateway which is behind the router I'm using yet the router latency is like 60-80ms O_o

It's not an IPv6 issue either, I've had it disabled on my router since I got the router.
[HTC 10 Guides, News, & Discussion] ChronoReverse:
Running the test kernel and I don't seem to be getting new sleep/resume messages now. I didn't have the power drain associated with this but it was doing a sleep reset every three seconds before so that's something new.
[HTC 10 Guides, News, & Discussion] Haldi4803:
By "even S7 has WiFi Problems" you meant this?

http://www.anandtech.com/show/10196/the-samsung-galaxy-s7-and-s7-edge-review-part-2/7
[HTC 10 Guides, News, & Discussion] live-evil:
Tried kernel devsk somewhat better but still 1000ms ping on one ap.
[HTC 10 Guides, News, & Discussion] DoctorB0NG:
I'm going to be switching from Verizon to AT&T and changing the CID, radio and ROM to the US unlocked. I wonder if this will have any effect on the wifi issues.
[HTC 10 Guides, News, & Discussion] InTents:
I'm seeing reports of a new OTA is this thread:

http://xdaforums.com/htc-10/how-to/unlocked-htc-10-update-updated-s-t3376329

I wonder if they have fixed this WiFi bug. Once I get the OTA I will check again.
[HTC 10 Guides, News, & Discussion] live-evil:
Wont be already tested 1.8
[HTC 10 Guides, News, & Discussion] InTents:
Which 1.80?

You do know that the second number is the region right?

I see 1.80.1020 is out now.
[HTC 10 Guides, News, & Discussion] Igor6661:
third number is region, not second. 1.80 is out for a while and it made things even worse for most..
[HTC 10 Guides, News, & Discussion] InTents:
Sorry I was wrong. I stand to be corrected.
[HTC 10 Guides, News, & Discussion] Haldi4803:
So yeah, here we go. Reallife Test after flashing the Fix.

Of the 8min45sec Wake 7min10sec are Software caused.

36'000 of 30'000 characters ~.~ so here we go Pastebin.....

http://pastebin.com/fSKErhKK

But: be aware! This Test was done on a Network NOT affected by Huge Battery drain!

Here is the Baseline before flashing the Fix.

http://xdaforums.com/showthread.php?p=67613849

Wlan_rx dropped from 1.1% to 0.3% :)
[HTC 10 Guides, News, & Discussion] InTents:
Very cool!

I actually didn't know the fix was already released.

Did the fix come from the ElementX kernel?
[HTC 10 Guides, News, & Discussion] Jump1ng:
No you have to flash the special version from this thread as the fix is not part of the normal ElementalX kernel yet.

This is the special file http://xdaforums.com/attachment.php?attachmentid=3802540&d=1467599461 - it was posted just one page ago so really...