yashsingh1/xdaforums huggingface dataset:
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Here are my observations :

Using the cat command I checked some readings from /sys/class/power_supply/bq27520

On bugged Kappa

just after a minute on MESA 4.5

The dmesg shows just this anomaly

Some other observations ...

I had ****ty battery due to the bug ...To prevent it ,I used the set_capacity to change the capacity ....

echo [COLOR="Red"]35 [/COLOR]> /sys/class/power_supply/bq27520/set_capacity

TBH ,I personally think it's an issue due to bq27520 malfunction ...

y ..The fuel gauge is just throwing some exception :/ ..

On mesa kernel,I changed the value using set_capacity but the battery capacity is reset on reboot ...

I am pretty sure the malfunction is related to bq27520/bq24185 but I dunno where and how ...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
This is precious as Gold, thanks m8!

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] le grande magnetto:
me too!
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Hi there,

THANKS!

That was needed.

Then, the main and only difference between 1.3 and subsequent version, in terms of battery driver changes, is that since 1.4 (included) the patch "0% battery fix - Taken from Bazoocaze" was included.

I checked the Radeon patchlog and the developer, at some point, removed the 0% fix. Which may explain why Radeon doesn't have the issue.

Built two test versions, without the 0%Fix and taking as source the 3.0 kernel version of the battery driver.

This is the 1.7 "not lite" version.

One for Mango (untested, don't have my MiniPro here): http://www.mediafire.com/download/cc9dub848rbtvrz/KaMango488.img

One for Smultron (boots fine on my Mini): http://www.mediafire.com/download/i7ki9b3ya7w4g9b/KaSmultron479.img

Thanks again,

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Lek525:
Have to LWW?
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
It boots on my MiniPro but the bug persists !

[MENTION=373657]kast[/MENTION]

We are dealing with two things here

One is the consequence of the bug and the other is what trigger of the bug

the bq27520 failure is the consequence .

Due to some unforeseen circumstance the battery driver is failing

My last post highlighted mostly the consequence of the bug !

I didn't really check the changelog nor am i planning on checking it .

But Radeon,Mesa and Lupus are all using the 0% fix by bazookaze or atleast they are using a modified battery driver ..

The set_capacity,set_capacity_level,set_voltage,set_current are commands unique to the Patched battery driver ...

Just performing a simple command distinguishes the driver used

ls /sys/class/power_supply/bq27520

Stock driver doesn't have those commands ...

AND

Kernel Panic doesn't have the 100% battery fix yet it has the battery bug ....It uses the stock driver..

Thats what I meant ,when I said I was at my wits end ..

TBH ,the bq27520 is initialized but an exception is thrown ...

I would recommend checking with the Kernel Panic changelog and checking with the patched added to the 1.3 repo ...

have a nice day !
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Muckyfox:
Wouldn't boot on my Mango, redownloaded and even tried removing my scripts.

Freezes at kernel logo and had to do battery pull, flashed back to 1.6rel and battery stuck at 100%.

Fixed battery by flashing other kernel and charging offline for a few seconds then flashed back to 1.6 now reads correctly.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Another two before you hate me totally...

http://www.mediafire.com/download/ofl194lum62l42b/KaMango493.img

and

http://www.mediafire.com/download/ofl194lum62l42b/KaMango493.img

One should boot...

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Both are the same kernels ...and it is still bugged...:angel::cyclops::fingers-crossed:
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] scorpion 21:
As i see that still bug is not fixed on latest versions for mango, version for smultron not booting on my mini, don't know how kast is booted
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
It's very difficult to "fix" the bug ...

The last stable version is 1.3 .

From the dmesg ,we only have three lines which points to the exception generated by battery driver ...

which was due to transfer error ...

The "easiest " way is to start from scratch with 1.3 as base

The harder way is rolling back one commit at a time and testing ...

Another way is comparing with Kernel Panic changelog which has the same bug and rolling back the commits at a time ...

It's hard to debug a bug which you can't replicate ...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] SnakeEyesNinja:
there is a problem , no offense sir but i am using sony xperia live with walkman wt19i your kernel coconut version for me , the problem is i cant get into cwm mode , i pressed the volume down key then up but no effect
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] JimmyX32:
Interesting, for me works with no problem (LWW too).

Make sure you're pressing the volume down key at the right moment. Turn the phone off, then on and wait till the notification LED turns violet. At this moment, press the vol down key and the LED should turn blue (on my phone it takes about 2 seconds) and after a few moments you're in CWM.

If it doesn't work, try to reflash the kernel.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] rahimali:
hi kast, both the above links point to the same file, please check, thanks!
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
The two builds were anyway the same in content. Didn't have my Mango with me and sometimes the build fails because of Ramdisk packing. So built it twice (the second time generally works). I prefer to test it myself before sending it out but as I couldn't, wanted to post two consecutive bulds of the same and ended up putting two times the same link. I must have been pretty asleep while doing it. ;)

