|
2011-05-11
, 20:24
|
Posts: 2,154 |
Thanked: 8,464 times |
Joined on May 2010
|
#532
|
The Following User Says Thank You to pali For This Useful Post: | ||
|
2011-05-11
, 21:12
|
Posts: 458 |
Thanked: 783 times |
Joined on Jan 2010
@ France
|
#533
|
As I wrote, I cannot change informations exported to HAL. HAL is userspace application which does not have anythink with my patches.
If you have problem with incorrect battery values, check first what kernel driver are reporting. It is in folder /sys/class/power_supply/bq27200-0 and in file uevent.
-bash-2.05b# cat /sys/class/power_supply/bq27200-0/uevent PHYSDEVPATH=/class/i2c-adapter/i2c-2/2-0055 PHYSDEVBUS=i2c PHYSDEVDRIVER=bq27x00-battery POWER_SUPPLY_NAME=bq27200-0 POWER_SUPPLY_TYPE=Battery POWER_SUPPLY_STATUS=Charging POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_VOLTAGE_NOW=4103000 POWER_SUPPLY_CURRENT_NOW=-449463 POWER_SUPPLY_CAPACITY=47 POWER_SUPPLY_TEMP=323 POWER_SUPPLY_TIME_TO_EMPTY_NOW=0 POWER_SUPPLY_TIME_TO_EMPTY_AVG=0 POWER_SUPPLY_TIME_TO_FULL_NOW=9720 POWER_SUPPLY_TECHNOLOGY=Li-ion POWER_SUPPLY_CHARGE_FULL=1531708 POWER_SUPPLY_CHARGE_NOW=715785 POWER_SUPPLY_CHARGE_FULL_DESIGN=2056320
--- battery.c.orig 2011-01-17 13:39:36.000000000 +0100 +++ battery.c 2011-01-18 18:42:10.000000000 +0100 @@ -5,6 +5,7 @@ #include <dbus/dbus.h> #include <stdio.h> +#include <stdlib.h> #include <libhildondesktop/libhildondesktop.h> @@ -55,7 +56,12 @@ static gboolean battery_plugin_on_timeou } else { - battery->percent = libhal_device_get_property_int(ctx, "/org/freedesktop/Hal/devices/bme", "battery.charge_level.percentage", NULL); + if ( libhal_device_property_exists(ctx, "/org/freedesktop/Hal/devices/computer_power_supply_battery_bq27200_0", "battery.charge_level.percentage", NULL) ) + battery->percent = libhal_device_get_property_int(ctx, "/org/freedesktop/Hal/devices/computer_power_supply_battery_bq27200_0", "battery.charge_level.percentage", NULL); + else if ( system("pgrep -f ^/usr/sbin/bme_RX-51") == 0 ) + battery->percent = libhal_device_get_property_int(ctx, "/org/freedesktop/Hal/devices/bme", "battery.charge_level.percentage", NULL); + else + battery->percent = 0; } //GtkWidget *widget = GTK_WIDGET(data);
+ if ( libhal_device_property_exists(ctx, "/org/freedesktop/Hal/devices/computer_power_supply_battery_bq27200_0", "battery.charge_level.percentage", NULL) ) + battery->percent = libhal_device_get_property_int(ctx, "/org/freedesktop/Hal/devices/computer_power_supply_battery_bq27200_0", "battery.charge_level.percentage", NULL);
+ else if ( system("pgrep -f ^/usr/sbin/bme_RX-51") == 0 ) + battery->percent = libhal_device_get_property_int(ctx, "/org/freedesktop/Hal/devices/bme", "battery.charge_level.percentage", NULL);
+ else + battery->percent = 0;
-bash-2.05b# lshal -u /org/freedesktop/Hal/devices/computer_power_supply_battery_bq27200_0 | grep battery.charge_level.percentage && lshal -u /org/freedesktop/Hal/devices/bme | grep battery.charge_level.percentage battery.charge_level.percentage = 56 (0x38) (int) battery.charge_level.percentage = 95 (0x5f) (int)
The Following 2 Users Say Thank You to colin.stephane For This Useful Post: | ||
|
2011-05-11
, 21:37
|
|
Posts: 2,222 |
Thanked: 12,651 times |
Joined on Mar 2010
@ SOL 3
|
#534
|
|
2011-05-11
, 21:44
|
Posts: 458 |
Thanked: 783 times |
Joined on Jan 2010
@ France
|
#535
|
bq27x00.ko kernel module is deprecated as it breaks bme by exclusively occupying the I2C bus to that chip. BME otoh wants to access the chip directly, and so segfaults whenever bq27x00.ko is loaded.
Please keep this in mind
thanks
/jOERG
clear && ID=$(id -un) ; if [ ${ID} != "root" ] ; then echo "You are not 'root', please use this command line as 'root' ..." ; else echo "Ok, you are 'root' ..." ; if grep -q "blacklist bq27x00_battery" /etc/modprobe.d/blacklist 2>/dev/null ; then echo "Patch already applyed, nothing to be done ..." ; echo "" ; else echo "Applying patch now ..." ; echo "blacklist bq27x00_battery" >>/etc/modprobe.d/blacklist ; echo "" ; echo "DONE, PLEASE REBOOT YOUR DEVICE ..." ; echo "" ; fi ; fi
|
2011-05-12
, 12:23
|
|
Posts: 44 |
Thanked: 7 times |
Joined on Feb 2010
@ Vienna / Austria
|
#536
|
|
2011-05-12
, 13:53
|
Posts: 650 |
Thanked: 497 times |
Joined on Oct 2008
@ Ghent, Belgium
|
#537
|
|
2011-05-12
, 16:46
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#539
|
|
2011-05-12
, 20:37
|
|
Posts: 968 |
Thanked: 663 times |
Joined on Jun 2010
@ Australia (Melbourne/vic) / Lebanon (Zgharta/north)
|
#540
|
Tags |
battery-status, bq27x00_battery, kernel, kernel-power, misiak4king, noobs-cant-read, pali4president, patches, readdirections, revolverspinyou |
|
The values reported are BAD when fetched with the command (you can trust me on that) :
Easy to verify step by step, if I modprobe -r bq27x00_battery then on the desktop, after some seconds for the applet refresh, the value revert back to the bme value and report properly 25% of battery available, if I modprobe the backported driver then, the applet refresh and show 0% of battery available ...
I have installed the v47 since you released it, and no problem until today.
So the question is : What I have made today ?
Answer, here is how I triggered this BUG :
I have a desktop battery charger, and yesterday night I have omitted to charge my N900, so this morning I have powered off the N900 because I have no more battery power and the device reported 2%.
Then I have replaced the battery by the one fully charged by my desktop charger some days ago, and during today the problem occur ...
Since the problem occur, the value reported for parameter 'battery.charge_level.percentage' is '0' and this is the value used by the applet 'battery' you patched ...
How can you explain, today, my applet reported 0% battery available during all the afternoon ?
It look like bme values reported take care of this scenario (changing physically the used battery by one fully charged) where the new driver does not ...
So there is really a bug when we fetch information from the backported driver ...
A++
Last edited by colin.stephane; 2011-06-04 at 22:19. Reason: Clarification on step by step procedure to track the problem ...