Freerunner battery and APM
Robert Piasek
robert.piasek at member.fsf.org
Sun Jan 18 22:15:39 CET 2009
Hi,
Some time ago Raster added HAL backend support to E's battery applet. It's
probing hal and based on it's output indicates battery charge. I wanted to
test this new feature and surprisingly the results were a bit off from what
I've expected. I decided to find the cause of my problem.
On APM enabled .config lshal | grep bat gives me 3 battery capable devices
(info.capabilities = {'battery'}):
neo ~ # lshal | grep bat -A10
udi = '/org/freedesktop/Hal/devices/apm_battery'
battery.charge_level.current = 100 (0x64) (int)
battery.charge_level.design = 100 (0x64) (int)
battery.charge_level.last_full = 100 (0x64) (int)
battery.charge_level.percentage = 100 (0x64) (int)
battery.charge_level.unit = 'percent' (string)
battery.is_rechargeable = true (bool)
battery.present = true (bool)
battery.rechargeable.is_charging = false (bool)
battery.rechargeable.is_discharging = false (bool)
battery.remaining_time = 3932100 (0x3bffc4) (int)
battery.technology = 'unknown' (string)
battery.type = 'primary' (string)
info.capabilities = {'battery'} (string list)
info.category = 'battery' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Battery Bay' (string)
info.udi = '/org/freedesktop/Hal/devices/apm_battery' (string)
linux.apm_path = '/proc/apm' (string)
linux.apm_type = 0 (0x0) (int)
linux.hotplug_type = 5 (0x5) (int)
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_usb'
battery.type = 'usb' (string)
info.capabilities = {'battery'} (string list)
info.category = 'battery' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Generic Battery Device' (string)
info.subsystem = 'power_supply' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_usb'
(string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'power_supply' (string)
linux.sysfs_path = '/sys/class/power_supply/usb' (string)
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_battery'
battery.charge_level.current = 0 (0x0) (int)
battery.charge_level.design = 0 (0x0) (int)
battery.charge_level.last_full = 1156 (0x484) (int)
battery.charge_level.percentage = 100 (0x64) (int)
battery.charge_level.rate = 0 (0x0) (int)
battery.is_rechargeable = true (bool)
battery.present = true (bool)
battery.rechargeable.is_charging = false (bool)
battery.rechargeable.is_discharging = false (bool)
battery.reporting.last_full = 1156 (0x484) (int)
battery.reporting.rate = 0 (0x0) (int)
battery.reporting.technology = 'Li-ion' (string)
battery.reporting.unit = 'mAh' (string)
battery.technology = 'lithium-ion' (string)
battery.type = 'primary' (string)
battery.voltage.current = 4183 (0x1057) (int)
info.capabilities = {'battery'} (string list)
info.category = 'battery' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Generic Battery Device' (string)
info.subsystem = 'power_supply' (string)
info.udi =
'/org/freedesktop/Hal/devices/computer_power_supply_battery_battery' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'power_supply' (string)
linux.sysfs_path = '/sys/class/power_supply/battery' (string)
udi = '/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_adapter'
ac_adapter.present = false (bool)
info.capabilities = {'ac_adapter'} (string list)
info.category = 'ac_adapter' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Generic AC Adapter Device' (string)
info.subsystem = 'power_supply' (string)
info.udi =
'/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_adapter'
(string)
linux.hotplug_type = 2 (0x2) (int)
--
udi = '/org/freedesktop/Hal/devices/platform_bq27000_battery_0'
info.linux.driver = 'bq27000-battery' (string)
info.parent = '/org/freedesktop/Hal/devices/platform_gta02_hdq_0' (string)
info.product = 'Platform Device (bq27000-battery.0)' (string)
info.subsystem = 'platform' (string)
info.udi = '/org/freedesktop/Hal/devices/platform_bq27000_battery_0'
(string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'platform' (string)
linux.sysfs_path = '/sys/devices/platform/sc32440_fiq.0/gta02-hdq.0/bq27000-
battery.0' (string)
platform.id = 'bq27000-battery.0' (string)
on .config without APM I've got two of them:
neo lshal | grep bat -A10
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_usb'
battery.type = 'usb' (string)
info.capabilities = {'battery'} (string list)
info.category = 'battery' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Generic Battery Device' (string)
info.subsystem = 'power_supply' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_usb'
(string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'power_supply' (string)
linux.sysfs_path = '/sys/class/power_supply/usb' (string)
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_battery'
battery.charge_level.current = 0 (0x0) (int)
battery.charge_level.design = 0 (0x0) (int)
battery.charge_level.last_full = 1156 (0x484) (int)
battery.charge_level.percentage = 100 (0x64) (int)
battery.charge_level.rate = 0 (0x0) (int)
battery.is_rechargeable = true (bool)
battery.present = true (bool)
battery.rechargeable.is_charging = true (bool)
battery.rechargeable.is_discharging = false (bool)
battery.reporting.last_full = 1156 (0x484) (int)
battery.reporting.rate = -36 (0xffffffdc) (int)
battery.reporting.technology = 'Li-ion' (string)
battery.reporting.unit = 'mAh' (string)
battery.technology = 'lithium-ion' (string)
battery.type = 'primary' (string)
battery.voltage.current = 4185 (0x1059) (int)
info.capabilities = {'battery'} (string list)
info.category = 'battery' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Generic Battery Device' (string)
info.subsystem = 'power_supply' (string)
info.udi =
'/org/freedesktop/Hal/devices/computer_power_supply_battery_battery' (string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'power_supply' (string)
linux.sysfs_path = '/sys/class/power_supply/battery' (string)
udi = '/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_adapter'
ac_adapter.present = false (bool)
info.capabilities = {'ac_adapter'} (string list)
info.category = 'ac_adapter' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
info.product = 'Generic AC Adapter Device' (string)
info.subsystem = 'power_supply' (string)
info.udi =
'/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_adapter'
(string)
linux.hotplug_type = 2 (0x2) (int)
--
udi = '/org/freedesktop/Hal/devices/platform_bq27000_battery_0'
info.linux.driver = 'bq27000-battery' (string)
info.parent = '/org/freedesktop/Hal/devices/platform_gta02_hdq_0' (string)
info.product = 'Platform Device (bq27000-battery.0)' (string)
info.subsystem = 'platform' (string)
info.udi = '/org/freedesktop/Hal/devices/platform_bq27000_battery_0'
(string)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'platform' (string)
linux.sysfs_path = '/sys/devices/platform/sc32440_fiq.0/gta02-hdq.0/bq27000-
battery.0' (string)
platform.id = 'bq27000-battery.0' (string)
Now I've got some questions:
1) why udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_usb'
has info.capabilities = {'battery'} (string list)? Since it's not a battery
(linux.sysfs_path = '/sys/class/power_supply/usb' (string)) it only confuses
userspace programs.
2) why udi =
'/org/freedesktop/Hal/devices/computer_power_supply_battery_battery' doesn't
correctly report
battery.charge_level.current = 0 (0x0) (int)
battery.charge_level.design = 0 (0x0) (int)
...
the same way as udi = '/org/freedesktop/Hal/devices/apm_battery' does?
3) is it possible to have battery.charge_level.design in the same units as
battery.charge_level.last_full? Wouldn't it be better to have them consistent?
For the reference my laptop reports only 1 battery device:
lshal | grep bat
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'
battery.charge_level.current = 52650 (0xcdaa) (int)
battery.charge_level.design = 69900 (0x1110c) (int)
battery.charge_level.last_full = 52650 (0xcdaa) (int)
battery.charge_level.percentage = 100 (0x64) (int)
battery.charge_level.rate = 0 (0x0) (int)
battery.is_rechargeable = true (bool)
battery.model = 'A6-4224' (string)
battery.present = true (bool)
battery.rechargeable.is_charging = false (bool)
battery.rechargeable.is_discharging = false (bool)
battery.reporting.current = 52650 (0xcdaa) (int)
battery.reporting.design = 69900 (0x1110c) (int)
battery.reporting.last_full = 52650 (0xcdaa) (int)
battery.reporting.rate = 0 (0x0) (int)
battery.reporting.technology = 'Li-ion' (string)
battery.reporting.unit = 'mWh' (string)
battery.serial = '' (string)
battery.technology = 'lithium-ion' (string)
battery.type = 'primary' (string)
battery.vendor = 'ASUSTEK' (string)
battery.voltage.current = 16536 (0x4098) (int)
battery.voltage.design = 14800 (0x39d0) (int)
battery.voltage.unit = 'mV' (string)
info.capabilities = {'battery'} (string list)
info.category = 'battery' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'
(string)
Kernel: andy-tracking 2.6.28 4ff379a06a70e179
HAL: 0.5.11
Regards,
Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20090118/d92bbe51/attachment.pgp
More information about the openmoko-kernel
mailing list