Now, this said, what karandpr said is extremely interesting and gave me some good readings over the weekend.

Indeed, on a device that has the issue, the error message which is most probably the key is:

<3>[ 9.910949] msm_i2c msm_i2c.0: (00aa) Error during data xfer (-5)
<3>[ 9.911102] bq27520 0-0055: Failed unseal when checking IT Enable. rc=-5
<3>[ 9.911285] bq27520 0-0055: IT Enable check failed. rc=-5

And more specifically, the very first line:

<3>[ 9.910949] msm_i2c msm_i2c.0: (00aa) Error during data xfer (-5)

Return code -5 is actually mapped in the code to EIO, or in plain English, Input/Output Error.

It's triggered from the code in here.

i2c-msm.c

line 520

if (dev->err) {
dev_err(dev->dev,
"(%04x) Error during data xfer (%d)\n",
addr, dev->err);
ret = dev->err;
goto out_err;

dev->err, in our case, must be holding value "-EIO", which is translated to -5 in the logs.

There aren't many places in that source that alter the value of dev->err.

Actually, there are very few.

My assumption, unfortunately can only be an assumption at the moment, is that when the bug happens we're going through a part of the code that handles the following case:

i2c-msm.c

line 452

/* special case for doing 1 byte read.
* There should be no scheduling between I2C controller becoming
* ready to read and writing LAST-BYTE to I2C controller
* This will avoid potential of I2C controller starting to latch
* another extra byte.
*/

a bit further down that code we do a loop trying to see if we're in "receiving mode"

i2c-msm.c

line 472

while (retries != 2000) {
uint32_t status = readl(dev->base + I2C_STATUS);

if ((status & I2C_STATUS_RX_DATA_STATE)
== I2C_STATUS_RX_DATA_STATE)
break;
retries++;
}

In case we exceed the number of retries then we go into another section called wait_for_int, where, finally, at line 520, the xfer error is logged.

Just before the wait_for_int section, there is an interesting comment in the source:

/*
* Now that we've setup the xfer, the ISR will transfer the data
* and wake us up with dev->err set if there was an error
*/

Which sheds some kind of light to this process, as, frankly speaking, it's way too deep into technical kernel driver stuff for a poor wannabe kernel patcher like me.

What I gather from this is that once you setup the transfer, the "interrupt magic" does the rest and something wrong happens there.

At the moment I'm looking at function msm_i2c_interrupt where in a few cases -EIO is returned.

As I'm still having issues replicating the bug (believe me, I tried countless times and my phones are now running away when they see me), a full dmesg log would be really appreciated!

Thanks a ton!

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
http://pastebin.com/dt7TN8NB

It's useless beyond those three lines imo :/ ...

308-310

and the battery bug exists in stock kernel too ......funny ...

[MENTION=373657]kast[/MENTION]

Rollback the sio fifo_enable patch

i.e

static const int fifo_batch = 1;

to

static const int fifo_batch = 8;

and compile kernel with sio as default scheduler ...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
True that prolly lot of people use SIO... While I use ROW since a while... Could it be the reason?

As I think everything is worth trying to solve this, here's version you requested:

http://www.mediafire.com/download/437oc5oq6h0up6g/KaMango496.img

No sio fifo patch and SIO as default iosSched.

Thanks a ton,

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Not really ...It was just a stupid hunch ...

Technically fifo_batch=1 would have been logical ...But still it was worth a shot :rofl:....
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Shall we go with another shot in the dark?

Removed couple of patches that weren't present in Lupus kernel, added a couple that weren't present in this one

e68d79b Revert "dm-ioctl: prefer strlcpy over strncpy"

cf1ba45 Revert sem.h tweaks

b6cfbd4 crypto: Use correct enum

6d0f98d i2c: Fix section mismatch

The "crypto" one has most definitely nothing to do with this but... You know, the effect of a butterfly here...

http://www.mediafire.com/download/72mb8i6de4wxga3/KaMango497.img

Thanks,

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Doesn't work ...

It's pretty sad imo ...

The bug is on Stock ICS , Kappa 1.4+ and Kernel Panic

but it is not on Radeon ,Mesa and Lupus ...

My phone look butchered ...I think i will switch to CM 9.1 for a while and check if the bug exists on CM ROMs...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Funny thing then is that you mentioned 1.3 is "bugless", although being much more "stock" than later versions...

This thing is driving me crazy...

Thanks again for your precious help!

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Yes it is bugless...

It could be ramdisk error but I replicated the error on CWM so thats not it...

The bug is not on CM 9.1 atleast :p :D

you can check the logcat I pasted before but it's not much of help ...

http://pastebin.com/dt7TN8NB

Someone should make a magical bug detection machine ASAP !!
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
But that is running another kernel as well, right?

Anyway... For the sake of trying one more time to "have" the bug.

I turn off my phone when the battery is something lower than 90% and don't leave enough time for a proper shutdown when I remove the battery?

What I'm doing to try to replicate the bug is:

1) I call for a shutdown by "Switch off phone" in menu.

