[PATCH] fix APM support and set/fix system.formfactor=laptop

Richard Hughes hughsient at gmail.com
Mon Oct 24 05:39:08 PDT 2005


On Mon, 2005-10-24 at 00:10 +0200, Danny Kukawka wrote:
> Hi,
> 
> this patch fix several things:
> 
> * fix detection of battery for APM: prevent to read battery info if there is 
> no battery present. There is no battery if 'battery_percentage < 0' (and not 
> '<= 0' ) or/and if battery_status flag is 0xff.
> * fixed delete battery keys for APM if battery is removed
> 
> * Added detection of laptops to APM (if battery present) and ACPI (if battery 
> bay or/and LID-Button) and set key system.formfactor=laptop
> 
> * fixed set system.formfactor from smbios.chassis.type to prevent overwrite 
> otherwise set key (e.g. from APM/ACPI/PMU code).
> 
> Please review.

I've booted my machine with acpi=off (so APM kicks in), and removed
hald-probe-smbios (so the smbios keys are not set) and tested your
patch. I've also tested removing and adding the battery.

Everything works correctly. I've attached the differences from pre-patch
to post-patch for your information.

Good to merge in my opinion. Thanks for doing this work...

Ohh, and battery.charge_level.last_full *is* required in my opinion, as
it provides consistency, so that the applications do not have to do
special casing, like this:

type = read from hal "battery.type"
if type == "percentage" then total = 100
else, total read from hal "battery.charge_level.last_full"

they can just do:

total = read from hal "battery.charge_level.last_full"

or do I misunderstand the question?

Richard.
-------------- next part --------------
--- lshal1.txt	2005-10-24 13:15:00.000000000 +0100
+++ lshal3.txt	2005-10-24 13:29:11.000000000 +0100
@@ -1,8 +1,8 @@
 
 Dumping 63 device(s) from the Global Device List:
 -------------------------------------------------
-udi = '/org/freedesktop/Hal/devices/apm_1'
-  info.udi = '/org/freedesktop/Hal/devices/apm_1'  (string)
+udi = '/org/freedesktop/Hal/devices/apm_ac_adapter'
+  info.udi = '/org/freedesktop/Hal/devices/apm_ac_adapter'  (string)
   linux.hotplug_type = 5  (0x5)  (int)
   ac_adapter.present = true  (bool)
   info.capabilities = {'ac_adapter'} (string list)
@@ -12,8 +12,8 @@ udi = '/org/freedesktop/Hal/devices/apm_
   linux.apm_type = 1  (0x1)  (int)
   linux.apm_path = '/proc/apm'  (string)
 
-udi = '/org/freedesktop/Hal/devices/apm_0'
-  info.udi = '/org/freedesktop/Hal/devices/apm_0'  (string)
+udi = '/org/freedesktop/Hal/devices/apm_battery'
+  info.udi = '/org/freedesktop/Hal/devices/apm_battery'  (string)
   linux.hotplug_type = 5  (0x5)  (int)
   battery.charge_level.percentage = 100  (0x64)  (int)
   battery.rechargeable.is_discharging = false  (bool)
@@ -1437,18 +1437,6 @@ udi = '/org/freedesktop/Hal/devices/comp
   org.freedesktop.Hal.Device.SystemPowerManagement.method_signatures = {'i', '', 'b'} (string list)
   org.freedesktop.Hal.Device.SystemPowerManagement.method_names = {'Suspend', 'Hibernate', 'SetPowerSave'} (string list)
   info.interfaces = {'org.freedesktop.Hal.Device.SystemPowerManagement'} (string list)
-  system.product = 'Satellite Pro A10 PSA15E-01PJY-EN'  (string)
-  system.vendor = 'TOSHIBA'  (string)
-  smbios.chassis.type = 'Notebook'  (string)
-  smbios.chassis.manufacturer = 'TOSHIBA'  (string)
-  smbios.system.uuid = '6849C680-E830-18F1-8015-B1D083890390'  (string)
-  smbios.system.serial = 'X3890390G'  (string)
-  smbios.system.version = 'PSA15E-01PJY-EN'  (string)
-  smbios.system.product = 'Satellite Pro A10'  (string)
-  smbios.system.manufacturer = 'TOSHIBA'  (string)
-  smbios.bios.release_date = '09/02/2003'  (string)
-  smbios.bios.version = 'Version 1.30'  (string)
-  smbios.bios.vendor = 'TOSHIBA'  (string)
   power_management.type = 'apm'  (string)
   power_management.is_enabled = true  (bool)
   system.formfactor = 'laptop'  (string)


More information about the hal mailing list