yashsingh1/xdaforums huggingface dataset:
[HTC 10 Guides, News, & Discussion] Haldi4803:
Well this issue doesn't happen on Beanstalk.

Our WiFi does scan on the 2.4 and 5ghz frequency at the same time right? This does not happen on CM13 it shows 2.4ghz first and 5ghz way later. So I think they do use a different firmware.

You think it might be possible to use the firmware from Beanstalk ROM on Stock?

I have no idea how to read the Ramdisk config files ^^

But here is a ls from vendor/firmware.

You know which one is the WiFi?

Might work by simply replacing the one on Stock ROM and rebooting?

root@:/ # cd vendor/firmware
root@:/vendor/firmware # ls
adpver.cfg adsp.b11 modem.b01 modem.b13 slpi.b02 slpi.b14
adsp.b00 adsp.mdt modem.b02 modem.b15 slpi.b03 slpi.b15
adsp.b01 libpn548_fw.so modem.b03 modem.b16 slpi.b04 slpi.mdt
adsp.b02 mba.b00 modem.b04 modem.b17 slpi.b05 slpiver.cfg
adsp.b03 mba.b01 modem.b05 modem.b18 slpi.b06 venus.b00
adsp.b04 mba.b02 modem.b06 modem.b19 slpi.b07 venus.b01
adsp.b05 mba.b03 modem.b07 modem.b20 slpi.b08 venus.b02
adsp.b06 mba.b04 modem.b08 modem.mdt slpi.b09 venus.b03
adsp.b07 mba.b05 modem.b09 qdsp6m.qdb slpi.b10 venus.b04
adsp.b08 mba.mbn modem.b10 radiover.cfg slpi.b11 venus.mbn
adsp.b09 mba.mdt modem.b11 slpi.b00 slpi.b12 venus.mdt
adsp.b10 modem.b00 modem.b12 slpi.b01 slpi.b13 version.cfg

P.S anyone knows what the Venus does?

I've spotted the Venus.img in a firmware update from an OTA but google wouldn't help me.

I have problems reading bash. Sorry.

I'm not a dev at all^^
[HTC 10 Guides, News, & Discussion] devsk:
Firmware can do bad things in 2 ways:

1. Firmware has a bug and it handles some events weirdly.

2. Userspace is making firmware do weird things through the kernel interface.

2. is more likely than 1, because firmware bugs are less common than userspace bugs.
[HTC 10 Guides, News, & Discussion] reposedx:
So my phone has horrible battery issues. I've just unplugged it and it has ready lost 9%. What also is happening. Is that any charger I've used other than the one that came with the phone or the Apple 29w MacBook USB-C charger, only trickle charges my phone. I can't get a solid charge.

I'm rooted (systemless) with Xposed installed. Stock ROM and kernel. Should I try flashing the zip here? Maybe try a custom ROM and kernel? Talk to HTC? This is my first Android and just want to know the best direction to take.

Thanks for any advice!
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
dump the kernel log (adb shell dmesg >log.txt). It should say something like:

dhdpcie_download_code_file: download firmware /vendor/firmware/fw_bcmdhd.bin
[HTC 10 Guides, News, & Discussion] Haldi4803:
They both have the Same md5 :(

Probably identical. So its not Firmware related. Too Bad :(

http://cloud.tapatalk.com/s/57e839496a5d5/fw_bcm4359.zip
[HTC 10 Guides, News, & Discussion] pettigrew95:
Are you using a non VZW firmware on a VZW 10 successfully? I just updated to VZW's 1.82 build and am running LeeDroid 2.5.5
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
I'm not sure what you're saying ? You have a ROM without the wifi issue and a ROM without the wifi issue, both have the same WIFI firmware, one has problems and the other doesn't, is that what you're saying ? But that B1 version is different from that other one. You should ignore the 'apta' version.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
BTW, on a positive note: I've managed to dump the wifi FW ROM memory ! I've exploited the 'get version' call to the wifi FW which the kernel issues with an IOCTL. I managed to modify it so it doesn't return the version but the ROM bytes as string. Problem was that the buffer for that couldn't be bigger than 1100 bytes, but I just bypassed that by looping the 'get version' call in the kernel and extend it with 1100 bytes each time. The resulting dump is correct, the code matches perfectly the RAM code (eg when I see a function call into the ROM section, that ROM section indeed starts with a push)

Now analysis of the WIFI ram code *should* be a bit easier :) But it's still quite some work. Luckily I love stuff like this and I do it for fun :)
[HTC 10 Guides, News, & Discussion] Haldi4803:
That's what I wanted to say yes.

I haven't looked at the b1 file as only the normal one was called in the dmesg. Why is there even a b1?

I'll try that tomorrow.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
I'm confused. Which files did you find on which ROM ? Can you elaborate a bit on what your point is please ? Thanks.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Oh, I thought you'd have taken a look at the attached zip file.

All 4 files are on both ROMs. Cm13 Beanstalk and stock ROM.

Md5 of cm13 and stock fw_bcm4359.bin is identical.

The fw_bcm4359b1.bin does not show up in the kernel log. Therefore I've ignored it.

So my conclusion was Firmware is identical on both ROMs.

Yet cm13 always seems fine while stock ROM often has batterydrain and non showing wakes. So my claim is WiFi drivers are innocent and its a ROM issue. Some kind of deep down hidden android system setting that forces the WiFi to obey.

To test this claim I'll try and replace all files from stock ROM with cm13, reboot and check for issues.
[HTC 10 Guides, News, & Discussion] polaric:
Has messing with the driver fixed wifi instability for anyone here? Because like quite a few others in some other threads, my wifi connection is pathetically slow and drops often.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Ok now I understand you. Yeah you can ignore that b1 file, it's just that fw_bcm4359.bin file.

The problem with those wakeups is that in the batterystats you won't find any reason for the wakeup, other than that it's coming from wifi or not. In order to find out where the wifi wakeup is coming from you can do a few things:

1) Install 'Network log' app (root needed). Enable logging, put your phone to sleep and wake it up after some time, you can see which apps transferred data. Ignore the data transfer at time when you put it to sleep and the time you woke it up. See if you can match an app to the wakeup

2) As discussed here earlier, get a router with dd-wrt and run tcpdump on it to capture all the TCP traffic and again see if you can match it to the wakeups in the battery stats

3) Run a network card that's capable of it in 'monitor mode' to simply capture *all* wifi data and see if you can can match a specific packet to a wakeup.

If it would be a user space app, then you should simply see it in the Network log app. If it really had to do with CM13, then you could easily spot it. I like the tcpdump option even more, but not everybody has a dd-wrt capable router.

But of course the problem is when it's not user space and when it's not even TCP data waking up the device, but 'wifi management' data like we've found the Router Advertisment ipv6 packets to do wakeups. These you can only spot with option 3 in the above. And this wifi management data is not even being passed onto the kernel, why would it, the kernel doesnt need it, it's info for the wifi chip. So what happens here is that the wifi firmware receives such a packet and tells the kernel to just wakeup. Once woken up, the kernel has nothing to do and goes back to sleep. That's why you'll see in the log that the duration for those wakeups is always less than 1 second.

So in short, if you're saying that in CM13 you don't have those problems, then in your case it's not even wifi management data that's causing the problem. You'll have a problem in user space. Maybe some google syncing option, a playstore option, things like that.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
One thing though is that I currently don't completely understand the relationship between the kernel and the wifi chip. I mean I don't understand completely how the wifi chip wakes up the kernel exactly, I'm going to research into this. Because I do agree with [MENTION=1416236]devsk[/MENTION] that it seems generally more likely that something in the kernel is misconfigured than on the wifi FW side. And it's always a close relationship between kernel <-> firmware, the kernel could send settings to the firmware that cause this problem, so in that case the problem is the firmware but it is a problem because the kernel told it to behave like that. So I think it's key now to understand this relationship clearly, I'm going to do some research here.
[HTC 10 Guides, News, & Discussion] Haldi4803:
1) I don't get it how an app can Log such a thing without creating more wakelocks ^^ but i'll give it a try if i have too much time.