2) Dialog appears asking confirmation, I click Yes

3) When the shutdown dialog appears I quickly remove the battery for a few seconds, then put it back and turn on the phone again.

Am I missing something? How comes I am the only one not able to replicate the bug?

Thanks,

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
I was bored...

My replication is pretty straight forward ...

1.)Stare at phone angrily

2.) remove the battery

any improper shutdown should trigger the bug ...

My theory in how you are not able to replicate the bug is ,'I have no idea ...Probably my nand is more damaged than yours :silly: :p ..."

Second theory is ,

"I have not sacrificed enough goats to the dark gods ,this year ..."

I couldn't replicate the bug in july but now I can in Mid October ...The dark gods must be angry ....
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kingozzo:
Are the video codecs included in the kernel? Because with kappa 1.7 I cannot play any video.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] $lim $hady:
the bug triggers when you just pull out the battery without calling for shutdown or anything... thats how i got the bug... just pull out the battery without doing anything mentioned above...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kingozzo:
Definitely, the latest release of kappa 1.7 hasn't got video codes, so I cannot play any video. I switched to Panic Kernel and there are no problems.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] job.bousix:
great kernel ! but why is the developement stoping ..

what is gonig on , why the kernel developement seems dead ?! actually v1.7 lite is one of the best and performs great in games , and smooth like butter and stable enough except the battery bug , don't kill it please , you always can develope it from scrach or ask from other devs for help or enything , you can't stop it here because of that bug , and thank you very much :D
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
There are a lot of uncertainites regarding the bug... not only is it extremely difficult to troubleshoot ,it's practically non existent on kast's phone....

Also we have checked both the dmesg just points to three lines which point to two files which are irrelevant ...

Starting from scratch will be a pain because there are LOT of commits ....

First we need to check the first point where the bug is non existent then after each commit ,compile and test the build ....

According to kast one boot.img fails to pack in every two attmpts...

By my rough calculations ,it will take 500 kernels(boot.img) ....per device...

Thats a staggering number to test !!...

So be patient and let kast work as and when he can ....
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] job.bousix:
If the developement is continued then that is great , all i thaught was that the developement is dead , after all thank you
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] dato02:
well i got battery by to by dropping my phone. after i picked it up it said that sim card was removed and only option i had was to restart it. after restarting it just got stuck on 100% battery. it was too annoying for me so moved back to JB (cm10 extended). hole this helped you in any way. wish you luck kast ;)
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Hi there,

I'm not gone, nor I forgot about this kernel. Fact is that, and sorry for repeating myself, I can't get past this stupid battery bug.

Main issue for me is that I have found no way to replicate it, which makes it very hard to debug it.

Some of you were very, very helpful trying to help me out with this, providing investigation results and testing betas I couldn't test myself.

As pointed out, may depend on many things... Even the state the battery is in.

Added to this, there are "pointers" that make the reason for the bug quite a mistery. It was reported that:

Kappa 1.3 didn't have the bug. The only changes in parts of the code that could be behind the bug were removed and still the bug was there.

Some other custom kernels like Mesa don't have the bug. Yet they also come from a stock kernel like the ones having it (Kappa and others). Accurate commit log of other stock-custom kernels is not always helping as patches may be well different.

Stock kernel also has the issue!

Not everybody has the battery bug, even if using the same kernel. Which seem to make it point to some hardware difference / failure.

I do think our little devices still have a "future" and that's why I started making a kernel that would suit my needs. Happy it can be of use to others too. Since I can't rely on a kernel that has a bug like this one, I need to fix it. Let's say it's actually the battery having the issue. Anybody tried with a new battery? In case nobody tried, then I'll be glad to have a brand new battery sent to the one willing to participate to a test. I'm buying a new battery in exchange for the old one. In case the new battery solves the problem, I'll kindly ask that person to send me the old battery. I pay both for the new battery and shipping fees. He or she can of course keep the new battery that was sent. In case the new battery doesn't solve the issue, then I'll have to buy a phone that has the issue.

In case somebody is interested in the offer, please contact me via PM. First to contact me and doesn't live on the other side of the planet (I live in EU), gets the new battery. I do hope mods don't see this as an "advertisement", I'm just trying to get this thing sorted out.

Thanks,

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] grailwt19i:
Maybe someone near you that has the bug can send their phone and battery to you so you can test it. (hopefully someone with spare phone that they can use while they send theirs to kast)

