FORUMS
Remove All Ads from XDA

[MOD] charger repair - /system/bin/charger - Official SE charger

392 posts
Thanks Meter: 247
 
Post Reply Email Thread
This file protects your phone from running below a dangerous level and potentially rendering X10 devices to an unusable or hard brick.

Hello XDA developers

Latest Version 3 :: Please use the latest version and report back the contents of - /data/local/tmp/extract_charger_status.txt - with any issues and state which firmware you were using this with.

I've identified an issue after killing an X10a involving the offline charger. I hope the following can save any further problem's by using the following charger_fix_v3.zip with xRecovery as it is a simple case of rebooting into xRecovery and loading the update. This file is safe for X10 owners as it introduces a stock SE file back to the system, which if not present can render the system a brick.

[ROM] - TripNRaVeR - TripNMiUI - should not be used with this patch as an unknown issue exists with the charger that is currently being researched, until further notice DO NOT apply this update if you are using TripNMiUI or any variant.

There is no SETUID for Android. Android developers state there is no need as Dalvik code will never require elevated or root permissions and hence, it introduces a potential security flaw.

Q: What is it?
A: SE Official charger file - /system/bin/charger - has special permissions which can not be set by root or any other user, the file need's to be moved into place, as it contains setuid or the "Sticky" Unix file system permission.

Wait! How about - chmod 06755 or chmod 04755 - I hear you say? Forget it.. This is not a simple file, it's a Linux binary an ELF Linker file that contains critical system links to (among others//).. the following;

Code:
/sys/class/power_supply/battery/capacity
/sys/devices/platform/msm_pmic_vibrator/enable
/system/bin/chargemon
Nothing special here? Well if you say so! Wait does this look familiar to anyone?

Code:
/sys/class/leds/lv5219lg
RGB LED interface

WLOD (white led of death) issues, or seeing three red blinking led lights

Code:
/sys/class/power_supply/usb/online
/sys/class/power_supply/ac/online
/system/etc/semc/chargemon
This charger file defines the CPU scaling and governor, which is of massive importance to anyone having issues with poor battery life and general performance of their custom rom

For anyone working with customizations around chargemon, you need to include this file and ensure to include - /system/bin/charger - as an entry in any modifications to chargemon right after

#!/system/

It should ALWAYS be the 2nd line in the chargemon file. No questions asked, this file must be optimized and present, it can not be a touch file with any old permission set assigned!

(*ATTN ALL ROM DEVELOPERS*)

Important lesson when handling Android files. You must set the correct permissions and assign the correct security groups - setuid - as they are held in memory. If a part of code executes and is unable to reach the expected memory - WLOD

Not to be patronizing or arrogant, I suspect the issue arrived with Froyo (now in Beta 4), which made it's way via TripNrAvER to a further ROM developers and the issue exists and is present in many (possibly all 2.2.1 Froyo x10 roms) although most user complaint's arrive in strange or hard to understand messages, which is too often interpreted around the forums as just being n00bish and not knowing how to use SEUS or Flashtool...

This thread is specifically for ROM developers and is a deep technical issue. Please do not move this thread to apps or general

Quote:

/data/local/tmp/charger.tar.gz

Thank you DoomLoRD, Androxyde, Bin4y, Zdzihu & Jerpelea for their excellent work and patience, who without their presence and effort on XDA the X10 would never be half of what it is today

EDIT: - v1 was not copying to location correctly - v2 uploaded
Attached Files
File Type: zip charger_fix_v1.zip - [Click for QR Code] (11.2 KB, 564 views)
File Type: zip charger_fix_v2.zip - [Click for QR Code] (10.8 KB, 331 views)
File Type: zip charger_fix_v3.zip - [Click for QR Code] (10.9 KB, 822 views)
The Following 22 Users Say Thank You to MrHassell For This Useful Post: [ View ] Gift MrHassell Ad-Free
1st May 2011, 02:39 PM |#2  
OP Senior Member
Flag Melbourne
Thanks Meter: 247
 
Donate to Me
More
updates
Latest! - zdzihu has released a new version which is for Beta 4 variants specifically - http://www.mediafire.com/?5rr5ygl1udldla1

This fix should not be applied on Trip's MIUI ROM until further notice!

Thanks to My_Immortal & kmilof for pointing out that there is an issue with TripNRavER MIUI

Unsure why there was a problem with TripNMui, I will investigate. The permission groups are different and am investigating.

1: Replaces a critical system file with correct system permissions.

How to tell if this exists or if you need this update? It's very easy Using a file explorer (i.e; Root Explorer) also others work, browse to the directory; /system/bin/ <- look for the file charger as @cobrato pointed out, it should be identical.