2) doesn't work. This bug is router specific, i have one Asus N53 with Advanced Tomato, no issues, and a Swisscom Router which causes the drain. IIRC Devsk flashed ddwrt on his router and the issue was mostly resolver... just by the different router firmware and the standard settings.

3)yep... sadly i'm not really well versed with wireshark or Kali.... but this does sound like the best way to find out whats going on.

Well.... the thingy is. If you use Stock ROM, wipe Userdata, do NOT set up a google account, deactivate all sync options and everything you STILL get the battery drain.

So what is causing it? Either a HTC Pre-installed App which cannot be uninstalled. But this sounds highly unlikely as you have the same/similar issue on your Nexus.

Or maybe something inside Android System thats handling how the WiFi driver reacts on the incoming packages. And because CM13 has something different here it's not affected.
[HTC 10 Guides, News, & Discussion] devsk:
I have mostly reached a state where I think I am comfortable with the battery life I get out of HTC 10. Here are the things I did:

0. Moved my Archer C9 router to dd-wrt firmware. This changed the dynamics of arp, dtim, and likely IPv6, in a way that reduced my idle wifi drain at home to about 1 to 1.5% per hour, which is not the best but fine by me.

1. Disable wifi/data/GPS/sync at night using Automate. So, for 8 hours at night I lose about 3%. So, this saves me about 5-10% wastage per day.

2. Patch the kernel module to reduce wakelocks on RX, OOB and some junk debug and periodic activities which wake the device every minute and every 5 seconds. The patch is attached if someone wants to build the stock kernel with it. I can attach the kernel ZIP if someone is interested in using my kernel. Note that earlier I was basing my patch on top of Flar2's Ex kernel but now I have moved completely to the stock kernel with my patch on top of it.

The kernel config patch is attached separately. Major change there is to remove CONFIG_HTC_POWER_DEBUG=y, and enable LZ4 for zram (which I use and recommend heavily because of memory leaks galore on Android: leaked memory is never accessed, is compressed and deposited in the zram, the perfect use case on a 4GB RAM device where swap should not be needed ideally).

As you can see, I get excellent battery life. I can't be bummed too much about not being able to reduce that 1.5%/hour wifi drain down to 0.5%/hour, although it will likely help me get even more juice out of my phone. Note that most of the 3 hours SOT was spent on chat on whatsapp, sudoku, brain it on, lots of corporate email, may be 4-5 short videos: so not much of hardcore gaming action, but decent low to medium usage.

[MENTION=7294772]haldi[/MENTION]: one thing to note between HTC stock kernel (in fact all Sense kernels) and CM kernel is that CM kernel has CAF patches. If you look at those patches, you will be amazed how far behind the Sense kernel is in terms of qualcomm's latest SOC code. The GPU changes alone are astounding! So, CM kernel not eating your battery alive may also have something to do with that. Make comparisons using data alone also, it will give you a better picture. Lots of angles on this complex problem.
[HTC 10 Guides, News, & Discussion] Sefa5454:
The wifi can't see

Wifi does not see any way that did not improve even though I threw format
[HTC 10 Guides, News, & Discussion] Haldi4803:
[MENTION=1416236]devsk[/MENTION] i'd love to try out and see how much it helps.

If you have a precompiled kernel i'd try it out. Kernelbuilding is way out of my league^^
[HTC 10 Guides, News, & Discussion] devsk:
[MENTION=3056043]Haldi4803[/MENTION]: Its attached. Give it a shot. Note that it is 1.91.617.1. If you are on newer or older ROM than this, there might be issues.
[HTC 10 Guides, News, & Discussion] TotallyAnxious:
[MENTION=3088420]tbalden[/MENTION], this seems like one of those things you like. Useful non frivolous additions to the kernel.
[HTC 10 Guides, News, & Discussion] Haldi4803:
Holy Macaroni.

[MENTION=1416236]devsk[/MENTION] i do definitly See an improvement with the fix.

Full log: http://cloud.tapatalk.com/s/57eb9551c1b0c/BetterBatteryStats-2016-09-28_114940549.txt

And that's on Normal mode with ALL Apps running and Sync activated!

I can totally see why people would want [MENTION=3088420]tbalden[/MENTION] to include these into his Kernel.^^
[HTC 10 Guides, News, & Discussion] tbalden:
Thanks for pointing out. Great job [MENTION=1416236]devsk[/MENTION] gonna try
[HTC 10 Guides, News, & Discussion] htctouchelfin:
Sorry if is a stupid question, but there are 76 pages to read for find the answer... (i have read the last 3/4). so anyone have found the solution on this problem?
[HTC 10 Guides, News, & Discussion] devsk:
This likely means that you are suffering from OOB traffic just like me. The patch reduces that. Can you please do another idle run without reboot again? We want a longer uptime and then go idle to rule out userspace interference.
[HTC 10 Guides, News, & Discussion] devsk:
Like I have said many times, this is a complex problem. It needs analysis on your specific phone and router to see what's ailing it. There is no silver bullet answer so far. You can try the kernel I have attached to see if it helps, which it should if your issue is what this long thread is about.
[HTC 10 Guides, News, & Discussion] Haldi4803:
is OOB router specific and not Network specific?

Well i'm on it. used my phone today like normal. charged it fully, drained it to 98% and now it's in Deep sleep. Do you want another 6h untill midnight or 12-14h idle until morning?

Advantage of charging and unpluging is that the batteryhistory is reset. so battery historian Log will be really nice to see.
[HTC 10 Guides, News, & Discussion] devsk:
OOB is all network management stuff. Some routers use sane defaults, some don't.

Another 6 hour idle run should be fine.
[HTC 10 Guides, News, & Discussion] devsk:
So, the drain is back...:(

You did not make any change, right? Was it a different router? Different location in the house?

What did you do during those 4 minutes of screen ON? Just curious if something ate the battery during those 4mins. Earlier you had only 3 seconds of screen ON.

Let's see the battery stats from before (good run) and after (bad run).
[HTC 10 Guides, News, & Discussion] devsk:
[MENTION=3056043]Haldi4803[/MENTION]: looks like your current troubles are somewhat userspace related. Let's take care of those first and see what happens.
[HTC 10 Guides, News, & Discussion] grega_slo:
No greenify, just viper and elex kernel...
[HTC 10 Guides, News, & Discussion] DeeZZ_NuuZZ:
which apps installed?
[HTC 10 Guides, News, & Discussion] Haldi4803:
Too much issues with Google Services -.-

Full Log: http://cloud.tapatalk.com/s/57ecf23a7ec59/BetterBatteryStats-2016-09-29_123538152.txt

Time for Multirom to Shine :)

Just gota Flash Root and install sciptmanager and BBS on a complete clean Stock ROM and then i'm ready.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hey Haldi, you also run CM13, right ? And you say you don't have any issue's on it ? Can you post the contents of /system/etc/wifi/bcmdhd.cal for CM13 please ?
[HTC 10 Guides, News, & Discussion] devsk:
Here is a sample of what this phone is capable of and more: 3d 3hr (75 hours) off the charger, nearly 6hrs of SOT without powersave mode and screen at 40% brightness with Auto on, with greenify, with wifi/data/gps/sync turned off at night (a total of 24hours turned off out of 75 hours), AND 10% still in the tank, which is likely good for another 30-45min screen on time. By turning wifi off for 24 sleeping hours out of 75 hours, I saved about 15-20% of battery. If we reduce the idle wifi drain (for the rest of the idle hours out of 75 hours), I can easily hit 7hours in the same period of 3 days. That's the power of this phone!!
[HTC 10 Guides, News, & Discussion] devsk:
Is this with my changes or without?
[HTC 10 Guides, News, & Discussion] Haldi4803:
Stock ROM, stock Boot.img didn't flash your zip on this one.

P.S Edited in the Batteryhistorian Logs

I'll just wait a few days and use my phone as normal. Will see if the WiFi issue returns, until now it always has :(
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hey Devsk,

I was just looking at the kernel for the 6p, it doesn't have that BCMPCIE_OOB_HOST_WAKE flag you talked about (nor are there any code references to it). I think it works differently for our device. We have a flag in /system/etc/wifi/bcmdhd.cal:

## Enabling OOB signal - needed for final board
host_wake_opt=0

I assume you don't have that ? Weird thing is that when I delete that flag, my wifi disconnects when I put the phone to sleep, not sure what that's about ... It seems that I need wifi management data to stay connected ...

*EDIT* So instead of removing the flag, I changed its value into 9 and I'm not seeing those wakeups any more. I'm not sure what's going on, the firmware code that processes this option isn't exactly straightforward, lot's of bitshifting going on and it's not printing any errors unfortunately
[HTC 10 Guides, News, & Discussion] donibrasco:
[MENTION=1416236]devsk[/MENTION] http://xdaforums.com/showpost.php?p=68926141&postcount=346
[HTC 10 Guides, News, & Discussion] devsk:
Yeah, that file does not exist for HTC 10. What my patch does is to reduce OOB wakelock timeout instead of disabling it completely. The symptom of wifi getting turned off is same as when I disabled OOB completely.
[HTC 10 Guides, News, & Discussion] devsk:
We will need the other screenshots from this run. We can't take the partial wakelocks from this run and Summary/Kernel wakelocks from previous run and match them up. Apologies if I wasn't clear. Please collect Sumary, Kernel, Partial, Processes from BBS during your next cycle.
[HTC 10 Guides, News, & Discussion] donibrasco:
Of course, collected... didn't post 'em:D
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Hmm I just downloaded the HTC 10 kernel and I think it might be here for you guys: CONFIG_BCMDHD_NVRAM_PATH="/system/etc/calibration"

can you check it please ? Thanks
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
I just found this link: http://www.gossamer-threads.com/lists/nsp/ipv6/54641

So... how does Samsung do that and how do we do that too ? :) This is what we need !

BTW I find it highly disturbing that Samsung figured this out and Google hasnt. Then again, the TS in that thread seems to be unhappy his phone isnt receiving ipv6 packets while in deep sleep. It also says Nexus tries to bypass the problem by limiting the amount of RA's it processes. If only I could find that code in the FW, I could just set it to a (way) higher threshold ...

I also just sent the Google guy in that thread an email, let's see what he says ...
[HTC 10 Guides, News, & Discussion] devsk:
Both of these are very interesting findings indeed! Thanks!

I see that /system/etc/calibration has 2 entries:

#device_wake_opt=1

host_wake_opt=0

My guess is that the first applies to the wifi PCIe device only (all those msm_pcie messages in the 'dmesg') and the second is about the full wakeup from suspend. It would be interesting to know what these values actually mean and what else we can use there.
[HTC 10 Guides, News, & Discussion] devsk:
I feel if we avoid device wakeup, the host wake up won't happen. So, it will be interesting to just move device_wake_opt to 0. I will try that we will see what happens.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
that device_wake_opt is at least for the 6P not being used, if you grep the firmware file you won't find it. I've been experimenting with that host_wake_opt, tried all numbers I thought that would make sense (I currently think it's bit 3-5 that determine its function mostly), but the result was always the same: wifi would disconnect after a few minutes and this would cause heavy wakelocks.

It's interesting how a lot of people with Samsung phones complain about Samsung's 'solution' of just blocking all ipv6 when the phone is in sleep: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=samsung ipv6 sleep And I remember this, I remember that sometimes with my Note 4 I wouldn't get push-messages from whatsapp for example when the phone was in sleep, I'm now starting to think that that was because of their 'solution'. So totally blocking ipv6 doesn't seem a good idea neither.

The google guy behind ipv6, Lorenzo Colitti is also getting lots of critic on his implementation:

https://www.reddit.com/r/ipv6/comments/3wfpn2/i_am_getting_sick_of_lorenzos_attitude_to_ipv6/

Man at this point I wonder if I should just disable ipv6 on my new router and never look back. It's such a mess.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
BTW [MENTION=1416236]devsk[/MENTION] did you know ipv6 can simply be disabled on the phone ? I didnt :)

echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6

Android resets this setting every time you connect to a network though. But maybe this is all that samsung does, on a sleep PM event just set that sys entry to 1 :)
[HTC 10 Guides, News, & Discussion] devsk:
Yeah. That's how I tested the IPv6 theory when grega_slo and another person brought RA up as a reason.
[HTC 10 Guides, News, & Discussion] gekkehenkie11:
Well we could use it to easily implement the 'samsung solution' of disabling ipv6 on screen off. But I'm still not sure yet if that's even a good idea, when you read all the angry samsung user's posts regarding it ...

*EDIT* well someone already did just that, lol, although he just disabled ipv6 at all in the init.d script: http://xdaforums.com/general/networking/guide-disable-ipv6-android-t3298659

Although he also disabled RA, I'm not sure if that's good idea though, you'd say IPv4 RA's are needed for good network functionality
[HTC 10 Guides, News, & Discussion] grega_slo:
RA's give IP addresses, dns info and route info.

If router sends ra packet every 5 minutes and lifetimes of dns, ip and routes are let's say 5 minutes when screen off with blocked ra's for more than 5 minutes will break ipv6. I have valid lifetimes configured to 8 hours and router send ra packet every 7 minutes. Ra's are sent EVERYTIME any client requests ipv6 to all devices on network. So with lots devices connecting and disconnecting this is fun fun fun ?
[HTC 10 Guides, News, & Discussion] grega_slo:
Cange to stock kernel, that helped me...
[HTC 10 Guides, News, & Discussion] live-evil:
I was on stock kernel with this issue. I guess you mean kernel from 1.3 rather thann 1.53 1.55 etc
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
Yeah I just got over 4 hours of SoT over the course of 2 days and 8 hours with Wi-Fi off... With Wi-Fi on the phone is near dead at the 4 1/2 hour SoT mark with roughly 11 hours total... This needs to be fixed, I can't be on LTE all the time.

So going to the WWE 1.3 kernel fixes it? Because I will convert my phone to WWE if it doesn't suffer the bug since I don't use Wi-Fi calling or VoLTE anyway.
[HTC 10 Guides, News, & Discussion] devsk:
1.80 update does not fix this issue...:(
[HTC 10 Guides, News, & Discussion] Genetic517:
I hope we won't have to live with this issue. Maybe next update by htc..?
[HTC 10 Guides, News, & Discussion] EtherealRemnant:
Damn it...

Out of curiosity have you tried the WWE 1.30 to see if it has it? I've thought about trying that... wlan_rx_wake ate up 18% of my battery in 6 hours last night.
[HTC 10 Guides, News, & Discussion] Genetic517:
I'd like to know this as well. If the WWE version fixes this I don't mind making the switch. Viper is on that base anyway....
[HTC 10 Guides, News, & Discussion] Locklear308:
Goodness... I just ordered my HTC10... I hope this gets fixed before I get :0

That LTE only battery life though... wow!