Come on guys :) let's not make kast spend money to fix this bug. He already spent lots time and effort for this awesome kernel.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Pity I live on other side of the planet :p ...would have just swapped phones though :victory: :D ..
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] job.bousix:
Are dmesg not able to help fixing the problem ?? or what about uploading dmesg by every user that has the bug , then there will be nember of dmesgs to make the problem clearer comparing to fixed phone dmesg ?
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Hi there,

already got a log from a phone having the battery issue. Problem is that it does tell where it goes wrong, doesn't give enough details on the reason for it.

I do have a proposal though. If someone is willing to test a "special" version in which I added extra-and-more logging to various internal functions, maybe it could help when I receive that log. Although being able to replicate it myself could be faster ;)

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
[MENTION=373657]kast[/MENTION]

Lets do it ...In any case my phone's touchscreen is 50% damaged .....What worse could happen :p :D :victory:
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] a|\|droid_user:
If you want to reproduce the bug,simply pull out the battery while the phone is still on...

when u start the phone again u will have battery level stuck at 100%.

tell me if it doesnt work for you...

I was wondering if u can provide a way to patch a cm kernel with 2-way call recording..can provide me some info/guide perhaps...

regards..looking forward to a awesome kappa v1.7..!
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] dark4m:
Hi Cast,

I didn't have this bugg untill i flashed ( mesa-3.2) while the battery was like 70%

and after playing with it for some time<

went back to kappa 1.6< and batt was about 60 some% and removed the battery before booting to system I mean flash kernel then removed it for like 2 minutes

then booted it, and bingo!!! Here is the 100% battery bugggg,

it was a chalange for me also cause i didn't have it just like you<

my phone is Mango Mini Pro with stock rom,

Big thanks for your time and effort to bring us the best of our little sweet phones.

best regards...
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
A new Kappa1.7Lite for Mango is on its way...

Brace for impact... And just wish very hard this one fixes the bug.

Applied some patches to the I2C bus, we'll see how it behaves.

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kingozzo:
Kast I cannot play any video with the latest beta of your kernel, please fix this issue! :good:

Everything ok with MESA, Lupus, and Panic.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Hi there,

another shot in the dark. Patched I2C bus driver. Someone with a MiniPro / Mango and the battery bug wants to have a go at it?

http://www.mediafire.com/download/48he96vk607e1vx/KaMango543.img

In case this works, all the other builds will come to. Of course, [MENTION=3457878]kingozzo[/MENTION], I'll take care of the video codec problem too.

This build here is only to tackle the 100% battery bug. Hopefully it does.

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] karandpr:
Hmmm

Yes and No

In five battery removals ...the battery bug appeared once but vanished on reboot ....

Kudos !! and excellent work..

Edit: Also ,I can't vouch for that one time 100% bug happened since this happened after that

....

Strange ...I am on Stock Rooted ICS
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Cheers!

Let's have someone with a Mini / Smultron try too, let's check if the battery bug is really "no more":

http://www.mediafire.com/download/ebb6xnfcadcm6dc/KaSmultron481.img

I can't test this build right now, hopefully it boots ;)

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] scorpion 21:
It finally boots :good:

But there is no kamenu, it is like you base kernel on previous versions where there was no kamenu
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Hi,

thanks for testing it. I'm more focusing on the battery bug for the moment. I appreciate you reporting this problems, don't worry, like for the video problem, all's gonna be fixed in the final. Did you have the battery bug with the previous versions?

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] scorpion 21:
No problem, I'm using this kernel for long so, I will be interested in testing too. For battery bug I never experienced because my phone just

won't boot on al previos bersions of 7 like beta or original, thats is strange, but this version boot and there is no batery bug
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Cheers!

Let's see how it goes with the others...

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] dark4m:
No battery bug here my dear,

So it looks like Kappa back on track

Chears...

Mango mini pro with stock ics.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] moolokow:
very nice development for kappa kernel :) im am looking forward for new coconut kappa kernel. :)
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Arun Av:
Two feedbacks stating that battery bug is fixed!!

Can't wait to test on my mini! *Fingers crossed*
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] kast:
Yeah, just hope this evil battery bug is fixed once for good.

Ka.
[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] Niteshdcool:
Well i have been following the thread for quite some time.. Abt the new battry thing u were saying.. I rooted my phone when it was like 5 months old and the first thing i did (after soft bricking my phone once) was to flash kappa kernel.. I havnt faced any battry bug yet.. Have removed my battry in many cases when the phone was on and still no bug.. The battry was comparatively newer to those who used flashed kappa after the warranty was over.. Soo hope this helps.. :D

And ya best of luck with that bug.. People have already reported that the bug is gone in few versions and i hope the kernal will get even better in the days to come.. :)

THERE HE GOES.. CRUSH ITTT.. CRUSH THAT FREAKING BUGG.!!! *GoingInsane* :P