14356 = Binary file size
-rwsr-xr-x = Unix file permission

The permissions are the important part and during the night it was posed, this could be handled with the following command - busybox chmod u+s - while this is true, it is context sensitive. For example if this command is issued in the context of root, the setuid is included and created for root. This file belongs to a special group which can't be modified. If anything it should reset permissions on a file which exists and enable correct permissions on the charger and enable it to work again.

It appears to have been too late for one x10 last night. I received another P.M of death by USB and the problem is real and has claimed many devices, although I am having a hard time pinpointing what caused it, I'm unable to say that much other than this is potentially a cure if even partial as pointed out by picking up on a modification from DooMLoRD, to optimize offline charging.

To prevent your x10 from battery death after modification, never allow the battery to run below 5% - replacing battery might be the only hope if this happens!
1st May 2011, 02:51 PM |#3  
gregbradley's Avatar
Retired Forum Moderator
Flag Probably marking work or drinking beer...Maybe both
Thanks Meter: 6,632
 
Donate to Me
More
Thanks for your effort in explaining what this zip does.
Not entirely sure what it all means but I understand it to mean everyone on any 2.2 CUSTOM ROM should flash this. I will do so and report back any issues.
PS. I have never had a WLOD FC yet.
BB58 wolfbreak latest update and tweaks test zip. Stock kernal

EDIT: Flashed onto WB ROM...no issues so far.

Sent from my X10i using XDA App
1st May 2011, 03:04 PM |#4  
colossus's Avatar
Retired Senior Moderator
Thanks Meter: 3,120
 
Donate to Me
More
@mrHassell

my question is, do we need to flash this everytime we flash a new rom or is it something that just needs to be done once?

I have said before, but thanks again for your tirelress work, you too give a great deal to our x10 forum, thanks for your hardwork my friend.
1st May 2011, 03:27 PM |#5  
jimbo77's Avatar
Recognized Contributor
Flag Guatemala
Thanks Meter: 2,830
 
Donate to Me
More
Quote:
Originally Posted by smartgardens

@mrHassell

my question is, do we need to flash this everytime we flash a new rom or is it something that just needs to be done once?

Well if the new Custom Roms that will be developed from now onwards include it you won't need to flash it every time but lets said that you'll be flashing FreeX10Beta4 or WB CM 6 ROMS you'll have to do it every time since those ROMS doesn't include it for now and every time you flash a new ROM it overwrites the existing /system/bin folder...

Jim
The Following 2 Users Say Thank You to jimbo77 For This Useful Post: [ View ] Gift jimbo77 Ad-Free
1st May 2011, 03:50 PM |#6  
Senior Member
Thanks Meter: 12
 
More
not so sure what is the uses.
1st May 2011, 03:54 PM |#7  
Senior Member
Flag Linares
Thanks Meter: 18
 
More
i flashed this in TripNMiUI FINAL 1.0.63.. after bootanimation screen's turn black, cant do anything =/.
1st May 2011, 04:05 PM |#8  
iridaki's Avatar
Retired Forum Moderator
Flag Edinburgh, Scotland
Thanks Meter: 5,234
 
Donate to Me
More
Quote:
Originally Posted by kmilof

i flashed this in TripNMiUI FINAL 1.0.63.. after bootanimation screen's turn black, cant do anything =/.

I flashed it over Trip's 1.0.2 and everything went fine. Phone booted normally.
I haven't 100% understood what it does, but it certainly did not do me any damage.
Did you make a nandroid before flashing?
1st May 2011, 04:26 PM |#9  
Senior Member
Flag Linares
Thanks Meter: 18
 
More
Quote:
Originally Posted by My_Immortal

I flashed it over Trip's 1.0.2 and everything went fine. Phone booted normally.
I haven't 100% understood what it does, but it certainly did not do me any damage.
Did you make a nandroid before flashing?

yup, i did make a nandroid before flashing, i could restore it and the everything went back to normal. :P

maybe something changed between trip 1.0.2 and 1.0.63 :P
1st May 2011, 04:33 PM |#10  
Neo.'s Avatar
Senior Member
Flag Gods Own Place
Thanks Meter: 124
 
Donate to Me
More
Thank you for this one
The Following User Says Thank You to Neo. For This Useful Post: [ View ] Gift Neo. Ad-Free
1st May 2011, 04:40 PM |#11  
kozxmartt's Avatar
Senior Member
Thanks Meter: 60
 
More
I flashed this over reindeiro's scramble ROM without any issues. Thanks for this.

Sent from my X10i using XDA App
Post Reply Subscribe to Thread

Tags
battery, chargemon, charger, wlod

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes