diff -u hal-0.5.10/debian/changelog hal-0.5.10/debian/changelog --- hal-0.5.10/debian/changelog +++ hal-0.5.10/debian/changelog @@ -1,3 +1,9 @@ +hal (0.5.10-5ubuntu7) hardy; urgency=low + + * Apply patch from fdo hal.git for procfs-sysfs dual battery (LP: #177570) + + -- John Dong Mon, 11 Feb 2008 10:08:39 -0500 + hal (0.5.10-5ubuntu6) hardy; urgency=low * debian/patches/94_batter-model_name.patch: Battery probe was using only in patch2: unchanged: --- hal-0.5.10.orig/debian/patches/95-procfs-sysfs.patch +++ hal-0.5.10/debian/patches/95-procfs-sysfs.patch @@ -0,0 +1,61 @@ +diff -Nur -x '*.orig' -x '*~' hal-0.5.10/hald/linux/acpi.c hal-0.5.10.new/hald/linux/acpi.c +--- hal-0.5.10/hald/linux/acpi.c 2007-08-27 11:34:05.000000000 -0400 ++++ hal-0.5.10.new/hald/linux/acpi.c 2008-02-11 10:08:33.000000000 -0500 +@@ -944,10 +944,23 @@ + return TRUE; + } + ++static gboolean ++is_power_supply(ACPIDevHandler *h) ++{ ++ if (h && (h->acpi_type == ACPI_TYPE_BATTERY) || ++ (h->acpi_type == ACPI_TYPE_AC_ADAPTER)) ++ return TRUE; ++ return FALSE; ++} ++ + static HalDevice * + acpi_generic_add (const gchar *acpi_path, HalDevice *parent, ACPIDevHandler *handler) + { + HalDevice *d; ++ ++ if (is_power_supply(handler) && _have_sysfs_power_supply) ++ return NULL; ++ + d = hal_device_new (); + hal_device_property_set_string (d, "linux.acpi_path", acpi_path); + hal_device_property_set_int (d, "linux.acpi_type", handler->acpi_type); +diff -Nur -x '*.orig' -x '*~' hal-0.5.10/hald/linux/device.c hal-0.5.10.new/hald/linux/device.c +--- hal-0.5.10/hald/linux/device.c 2008-02-11 10:08:10.000000000 -0500 ++++ hal-0.5.10.new/hald/linux/device.c 2008-02-11 10:08:33.000000000 -0500 +@@ -3341,6 +3341,11 @@ + return TRUE; + } + ++/* don't bother looking for /proc/acpi batteries if they're in ++ * sysfs. ++ */ ++gboolean _have_sysfs_power_supply = FALSE; ++ + static HalDevice * + power_supply_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev, + const gchar *sysfs_path_in_devices) +@@ -3391,6 +3396,8 @@ + refresh_ac_adapter (d); + hal_device_add_capability (d, "ac_adapter"); + } ++ ++ _have_sysfs_power_supply = TRUE; + finish: + return d; + } +diff -Nur -x '*.orig' -x '*~' hal-0.5.10/hald/linux/device.h hal-0.5.10.new/hald/linux/device.h +--- hal-0.5.10/hald/linux/device.h 2007-07-26 14:00:28.000000000 -0400 ++++ hal-0.5.10.new/hald/linux/device.h 2008-02-11 10:08:33.000000000 -0500 +@@ -52,5 +52,6 @@ + extern gboolean _have_sysfs_lid_button; + extern gboolean _have_sysfs_power_button; + extern gboolean _have_sysfs_sleep_button; ++extern gboolean _have_sysfs_power_supply; + + #endif