Quote:
Originally Posted by vzihome
Muziling had mentioned to ACL about a battery hack he found, ACL said that he would release it on next build don't know if he did on this build...correct me if I'm wrong!
Sent from my Touch Pro 2 using Tapatalk
|
Ahh, you are correct. Well the hack was to avoid these nasty div by 0 we used to get in the logs.
Code:
diff --git a/arch/arm/mach-msm/htc_battery_smem.c b/arch/arm/mach-msm/htc_battery_smem.c
index 1d9e750..7967b28 100644
--- a/arch/arm/mach-msm/htc_battery_smem.c
+++ b/arch/arm/mach-msm/htc_battery_smem.c
@@ -1371,7 +1371,12 @@ static int htc_rhod_batt_corr( struct battery_info_reply *buffer )
/* TODO: temp algo is not ok..if someone have the timte -> must look into the driver */
buffer->batt_tempRAW = ( buffer->batt_tempRAW * 5200 ) / htc_adc_range;
- av_index = ( buffer->batt_tempRAW * 18 ) / ( 2600 - buffer->batt_tempRAW );
+ /* HACK: This is a giant hack since if batt_tempRAW = 2600 we get a div by 0 */
+ if (buffer->batt_tempRAW < 2600) {
+ av_index = ( buffer->batt_tempRAW * 18 ) / ( 2600 - buffer->batt_tempRAW );
+ } else {
+ av_index =1347;
+ }
buffer->batt_tempRAW = htc_battery_temperature_lut( av_index );
if ( buffer->batt_tempRAW < 250 ) /* fixed til so long we can get constant values - otherwise the algo wouln'T work good */
buffer->batt_tempRAW = 250;
I'll prioritise this if everyone is getting less and less batt time now.