yashsingh1/xdaforums huggingface dataset:
[HTC 10 Guides, News, & Discussion] devsk:
Its a no go. Data just won't turn on without reboot if its gets turned off (whether manually or by moving to wifi, in which case it actually stays on but turn wifi off, the data does not connect although its on) by after reboot.
[HTC 10 Guides, News, & Discussion] hemirunner426:
That's too bad. The tmo pmic and the wakelock kernel fix seemed to help me. I still can't shake the feeling the Wi-Fi chipset is crap however.
[HTC 10 Guides, News, & Discussion] MNoisy:
Is there a similar wake lock hack available for elementalx?
[HTC 10 Guides, News, & Discussion] buckmarble:
Negative, he has not included it at this point, but it is up on my GitHub.
[HTC 10 Guides, News, & Discussion] krassermensch:
Guys, I think I have a great info for some of you. I'm using a router which runs a 2,4 as well as a 5,0 GHz network with the same SSID (Wi-Fi network name) at the same time by default. I've never had any issues with that setup but my HTC 10 has never had a stable connection on this Wi-Fi network. As I have a very poor bandwidth the 5,0 GHz network has never given me any advantages. As a result I switched it off yesterday thinking it may help with the Wi-Fi issues on my HTC 10. I've not had any bugs with Wi-Fi on my phone from that point of time on. Try it out yourself if you complain about Wi-Fi issues and report if it works for you ;)

In case more users report it works [MENTION=1416236]devsk[/MENTION] could quote this post in the OP :D
[HTC 10 Guides, News, & Discussion] devsk:
you switched off 5Ghz on the router or inside HTC 10 settings? I have set the band to 2.4Ghz on my phone to 1.) get better range, 2.) avoid any interference between my runs for testing from time to time. My HTC 10 only connects to 2.4Ghz.
[HTC 10 Guides, News, & Discussion] krassermensch:
I switched it off on my router...
[HTC 10 Guides, News, & Discussion] andybones:
[MENTION=1416236]devsk[/MENTION]

How can I get the string version # of the pmic.img?

Thank you.
[HTC 10 Guides, News, & Discussion] devsk:
run 'strings pmic.img | grep ver' from a Linux machine or within the phone in a terminal.

I got the replacement phone. Going to unlock and run the experiments on it in next few days.
[HTC 10 Guides, News, & Discussion] hemirunner426:
I did a CRC check between the pmic of 1.91 and the tmo pmic and they appear to be different. File size was also slightly different. It will definitely be nice to be able to correctly version these
[HTC 10 Guides, News, & Discussion] andybones:
Looking forward to the results.

I keep getting this, what am I doing wrong lol.

NVM, got it using HEX editor. Thanks again.
[HTC 10 Guides, News, & Discussion] Haldi4803:
I have 3 AP here, 2 with DualBand and 5ghz on a sepparate SSID.

Both 5ghz and 2.4ghz Use the same amount of battery in Standby.

I've deactivated IPv6 in Router settings. Rebooted the Phone. Had About 0.6%/h , made a Screenshot, run Battery Report, uploaded report, surfed the web, checked emails. Put the phone back into the exact same position. and closed all recent apps. Next 6hours i got a 3.1%/h battery drain.

Whaterver the **** is wrong with this phone it's not entirely hardware related. Verry verry verry rarely i get good times on Standby, yet is see absoluty no difference between the times when i have good standby and when not.

When the new 1.90.709 update reaches my phone i'm gonna start anew with a full factory reset.

P.S Anyone else here having huge battery drain an NOT using multiple routers with the same SSID? just asking for similarities....
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
I have one router. One SSID for each band. IPv6 turned off. Piss poor battery life.
[HTC 10 Guides, News, & Discussion] devsk:
So, I have an update. Basically, I have the exact same issues with the new phone!! So, the hardware is not the issue. And pmic changes were probably anomalous because I am now updated to 1.91.617.1.

I enabled the wireless on my cable modem to see if things change. They do. I get around 0.6%/hr idle drain on the modem router vs. the 2.5-3%/hr drain on TP-Link Archer C9 I have for my main router. I repeated the experiment switching between routers multiple times to make sure that the result was repeatable. This is interesting piece of information because it means that there is some sort of compatibility issue with the wifi stack on the phone with some routers. The problem is still the HTC 10's software stack for wifi. I think its fixable in software once we know what is it that triggers this behaviour.

Its not RA and IPv6, at least not in my setup.

Using my patch for rx_wake nearly halves the drain but it does not eliminate it.

One stark differentiation was the amount of battery used by "system" for good router (~4%) vs. bad router (~20%) as reported by BBS usage numbers (don't go by the %age BBS shows, calculate it using system time / total time). I don't know where the 'system' utilization is coming from. I need to analyze the logs to see if we can figure that out. I am also going to analyze the traffic between the router and the phone with good and bad router to see what's going on.

PS: I say we need to fix this on the phone side because I spend quite a bit of time in office and I can't touch settings on the routers there.
[HTC 10 Guides, News, & Discussion] Haldi4803:
I have bad WiFi drain but no Wakelocks ~.~

So what am I supposed to blame? -.-

P.S

I have a Swisscom Router here which has horrible Battery drain, and a Asus N53 which has moderately bad. (the one above is swisscom).

I've had AdvancedTomato installed on the Asus before which has quite a bit of Setting possibilities.

Sadly my knowledge of WiFi setups is pretty limited. So if anyone has a Lead on what settings could be changed to make WiFi Batterylife worse on our 10 i could try that.
[HTC 10 Guides, News, & Discussion] chetly968:
I voted 'yes' for having the wifi issues. Or rather, I had, until the latest firmware that is. So far, in the last 24 hours everything has been running super smooth. I also have to say the battery life is drawn!atically improved. Normal use over a 10 hour period from 7am-5pm amd my phone sat around 60%.t hats just plane incredible to me. Probably the best battery life I've ever had in a phone. Better than my old Sony Z3 from a couple years ago.
[HTC 10 Guides, News, & Discussion] grega_slo:
meh, I told you it's not hardware....

Do some wiresharking guys... I have no drain at all here. Do wireshark and send it to your network guys in the office, they will know what to do with it hopefully...
[HTC 10 Guides, News, & Discussion] devsk:
Why do you keep on insisting that fixing it at the router is a better idea? I travel and I ask airports, my friends and family to fix their routers because my HTC 10 does not like it...LOL
[HTC 10 Guides, News, & Discussion] Haldi4803:
This has to be a Bug right.... That simply can't be.....

I only switched from 2.4 to 5ghz Network.

Just look at the before and after...
[HTC 10 Guides, News, & Discussion] devsk:
Darn! I screwed up. Here is what I was thinking: I need to login to my router and run tcpdump there to see the traffic that's going out and coming in into the router from a sleeping phone. I can't run it on the phone because then, its not a sleeping phone any more...:). Easiest way is to get dd-wrt on the router, login and profit! Nope. Not so fast. First flash of dd-wrt bricked my TP-Link Archer C9v1. Went through the lengthy procedure of recovering the router but I was exhausted by 3am. I set it all up and verified that it still connected my phone, and slept off. This morning I woke up to 0.5%/hr idle drain. Darn! The problem does not reproduce with dd-wrt.

Back to square one. Now, I am worried if I put the stock firmware back, I might brick it again and the recovery procedure IS scary (involves opening the router up and running wires from USB/UART adapter) and lengthy!

Basically, one thing is very very clear now: It is some compatibility issue between HTC 10 and some routers. Finding that incompatibility is the key. But I lost a key element in that struggle: way to reproduce the issue at will.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Yeah. I honestly have NO damn idea how to predict when my idle times are great and when they're horrible. And that is with the same Router/Setup all the time -.-

But the bricking on the TP-Link sounds like a real PITA. Compared to that it's totall easy on the Asus Stuff.

This Router has a Brick mode, recovery thingy that activates if you press the reset button for 10 seconds while powering on. That only requiers a few total unlogical steps like deactivating WiFi on your laptop, De-Re-activating LAN port, rebooting, only using LAN port1 on the router, and starting software before you connect the cable but pressing upload button only after being connected for 30 seconds....
[HTC 10 Guides, News, & Discussion] devsk:
Finally, I got the time to setup tcpdump on my router. And I found one culprit that's waking my phone periodically...:) This may not apply to everyone but it does to my setup, because it involves Canon printer on the same network as the phone's, which is most likely the case if you have a canon printer on your LAN.

I have a Windows 10 VM which is sending repeated broadcasts on the network to UDP port 8612. Once nobody replies, it fires an ARP request as well. So, every few seconds, Windows PC is waking my phone up through the OOB wake interrupt.

I put in a firewall rule to prevent that on the Windows VM. Let's see how it reflects on the battery life.
[HTC 10 Guides, News, & Discussion] grega_slo:
Please do report back, that would be nice to know.

If true, this is firmware problem as it should not listen to this requests when in deep sleep.
[HTC 10 Guides, News, & Discussion] devsk:
I have not been able to make it idle yet. I need a stretch of 7-8 hours.

The thing is that the way OOB works is its for any packet arriving at the chip. Its interrupt driven. The system wakes up, deals with the packet depending upon which (and if some) application needs it and goes back to sleep once the wakelock times out. That's why reducing the wakelock timeout reduces the battery use because phone stays awake for less time. There is no way to avoid this. Only way is to disable the OOB altogether, in which case, you will not be woken by external events like whatsapp getting a message. Most of the asynchronous messaging will convert to periodic polling, which is a battery killer because most of the times, there is nothing coming in and hence checking even every minute will consume more battery.
[HTC 10 Guides, News, & Discussion] ivicask:
I got still the same issue, i got exactly the same models or router at home and at work, identical configuration ,yet at work im getting full 8 hours wake-locks as im at work, so many packed flying around, and i cant block everything as its too much mess, at home phone sleeps like a baby..
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hey guys,

Just wanted to let you know that the Nougat version of the Nexus 6p has this exact same issue ! There's a thread here discussing it: http://xdaforums.com/nexus-6p/general/nougat-battery-life-t3447147

Basically wifi is suspended/resumed by the wifi IRQ, just like yours. Some people have it, others dont. Most of the times theres is no wakelock involved, it's just resuming/suspending. I logged with the 'network log' app, which doesnt show any traffic at all. The issue also appears on mobile internet, in that case it's a modem IRQ causing it. IT seems to drain more on wifi though.

Here's the kernel log excerpt for the resume/suspend cycle on our phone:

http://xdaforums.com/showpost.php?p=68403600&postcount=97

There's a code.google thread on it, in which I've posted a logcat etc: https://code.google.com/p/android/issues/detail?id=211226

We should work on this together. Is there a summary of your important findings so far ? Do I understand that you guys found it's basically caused by the router ?
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Why are you so sure about that ? Also, are you getting wakelocks during the wakeups ? Because I dont. Here's how my batterystats look like:

https://s18.postimg.org/yffz7u5ft/Naamloos.jpg

As you can see, it wakes but doesnt lock. Basically it are just suspend/resume cycles caused by the wifi IRQ.
[HTC 10 Guides, News, & Discussion] buckmarble:
It's been an issue on 6p since it came out
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hmm but I see in your batterystats that you DO have wakelocks during wakeups, so it's definitely not 100% the same thing ... Did you guys try logging data with 'network log' app ?
[HTC 10 Guides, News, & Discussion] devsk:
That's the problem I described in my original post. There are tons of spurious wakeups because of the wifi chip. The wifi chip has to be on, and not even connected and it will drain!

I have been running with the wifi OOB host wake disabled (by compiling the wifi driver with BCMPCIE_OOB_HOST_WAKE undefined) for couple of days. The inbound packets don't wake the device any more. All the wifi traffic is driven by polling from within the phone every 10 minutes (I implemented this using Automate but you can use Tasker) to sync all my accounts (i.e. the auto-sync is off). But there are still spurious wakeups...no wakelock, but tons and tons of wakeups. They are caused by a bunch of GICs. The common ones are:

gic-86 -> Finger print. This is only seen when you use FP to wake the device. So, no problems.
gic-122 -> DHD OOB wake (I don't see it once I undefine BCMPCIE_OOB_HOST_WAKE while compiling the driver). Seen when incoming packets are handled through interrupt handler in dhd driver.
gic-358 -> RTC timer. Some app set a time based wakeup. This is fine as well. Periodic syncs and alarms happen this way.

Spurious/Unknown GICs seen waking up the device:

gic-200
gic-203
gic-240
gic-365
gic-481

gic-200, 203 and 365 are the most common ones waking up the device. Some of these seem to happen even if the wifi is off. I don't know what do they correspond to. If someone can dig what they stand for, that would be great!

Note that the PCI device suspend/resumes are always there if wifi is ON, even when the phone is on the charger, unlike spurious GICs above, which show up only when the device is on battery (for the obvious reason that full device suspend happens only on battery). These PCI suspend/resume are very low power because they generally don't trigger whole device wakeup, unlike GICs above.

In my current patch state, with OOB_HOST_WAKE out, the whole device should not wake up at all until the next 10 minute period for syncing arrives. But observed behaviour is same: tons of spurious full device wakes. I think Qualcomm needs to analyse this one.
[HTC 10 Guides, News, & Discussion] devsk:
Router compatibility angle is also there but its just one aspect of the wakeups. I have 2 wifi routers at home and many many at work. They all exhibit different idle discharges in my phone. My main router started behaving better once I put dd-wrt on it.

Broadcast packets on the home LAN from Windows printer driver were also observed to cause the device to wakeup every few seconds, leading to some drain. So, I shut that leak down by firewalling that broadcast packet inside the Windows.

The other angle for battery drain that I looked at was the logging to in-memory buffers and then dumping of those memory buffers into /devlog. Its quite intrusive because logcat is full of debugs from all over the place, mostly from system server. We are logging at milliseconds interval sometimes. The in-memory logging is one area of Android system which will not be covered by any wakelocks. It will just eat CPU cycles, disk IO and hence leading to battery drain. I suspect this is a major drain but I haven't figured how to disable in-memory logging writes (I think stopping the logd service only stops what's shown by logcat, the system is still logging to in-memory buffers).

The writes to the NAND happen at the same rate as in-memory buffers because we have to keep up with the in-memory circular buffer. Writing to NAND eats battery (and your NAND). So, I shut this battery leak down by disabling htc syslog logging service (which writes to /devlog) and mounting /devlog as read-only to detect if something was still trying to write to it.

Despite all the battery saving changes I made, the wifi chip keeps eating battery when idle...:)

As you can see through this whole discussion, starting with the original post, this is a very complex problem. I am pretty sure vendors are aware of the issue but they themselves have no idea what's going on, because it is so hard to pin it down. Typical bug reports are all over the place with some people throwing bluetooth, gps and random apps (FB anyone?) in the mix. When we talk of the battery drain, we typically look at wakelocks. But when there are no wakelocks, where do we go?...:)
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hi guys,

So you were right, this 100% sure is a router issue ! What I just did, is I bought this router: https://www.amazon.com/RT-N16-Wirel...F8&qid=1472582305&sr=8-1&keywords=asus+rt+n16 because I was kind of fed up with my current modem/router anyway, horrible unit (I had an Arris modem/router). So I put that Arris unit in bridged mode, connected my new router and guess what ... problem gone ! :D

No more continous suspend/resume reboots in the kernel log.

This is how my battery stats looked before:https://s18.postimg.io/yffz7u5ft/Naamloos.jpg

Now it looks like: https://s10.postimg.io/gnuj2j2op/New_Router.jpg

And notice how it's almost not wakeing up anymore (albeit still a few times, but it's SO much better now).

Hope this helps you guys !
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hey, you're hardcore, nice ! :) Will look into this myself too. I mainly bought this Asus router btw because it was ddwrt compatible and I wanted to do logging on the router like you did. I was happily surprised that most of the problem was gone instantly, withouth even flashing ddwrt. But you've found out it arent even packets coming from the router waking the chip up ! Very interesting, will definitely also research into this.
[HTC 10 Guides, News, & Discussion] donibrasco:
Just want to report.

Thought the wifi problem was solved by 1.9 base but still persist...partially! Don't have battery drain anymore but the resume/suspend connection on some routers is there and driving me mad especially when trying download large files!
[HTC 10 Guides, News, & Discussion] andybones:
Thought I'd share this.

I was/am plagued with the wifi issue.

I'd get like 5% drain in BetterBatteryStats when left wifi on over 5-6 hours.

I ran RUU as I am having issues and wanted to see if they persist on stock RUU.

I left wifi on overnight and the drain is 0.4%... and thats with wifi actve the entire time, i usually turn it off overnight.
[HTC 10 Guides, News, & Discussion] racingmatt1:
Anyone figure out why Wi-Fi disconnects/reconnects randomly even when right next to the router?
[HTC 10 Guides, News, & Discussion] Haldi4803:
Yeah, say that again in 5 days.

I've deleted lease files. got like 0.3%/h batterydrain for one night.

And wifi was somehow borked up, but it changed back to normal after 1 or 2 nights.

There were other times where i have absoluty no goddamn idea why my phone drains almost no Battery in the exact same Wifi in the exact same location with the exact same settings. And then. Bamm, next day it's back to 2.5%/h batterydrain.

Wish i knew, wish i knew.

I just remember this happening way more often after i deleted whe WiFI .lease files.
[HTC 10 Guides, News, & Discussion] racingmatt1:
What's the Wi-Fi.lease?
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Very very nice ! I'd like to do this too, see what it does on my 6p. I've actually bought my new router mainly to flash a wrt firmware. What WRT version does have the best logging capabilities ? Or are they all the same ? Not sure if I should flash dd-wrt or open-wrt, any suggestions ?

*EDIT* hmm for my specific router Open WRT can only be installed through DD-WRT, so I'll need to start with that anyway :)

*EDIT2* Nice, I'm on DD-WRT now without bricking my router, phew :) Tomorrow going to look into setting tcpdump up.

*EDIT3* So I was just researching on how to install tcpdump, when I found this comment: http://www.dd-wrt.com/phpBB2/viewtopic.php?p=773030

LOL I just tried it and indeed, it's pre installed already :) Nice !! Let the fun begin !

*EDIT4* and it works, all the 6p's data is scrolling by on my SSH screen, profit ! :) Wow this is really awesome stuff
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
*DISCLAIMER I'm on a 6p, using NOUGAT*

So, I did a two hour tcpdump log and compared it to the batterystats data. First of all my phone sleeps pretty well after changing the router but it's still waking up more than I'd like. I'm NOT running whatsapp, facebook or some other app that you'd expect to wake up the phone. It still was awake for about 5 minutes during those 2 hours, and lost 1-2% battery. And why ? Mainly because it was connecting to some Google IP's (probably to do some syncing or supply Google WHQ with some other spied data regarding my phone). And then it was also connecting to some IP's in the Amazon.com server park, not sure what that's about but it might just be some app that has its server in their park (amazon leases out). I could find out by logging live and tracing back the port to a process with fuser, maybe I'll try that later. I couldnt do it now because the processes were already dead.

Anyway, I did also see wakelocks that didnt correspond to any network traffic, like:

+46m07s965ms (3) 038 +running -wifi_radio wake_reason=0:"506:msm_pcie_wake:200:qcom,smd-rpm:203:fc4281d0.qcom,mpm:240:fd510000.pinctrl" stats=0:"wifi-data: inactive"
+46m08s876ms (1) 038 -running

They didnt happen too often, maybe 10x per hour and only woke up my phone for less than 1 second each time. No biggy from battery perspective, but it is interesting because I did see a trillion of those on my previous router, which constantly was waking up my phone and constantly doing that suspend/resume cycle. But if tcpdump is correct and there's really NO data being transmitted then it indeed must be something else, other than a network packet, waking up the wifi chip. [MENTION=1416236]devsk[/MENTION] stated something similar earlier, you talked about GIC's, I'm not sure what you mean with that ?

And how does this even work ? I mean it's an interrupt coming from the wifi subsystem that wakes up the phone (like pointed out here that 506$msm_pcie_wake is indeed the wifi interrupt subsystem on the 6p)

Is it even possible that the fingerprint scanner sets a pin in the wifi subsystem ? Because that's how I understand it: some (hardware) device sets a pin HI and the chip responds with an IRQ to the kernel, telling it to wake up. Or does it work differently ? That's what I'm a bit confused about.

*EDIT* I just tried what you pointed out and you were correct again (of course) ;) The above wifi wakeups are also happening when wifi is on but not even connected to a network. Sorry for checking all of your work so far, but I need to see it for myself ;)

But then again, now I come to think of it, it's probably not even interesting. I mean, on my previous router I saw a million of those wakeups. But that of course means that in that case those wakeups were actually coming from the router. So the above is probably unrelated. I'd like to find out what the problem was on my previous router (so that I can fix it with a kernel patch) but since I can't run tcpdump on it, I'm not sure how to find out ...