[Pkg-utopia-commits] r1022 - in packages/unstable/hal/debian: .
patches
Sjoerd Simons
sjoerd at costa.debian.org
Sun Sep 17 15:46:32 UTC 2006
Author: sjoerd
Date: 2006-09-17 15:46:31 +0000 (Sun, 17 Sep 2006)
New Revision: 1022
Added:
packages/unstable/hal/debian/patches/02_powerscripts.patch
packages/unstable/hal/debian/patches/03_use_kernel_headers.patch
Removed:
packages/unstable/hal/debian/patches/04_hald_scripts.patch
packages/unstable/hal/debian/patches/05_pmu_nohibernate.patch
packages/unstable/hal/debian/patches/06_more_buttons.patch
packages/unstable/hal/debian/patches/07_suspend2.patch
packages/unstable/hal/debian/patches/08_probe_serial.patch
packages/unstable/hal/debian/patches/09_sony_brightness.patch
packages/unstable/hal/debian/patches/12_refresh_acpi_states.patch
packages/unstable/hal/debian/patches/14_probe_volume_invalidlabel.patch
packages/unstable/hal/debian/patches/15_mount_scripts_pmount.patch
packages/unstable/hal/debian/patches/16_dont_stat_autofs.patch
packages/unstable/hal/debian/patches/17_fix_dbus_090_build.patch
packages/unstable/hal/debian/patches/18_hald_runner_fd_leak.patch
packages/unstable/hal/debian/patches/20_uswsusp.patch
packages/unstable/hal/debian/patches/21_acpi_support.patch
packages/unstable/hal/debian/patches/22_recognize_partitions.patch
packages/unstable/hal/debian/patches/hdm-python2.4.patch
Modified:
packages/unstable/hal/debian/changelog
packages/unstable/hal/debian/control
packages/unstable/hal/debian/hal.install
packages/unstable/hal/debian/patches/01_hal_debian_dbuspolicy.patch
packages/unstable/hal/debian/patches/19_sonypi_support.patch
packages/unstable/hal/debian/patches/23_addon_acpi.patch
packages/unstable/hal/debian/rules
Log:
* New upstream release
* debian/patches/01_hal_debian_dbuspolicy.patch
- Updated.
* debian/patches/05_pmu_nohibernate.patch
- Removed. Recent kernels don't crash my machine anymore
* debian/patches/04_hald_scripts.patch
debian/patches/06_more_buttons.patch
debian/patches/08_probe_serial.patch
debian/patches/09_sony_brightness.patch
debian/patches/12_refresh_acpi_states.patch
debian/patches/14_probe_volume_invalidlabel.patch
debian/patches/16_dont_stat_autofs.patch
debian/patches/17_fix_dbus_090_build.patch
debian/patches/18_hald_runner_fd_leak.patch
debian/patches/22_recognize_partitions.patch
- Removed. All fixed upstream
* debian/patches/07_suspend2.patch
debian/patches/20_uswsusp.patch
debian/patches/21_acpi_support.patch
- Merged into 02_powerscripts.patch
* debian/patches/hdm-python2.4.patch
- Removed. Not needed anymore since the default python is 2.4 now
* debian/patches/19_sonypi_support.patch
- Updated. Upstream supports spicctrl but assumes it's in a different path
* debian/patches/15_mount_scripts_pmount.patch
- TODO TODO! Removed for now, new hal mount programs need to be
re-evaluated!
* debian/rules: Disable PolicyKit
* debian/control: Add build-depend on libvolume-id-dev
* debian/patches/23_addon_acpi.patch
- Updated.
* debian/patches/03_use_kernel_headers.patch
- Use kernel headers for ARPHRD_IEEE80211_RADIOTAP definition and the
like. (From upstream git)
* debian/control: Add linux-kernel-headers (>= 2.6.17) to the build-depends
for the definition of ARPHRD_IEEE80211_RADIOTAP
* debian/hal.install: Scripts are no longer in /usr/share/hal but in
/usr/lib/hal
Modified: packages/unstable/hal/debian/changelog
===================================================================
--- packages/unstable/hal/debian/changelog 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/changelog 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,3 +1,47 @@
+hal (0.5.8-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ * debian/patches/01_hal_debian_dbuspolicy.patch
+ - Updated.
+ * debian/patches/05_pmu_nohibernate.patch
+ - Removed. Recent kernels don't crash my machine anymore
+ * debian/patches/04_hald_scripts.patch
+ debian/patches/06_more_buttons.patch
+ debian/patches/08_probe_serial.patch
+ debian/patches/09_sony_brightness.patch
+ debian/patches/12_refresh_acpi_states.patch
+ debian/patches/14_probe_volume_invalidlabel.patch
+ debian/patches/16_dont_stat_autofs.patch
+ debian/patches/17_fix_dbus_090_build.patch
+ debian/patches/18_hald_runner_fd_leak.patch
+ debian/patches/22_recognize_partitions.patch
+ - Removed. All fixed upstream
+ * debian/patches/07_suspend2.patch
+ debian/patches/20_uswsusp.patch
+ debian/patches/21_acpi_support.patch
+ - Merged into 02_powerscripts.patch
+ * debian/patches/hdm-python2.4.patch
+ - Removed. Not needed anymore since the default python is 2.4 now
+ * debian/patches/19_sonypi_support.patch
+ - Updated. Upstream supports spicctrl but assumes it's in a different path
+ * debian/patches/15_mount_scripts_pmount.patch
+ - TODO TODO! Removed for now, new hal mount programs need to be
+ re-evaluated!
+ * debian/rules: Disable PolicyKit
+ * debian/control: Add build-depend on libvolume-id-dev
+ * debian/patches/23_addon_acpi.patch
+ - Updated.
+ * debian/patches/03_use_kernel_headers.patch
+ - Use kernel headers for ARPHRD_IEEE80211_RADIOTAP definition and the
+ like. (From upstream git)
+ * debian/control: Add linux-kernel-headers (>= 2.6.17) to the build-depends
+ for the definition of ARPHRD_IEEE80211_RADIOTAP
+ * debian/hal.install: Scripts are no longer in /usr/share/hal but in
+ /usr/lib/hal
+
+
+ -- Sjoerd Simons <sjoerd at debian.org> Sun, 17 Sep 2006 17:21:30 +0200
+
hal (0.5.7.1-2) unstable; urgency=low
* debian/patches/22_recognize_partitions.patch
Modified: packages/unstable/hal/debian/control
===================================================================
--- packages/unstable/hal/debian/control 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/control 2006-09-17 15:46:31 UTC (rev 1022)
@@ -3,7 +3,7 @@
Priority: optional
Maintainer: Sjoerd Simons <sjoerd at debian.org>
Uploaders: Sebastian Dröge <slomo at ubuntu.com>
-Build-Depends: debhelper (>= 5.0.37.2), cdbs, python-support (>= 0.3), python-dbus, libdbus-glib-1-dev (>= 0.60), libglib2.0-dev, libsysfs-dev, libexpat1-dev, libpopt-dev, pkg-config, pciutils, libcap-dev, doxygen, intltool (>= 0.22), libusb-dev
+Build-Depends: debhelper (>= 5.0.37.2), cdbs, python-support (>= 0.3), python-dbus, libdbus-glib-1-dev (>= 0.60), libglib2.0-dev, libsysfs-dev, libexpat1-dev, libpopt-dev, pkg-config, pciutils, libcap-dev, doxygen, intltool (>= 0.22), libusb-dev, libvolume-id-dev, linux-kernel-headers (>= 2.6.17)
Standards-Version: 3.7.2
XS-Python-Version: 2.4
Modified: packages/unstable/hal/debian/hal.install
===================================================================
--- packages/unstable/hal/debian/hal.install 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/hal.install 2006-09-17 15:46:31 UTC (rev 1022)
@@ -8,5 +8,4 @@
debian/tmp/usr/sbin/
debian/tmp/usr/lib/hal/
debian/tmp/usr/share/hal/fdi
-debian/tmp/usr/share/hal/scripts
debian/preferences.fdi etc/hal/fdi/policy
Modified: packages/unstable/hal/debian/patches/01_hal_debian_dbuspolicy.patch
===================================================================
--- packages/unstable/hal/debian/patches/01_hal_debian_dbuspolicy.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/01_hal_debian_dbuspolicy.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,16 +1,20 @@
-diff -ruN hal-0.5.7.1-old/hal.conf.in hal-0.5.7.1/hal.conf.in
---- hal-0.5.7.1-old/hal.conf.in 2006-01-10 20:03:45.000000000 +0100
-+++ hal-0.5.7.1/hal.conf.in 2006-08-15 12:25:06.000000000 +0200
-@@ -42,9 +42,11 @@
+diff -aur hal-0.5.8.vanilla/hal.conf.in hal-0.5.8/hal.conf.in
+--- hal-0.5.8.vanilla/hal.conf.in 2006-09-11 23:56:39.000000000 +0200
++++ hal-0.5.8/hal.conf.in 2006-09-17 12:32:49.000000000 +0200
+@@ -54,6 +54,16 @@
+ <allow send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/>
</policy>
- <!-- You can change this to a more suitable user, or make per-group -->
-- <policy user="0">
++ <!-- Debian groups policies -->
+ <policy group="powerdev">
- <allow send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/>
- <allow send_interface="org.freedesktop.Hal.Device.LaptopPanel"/>
++ <allow send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/>
++ <allow send_interface="org.freedesktop.Hal.Device.LaptopPanel"/>
+ </policy>
+ <policy group="plugdev">
- <allow send_interface="org.freedesktop.Hal.Device.Volume"/>
- <allow send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/>
- </policy>
++ <allow send_interface="org.freedesktop.Hal.Device.Volume"/>
++ <allow send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/>
++ </policy>
++
+ <!-- You can change this to a more suitable user, or make per-group -->
+ <policy user="0">
+ <allow send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/>
Added: packages/unstable/hal/debian/patches/02_powerscripts.patch
===================================================================
--- packages/unstable/hal/debian/patches/02_powerscripts.patch (rev 0)
+++ packages/unstable/hal/debian/patches/02_powerscripts.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -0,0 +1,44 @@
+Only in hal-0.5.8/tools/linux: .hal-system-power-suspend-linux.swp
+diff -aur hal-0.5.8.vanilla/tools/linux/hal-system-power-hibernate-linux hal-0.5.8/tools/linux/hal-system-power-hibernate-linux
+--- hal-0.5.8.vanilla/tools/linux/hal-system-power-hibernate-linux 2006-09-11 23:56:40.000000000 +0200
++++ hal-0.5.8/tools/linux/hal-system-power-hibernate-linux 2006-09-17 12:14:58.000000000 +0200
+@@ -48,10 +48,18 @@
+ elif [ -x "/usr/sbin/pm-hibernate" ] ; then
+ /usr/sbin/pm-hibernate
+ RET=$?
++ elif [ -x "/usr/sbin/s2disk" ] ; then
++ # uswsusp tools installed
++ /usr/sbin/s2disk
++ RET=$?
+ elif [ -x "/usr/sbin/hibernate" ] ; then
+ # Suspend2 tools installed
+ /usr/sbin/hibernate --force
+ RET=$?
++ elif [ -x "/etc/acpi/hibernate.sh" ] ; then
++ # acpi-support installed
++ /etc/acpi/hibernate.sh force
++ RET=$?
+ elif [ -w "/sys/power/state" ] ; then
+ # Use the raw kernel sysfs interface
+ echo "disk" > /sys/power/state
+diff -aur hal-0.5.8.vanilla/tools/linux/hal-system-power-suspend-linux hal-0.5.8/tools/linux/hal-system-power-suspend-linux
+--- hal-0.5.8.vanilla/tools/linux/hal-system-power-suspend-linux 2006-09-11 23:56:40.000000000 +0200
++++ hal-0.5.8/tools/linux/hal-system-power-suspend-linux 2006-09-17 12:12:04.000000000 +0200
+@@ -86,6 +86,17 @@
+ elif [ -x "/usr/sbin/pmi" ] ; then
+ /usr/sbin/pmi action suspend force
+ RET=$?
++ elif [ -x "/usr/sbin/s2both" ] ; then
++ /usr/sbin/s2both
++ RET=$?
++ elif [ -x "/usr/sbin/hibernate" ] ; then
++ # Use hibernate configured for suspend-to-ram
++ /usr/sbin/hibernate -F/etc/hibernate/ram.conf
++ RET=$?
++ elif [ -x "/etc/acpi/sleep.sh" ] ; then
++ # Use acpi-support for suspend to ram
++ /etc/acpi/sleep.sh force
++ RET=$?
+ elif [ -w "/sys/power/state" ] ; then
+ # Use the raw kernel sysfs interface
+ echo "mem" > /sys/power/state
Added: packages/unstable/hal/debian/patches/03_use_kernel_headers.patch
===================================================================
--- packages/unstable/hal/debian/patches/03_use_kernel_headers.patch (rev 0)
+++ packages/unstable/hal/debian/patches/03_use_kernel_headers.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -0,0 +1,21 @@
+commit 025d3781e2c8fd0133934fd4c94e55d0178940c7
+Author: S.Çağlar Onur <caglar at pardus.org.tr>
+Date: Wed Sep 13 17:25:31 2006 -0400
+
+ get ARPHRD_IEEE80211_RADIOTAP and similar from kernel, not glibc headers
+
+diff --git a/hald/linux/classdev.c b/hald/linux/classdev.c
+index 4e6d2c2..e29a61b 100644
+--- a/hald/linux/classdev.c
++++ b/hald/linux/classdev.c
+@@ -31,8 +31,9 @@ #endif
+
+ #include <ctype.h>
+ #include <limits.h>
++#include <sys/socket.h> /* for ifru_* has incomplete type */
+ #include <linux/types.h>
+-#include <net/if_arp.h> /* for ARPHRD_... */
++#include <linux/if_arp.h> /* for ARPHRD_... */
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdint.h>
Deleted: packages/unstable/hal/debian/patches/04_hald_scripts.patch
===================================================================
--- packages/unstable/hal/debian/patches/04_hald_scripts.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/04_hald_scripts.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,195 +0,0 @@
-diff -ruN hal-0.5.7-old/tools/hal-system-lcd-get-brightness hal-0.5.7/tools/hal-system-lcd-get-brightness
---- hal-0.5.7-old/tools/hal-system-lcd-get-brightness 2006-02-19 00:11:23.000000000 +0100
-+++ hal-0.5.7/tools/hal-system-lcd-get-brightness 2006-03-01 15:03:53.000000000 +0100
-@@ -8,13 +8,13 @@
- # (at your option) any later version.
-
- # Check for environment variables
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "" ]; then
-+if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ]; then
- echo "Missing or empty environment variable(s)." >&2
- echo "This script should be started by hald." >&2
- exit 1
- fi
-
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
- value="`hal-system-power-pmu getlcd`"
- if [ $? -ne 0 ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-@@ -24,37 +24,37 @@
- fi
-
- # Check for file existance and that it's readable
--if [ ! -r $HAL_PROP_LINUX_ACPI_PATH ]; then
-+if [ ! -r "$HAL_PROP_LINUX_ACPI_PATH" ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
- echo "$1 not readable!" >&2
- exit 1
- fi
-
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
- # cat /proc/acpi/toshiba/lcd
- # brightness: 5
- # brightness_levels: 8
- value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep brightness: | awk '{print $2;}'`"
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "asus" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
- # cat /proc/acpi/asus/brn
- # 5
- value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "panasonic" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
- # cat /proc/acpi/pcc/brightness
- # 5
- value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "ibm" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
- # cat /proc/acpi/ibm/brightness
- # level: 5
- # commands: up, down
- # commands: level <level> (<level> is 0-7)
- value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep level: | awk '{print $2;}'`"
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
- # cat /proc/acpi/sony/brightness
- # 5
- value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
- let "value = ${value} - 1"
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "omnibook" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
- # cat /proc/omnibook/lcd
- # LCD brightness: 7
- value="`cat $HAL_PROP_LINUX_ACPI_PATH | awk '{print $3;}'`"
-diff -ruN hal-0.5.7-old/tools/hal-system-lcd-set-brightness hal-0.5.7/tools/hal-system-lcd-set-brightness
---- hal-0.5.7-old/tools/hal-system-lcd-set-brightness 2006-02-19 00:11:23.000000000 +0100
-+++ hal-0.5.7/tools/hal-system-lcd-set-brightness 2006-03-01 15:03:53.000000000 +0100
-@@ -8,8 +8,8 @@
- # (at your option) any later version.
-
- # Check for environment variables
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "" ] ||
-- [ "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" == "" ] ; then
-+if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ] ||
-+ [ -z "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" ] ; then
- echo "Missing or empty environment variable(s)." >&2
- echo "This script should be started by hald." >&2
- exit 1
-@@ -18,7 +18,14 @@
- # read value for set brightness
- read value
-
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
-+# Check for values outside range
-+if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
-+ echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
-+ exit 1
-+fi
-+
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
- hal-system-power-pmu setlcd $value
- if [ $? -ne 0 ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-@@ -28,39 +35,33 @@
- fi
-
- # Check for file existance and that it's writable
--if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then
-+if [ ! -w "$HAL_PROP_LINUX_ACPI_PATH" ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
- echo "$1 not writable!" >&2
- exit 1
- fi
-
--# Check for values outside range
--if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
-- echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
-- echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
-- exit 1
--fi
-
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
- # echo "brightness: {0..x}" >/proc/acpi/toshiba/lcd
- echo "brightness: $value" > $HAL_PROP_LINUX_ACPI_PATH
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "asus" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
- # echo {0..15} > /proc/acpi/asus/brn
- # http://www.taupro.com/wiki/ChemBook/LCDdisplayPowerConfiguration
- echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "panasonic" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
- # echo {0..15} > /proc/acpi/pcc/brightness
- # http://readlist.com/lists/vger.kernel.org/linux-kernel/7/36405.html
- echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "ibm" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
- # echo "level {0..7}" > /proc/acpi/ibm/brightness
- # http://ibm-acpi.sourceforge.net/README
- echo "level $value" > $HAL_PROP_LINUX_ACPI_PATH
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
- # echo "{1..8}" > /proc/acpi/sony/brightness
- # http://popies.net/sonypi/2.6-sony_acpi4.patch
- echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
--elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "omnibook" ]; then
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
- # echo "{0..7}" > /proc/omnibook/lcd
- # http://bugzilla.gnome.org/show_bug.cgi?id=331458
- echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-diff -ruN hal-0.5.7-old/tools/hal-system-power-hibernate hal-0.5.7/tools/hal-system-power-hibernate
---- hal-0.5.7-old/tools/hal-system-power-hibernate 2006-01-16 13:47:40.000000000 +0100
-+++ hal-0.5.7/tools/hal-system-power-hibernate 2006-03-01 15:03:53.000000000 +0100
-@@ -43,8 +43,9 @@
- # Suspend2 tools installed
- /usr/sbin/hibernate --force
- RET=$?
-- elif [ -w "/sys/power/state" ] ; then
-- # Use the raw kernel sysfs interface
-+ elif [ -w "/sys/power/state" ] &&
-+ [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" != pmu ] ; then
-+ # Use the raw kernel sysfs interface if possible (not on pmu yet)
- echo "disk" > /sys/power/state
- RET=$?
- else
-diff -ruN hal-0.5.7-old/tools/hal-system-power-suspend hal-0.5.7/tools/hal-system-power-suspend
---- hal-0.5.7-old/tools/hal-system-power-suspend 2006-02-19 00:00:55.000000000 +0100
-+++ hal-0.5.7/tools/hal-system-power-suspend 2006-03-01 15:03:53.000000000 +0100
-@@ -18,15 +18,6 @@
-
- read seconds_to_sleep
-
--#PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
--if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
-- hal-system-power-pmu sleep
-- if [ $? -ne 0 ]; then
-- echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
-- exit 1
-- fi
-- exit 0
--fi
-
- #SuSE and ALTLinux only support powersave
- if [ -f "/etc/altlinux-release" ] || [ -f "/etc/SuSE-release" ] ; then
-@@ -62,6 +53,10 @@
- elif [ -x "/usr/sbin/pmi" ] ; then
- /usr/sbin/pmi action suspend force
- RET=$?
-+ elif [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" = "pmu" ]; then
-+ #PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
-+ hal-system-power-pmu sleep
-+ RET=$?
- elif [ -w "/sys/power/state" ] ; then
- # Use the raw kernel sysfs interface
- echo "mem" > /sys/power/state
-@@ -72,4 +67,8 @@
- fi
- fi
-
-+if [ $RET -ne 0 ]; then
-+ echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
-+ exit 1
-+fi
- exit $RET
Deleted: packages/unstable/hal/debian/patches/05_pmu_nohibernate.patch
===================================================================
--- packages/unstable/hal/debian/patches/05_pmu_nohibernate.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/05_pmu_nohibernate.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,28 +0,0 @@
-diff -ruN hal-0.5.7-old/hald/linux2/osspec.c hal-0.5.7/hald/linux2/osspec.c
---- hal-0.5.7-old/hald/linux2/osspec.c 2006-02-13 17:42:32.000000000 +0100
-+++ hal-0.5.7/hald/linux2/osspec.c 2006-03-01 15:05:55.000000000 +0100
-@@ -447,6 +447,7 @@
- unsigned int len;
- char *poweroptions;
- FILE *fp;
-+ const char* pmtype = NULL;
-
- can_suspend = FALSE;
- can_hibernate = FALSE;
-@@ -471,6 +472,16 @@
- can_hibernate = TRUE;
- free (poweroptions);
-
-+ pmtype = hal_device_property_get_string(d,"power_management.type");
-+ if (pmtype && !strcmp(pmtype, "pmu")) {
-+ /* Although /sys/power/state exists on pmu based machines, using it just
-+ * crashes mine. Suspending works via the pmu though. So overriding what we
-+ * just saw...
-+ * Should be removed as soon as /sys/power works on PMU */
-+ can_hibernate = FALSE;
-+ can_suspend = TRUE;
-+ }
-+
- /* check for the presence of suspend2 */
- if (access ("/proc/software_suspend", F_OK) == 0)
- can_hibernate = TRUE;
Deleted: packages/unstable/hal/debian/patches/06_more_buttons.patch
===================================================================
--- packages/unstable/hal/debian/patches/06_more_buttons.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/06_more_buttons.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,123 +0,0 @@
-diff -ruN hal-0.5.7-old/hald/linux2/addons/addon-keyboard.c hal-0.5.7/hald/linux2/addons/addon-keyboard.c
---- hal-0.5.7-old/hald/linux2/addons/addon-keyboard.c 2006-02-22 22:10:06.000000000 +0100
-+++ hal-0.5.7/hald/linux2/addons/addon-keyboard.c 2006-03-05 22:02:49.000000000 +0100
-@@ -1,5 +1,5 @@
- /***************************************************************************
-- * CVSID: $Id: addon-keyboard.c,v 1.4 2006/02/22 21:10:06 david Exp $
-+ * CVSID: $Id: addon-keyboard.c,v 1.5 2006/03/03 17:33:26 hughsient Exp $
- *
- * addon-keyboard.c : Listen to key events and modify hal device objects
- *
-@@ -62,10 +62,10 @@
- [KEY_CALC] = "calc",
- [KEY_SETUP] = "setup",
- [KEY_SLEEP] = "sleep",
-- [KEY_WAKEUP] = "wakeup",
-+ [KEY_WAKEUP] = "wake-up",
- [KEY_FILE] = "file",
-- [KEY_SENDFILE] = "sendfile",
-- [KEY_DELETEFILE] = "deletefile",
-+ [KEY_SENDFILE] = "send-file",
-+ [KEY_DELETEFILE] = "delete-file",
- [KEY_XFER] = "xfer",
- [KEY_PROG1] = "prog1",
- [KEY_PROG2] = "prog2",
-@@ -73,19 +73,19 @@
- [KEY_MSDOS] = "msdos",
- [KEY_COFFEE] = "coffee",
- [KEY_DIRECTION] = "direction",
-- [KEY_CYCLEWINDOWS] = "cyclewindows",
-+ [KEY_CYCLEWINDOWS] = "cycle-windows",
- [KEY_MAIL] = "mail",
- [KEY_BOOKMARKS] = "bookmarks",
- [KEY_COMPUTER] = "computer",
- [KEY_BACK] = "back",
- [KEY_FORWARD] = "forward",
-- [KEY_CLOSECD] = "closecd",
-- [KEY_EJECTCD] = "ejectcd",
-- [KEY_EJECTCLOSECD] = "ejectclosecd",
-- [KEY_NEXTSONG] = "nextsong",
-- [KEY_PLAYPAUSE] = "playpause",
-- [KEY_PREVIOUSSONG] = "previoussong",
-- [KEY_STOPCD] = "stopcd",
-+ [KEY_CLOSECD] = "close-cd",
-+ [KEY_EJECTCD] = "eject-cd",
-+ [KEY_EJECTCLOSECD] = "eject-close-cd",
-+ [KEY_NEXTSONG] = "next-song",
-+ [KEY_PLAYPAUSE] = "play-pause",
-+ [KEY_PREVIOUSSONG] = "previous-song",
-+ [KEY_STOPCD] = "stop-cd",
- [KEY_RECORD] = "record",
- [KEY_REWIND] = "rewind",
- [KEY_PHONE] = "phone",
-@@ -96,10 +96,10 @@
- [KEY_EXIT] = "exit",
- [KEY_MOVE] = "move",
- [KEY_EDIT] = "edit",
-- [KEY_SCROLLUP] = "scrollup",
-- [KEY_SCROLLDOWN] = "scrolldown",
-- [KEY_KPLEFTPAREN] = "kpleftparen",
-- [KEY_KPRIGHTPAREN] = "kprightparen",
-+ [KEY_SCROLLUP] = "scroll-up",
-+ [KEY_SCROLLDOWN] = "scroll-down",
-+ [KEY_KPLEFTPAREN] = "kp-left-paren",
-+ [KEY_KPRIGHTPAREN] = "kp-right-paren",
- [KEY_F13] = "f13",
- [KEY_F14] = "f14",
- [KEY_F15] = "f15",
-@@ -112,15 +112,15 @@
- [KEY_F22] = "f22",
- [KEY_F23] = "f23",
- [KEY_F24] = "f24",
-- [KEY_PLAYCD] = "playcd",
-- [KEY_PAUSECD] = "pausecd",
-+ [KEY_PLAYCD] = "play-cd",
-+ [KEY_PAUSECD] = "pause-cd",
- [KEY_PROG3] = "prog3",
- [KEY_PROG4] = "prog4",
- [KEY_SUSPEND] = "hibernate",
- [KEY_CLOSE] = "close",
- [KEY_PLAY] = "play",
-- [KEY_FASTFORWARD] = "fastforward",
-- [KEY_BASSBOOST] = "bassboost",
-+ [KEY_FASTFORWARD] = "fast-forward",
-+ [KEY_BASSBOOST] = "bass-boost",
- [KEY_PRINT] = "print",
- [KEY_HP] = "hp",
- [KEY_CAMERA] = "camera",
-@@ -133,12 +133,31 @@
- [KEY_FINANCE] = "finance",
- [KEY_SPORT] = "sport",
- [KEY_SHOP] = "shop",
-- [KEY_ALTERASE] = "alterase",
-+ [KEY_ALTERASE] = "alt-erase",
- [KEY_CANCEL] = "cancel",
-- [KEY_BRIGHTNESSDOWN] = "brightnessdown",
-- [KEY_BRIGHTNESSUP] = "brightnessup",
-+ [KEY_BRIGHTNESSDOWN] = "brightness-down",
-+ [KEY_BRIGHTNESSUP] = "brightness-up",
- [KEY_MEDIA] = "media",
-- [KEY_POWER] = "power"
-+ [KEY_POWER] = "power",
-+ [KEY_MUTE] = "mute",
-+ [KEY_VOLUMEDOWN] = "volume-down",
-+ [KEY_VOLUMEUP] = "volume-up",
-+#ifndef KEY_SWITCHVIDEOMODE
-+#define KEY_SWITCHVIDEOMODE 227
-+#endif
-+ [KEY_SWITCHVIDEOMODE] = "switch-videomode",
-+#ifndef KEY_KBDILLUMTOGGLE
-+#define KEY_KBDILLUMTOGGLE 228
-+#endif
-+ [KEY_KBDILLUMTOGGLE] = "kbd-illum-toggle",
-+#ifndef KEY_KBDILLUMDOWN
-+#define KEY_KBDILLUMDOWN 229
-+#endif
-+ [KEY_KBDILLUMDOWN] = "kbd-illum-down",
-+#ifndef KEY_KBDILLUMUP
-+#define KEY_KBDILLUMUP 230
-+#endif
-+ [KEY_KBDILLUMUP] = "kbd-illum-up"
- };
-
- static void
Deleted: packages/unstable/hal/debian/patches/07_suspend2.patch
===================================================================
--- packages/unstable/hal/debian/patches/07_suspend2.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/07_suspend2.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,14 +0,0 @@
-diff -u hal-0.5.7/tools/hal-system-power-suspend hal-0.5.7.1/tools/hal-system-power-suspend
---- hal-0.5.7/tools/hal-system-power-suspend 2006-03-01 15:03:53.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-power-suspend 2006-08-15 15:16:59.000000000 +0200
-@@ -57,6 +57,10 @@
- #PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
- hal-system-power-pmu sleep
- RET=$?
-+ elif [ -x "/usr/sbin/hibernate" ] ; then
-+ # Use hibernate configured for suspend-to-ram
-+ /usr/sbin/hibernate -F/etc/hibernate/ram.conf
-+ RET=$?
- elif [ -w "/sys/power/state" ] ; then
- # Use the raw kernel sysfs interface
- echo "mem" > /sys/power/state
Deleted: packages/unstable/hal/debian/patches/08_probe_serial.patch
===================================================================
--- packages/unstable/hal/debian/patches/08_probe_serial.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/08_probe_serial.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,24 +0,0 @@
-diff -ruN hal-0.5.7-old/hald/linux2/classdev.c hal-0.5.7/hald/linux2/classdev.c
---- hal-0.5.7-old/hald/linux2/classdev.c 2006-01-28 23:51:18.000000000 +0100
-+++ hal-0.5.7/hald/linux2/classdev.c 2006-05-01 22:42:45.000000000 +0200
-@@ -1,5 +1,5 @@
- /***************************************************************************
-- * CVSID: $Id: classdev.c,v 1.42 2006/01/28 22:51:18 david Exp $
-+ * CVSID: $Id: classdev.c,v 1.43 2006/03/03 19:19:53 dkukawka Exp $
- *
- * classdev.c : Handling of functional kernel devices
- *
-@@ -927,7 +927,12 @@
- static const gchar *
- serial_get_prober (HalDevice *d)
- {
-- return "hald-probe-serial";
-+ /* FIXME TODO: check if there is an other way, to call the porber only
-+ on ttyS* devices, than check the name of the device file */
-+ if (!strncmp(hal_device_property_get_string (d, "linux.device_file"), "/dev/ttyS", 9))
-+ return "hald-probe-serial";
-+ else
-+ return NULL;
- }
-
- static gboolean
Deleted: packages/unstable/hal/debian/patches/09_sony_brightness.patch
===================================================================
--- packages/unstable/hal/debian/patches/09_sony_brightness.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/09_sony_brightness.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,12 +0,0 @@
-diff -ruN hal-0.5.7-old/tools/hal-system-lcd-set-brightness hal-0.5.7/tools/hal-system-lcd-set-brightness
---- hal-0.5.7-old/tools/hal-system-lcd-set-brightness 2006-03-15 23:01:12.000000000 +0100
-+++ hal-0.5.7/tools/hal-system-lcd-set-brightness 2006-03-15 23:04:54.000000000 +0100
-@@ -60,7 +60,7 @@
- elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
- # echo "{1..8}" > /proc/acpi/sony/brightness
- # http://popies.net/sonypi/2.6-sony_acpi4.patch
-- echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-+ echo "$((value + 1))" > $HAL_PROP_LINUX_ACPI_PATH
- elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
- # echo "{0..7}" > /proc/omnibook/lcd
- # http://bugzilla.gnome.org/show_bug.cgi?id=331458
Deleted: packages/unstable/hal/debian/patches/12_refresh_acpi_states.patch
===================================================================
--- packages/unstable/hal/debian/patches/12_refresh_acpi_states.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/12_refresh_acpi_states.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,39 +0,0 @@
-diff -Nur hal-0.5.7/tools/hal-system-power-hibernate hal-0.5.7.new/build-tree/hal-0.5.7/tools/hal-system-power-hibernate
---- hal-0.5.7/tools/hal-system-power-hibernate 2006-05-08 15:04:50.789766728 +0100
-+++ hal-0.5.7/tools/hal-system-power-hibernate 2006-05-08 15:05:19.234442480 +0100
-@@ -53,4 +53,15 @@
- fi
- fi
-
-+#Refresh devices as a resume can do funny things
-+for type in button battery ac_adapter
-+do
-+ devices=`hal-find-by-capability --capability $type`
-+ for device in $devices
-+ do
-+ dbus-send --system --print-reply --dest=org.freedesktop.Hal \
-+ $device org.freedesktop.Hal.Device.Rescan
-+ done
-+done
-+
- exit $RET
-diff -Nur hal-0.5.7/tools/hal-system-power-suspend hal-0.5.7.new/build-tree/hal-0.5.7/tools/hal-system-power-suspend
---- hal-0.5.7/tools/hal-system-power-suspend 2006-05-08 15:04:50.789766728 +0100
-+++ hal-0.5.7/tools/hal-system-power-suspend 2006-05-08 15:06:21.701945976 +0100
-@@ -71,4 +71,16 @@
- echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
- exit 1
- fi
-+
-+#Refresh devices as a resume can do funny things
-+for type in button battery ac_adapter
-+do
-+ devices=`hal-find-by-capability --capability $type`
-+ for device in $devices
-+ do
-+ dbus-send --system --print-reply --dest=org.freedesktop.Hal \
-+ $device org.freedesktop.Hal.Device.Rescan
-+ done
-+done
-+
- exit $RET
Deleted: packages/unstable/hal/debian/patches/14_probe_volume_invalidlabel.patch
===================================================================
--- packages/unstable/hal/debian/patches/14_probe_volume_invalidlabel.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/14_probe_volume_invalidlabel.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,25 +0,0 @@
-diff -ruN hal-0.5.7-old/hald/linux2/probing/probe-volume.c hal-0.5.7/hald/linux2/probing/probe-volume.c
---- hal-0.5.7-old/hald/linux2/probing/probe-volume.c 2006-02-22 22:27:52.000000000 +0100
-+++ hal-0.5.7/hald/linux2/probing/probe-volume.c 2006-05-10 18:20:39.000000000 +0200
-@@ -67,6 +67,7 @@
- char *endchar;
- char *newstr;
- char *s;
-+ unsigned fixes = 0;
-
- if (str == NULL)
- return NULL;
-@@ -75,6 +76,13 @@
- s = newstr;
- while (!g_utf8_validate (s, -1, (const char **) &endchar)) {
- *endchar = '_';
-+ ++fixes;
-+ }
-+
-+ /* If we had to fix more than 20% of the characters, give up */
-+ if (fixes > 0 && g_utf8_strlen (newstr, -1) / fixes < 5) {
-+ g_free (newstr);
-+ newstr = g_strdup("");
- }
-
- return newstr;
Deleted: packages/unstable/hal/debian/patches/15_mount_scripts_pmount.patch
===================================================================
--- packages/unstable/hal/debian/patches/15_mount_scripts_pmount.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/15_mount_scripts_pmount.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,71 +0,0 @@
-diff -Nur hal/build-tree/hal-0.5.7.1/tools/hal-system-storage-eject hal.new/build-tree/hal-0.5.7.1/tools/hal-system-storage-eject
---- hal-0.5.7.1/tools/hal-system-storage-eject 2006-02-10 04:41:54.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-storage-eject 2006-08-04 09:57:41.000000000 +0200
-@@ -31,7 +31,18 @@
- read GIVEN_EJECTOPTIONS
- GIVEN_EJECTOPTIONS=${GIVEN_EJECTOPTIONS//[^a-zA-Z0-9_=[:space:]]/_}
-
--RESULT=$(eject "$HAL_PROP_BLOCK_DEVICE" 2>&1)
-+# check validity of user id
-+if [ "$HAL_METHOD_INVOKED_BY_UID" = "0" ]; then
-+ echo "Script was called with HAL_METHOD_INVOKED_BY_UID=0, aborting." >&2
-+ exit 1
-+fi
-+PWD=`getent passwd "$HAL_METHOD_INVOKED_BY_UID"` || {
-+ echo "User id $HAL_METHOD_INVOKED_BY_UID does not exist." >&2
-+ exit 1
-+}
-+USER="`echo "$PWD" | cut -f 1 -d: | head -n 1`"
-+
-+RESULT=$(su -c "eject '$HAL_PROP_BLOCK_DEVICE'" "$USER" 2>&1)
- if [ $? -ne 0 ]; then
- case "$RESULT" in
- *busy*)
-diff -Nur hal/build-tree/hal-0.5.7.1/tools/hal-system-storage-mount hal.new/build-tree/hal-0.5.7.1/tools/hal-system-storage-mount
---- hal-0.5.7.1/tools/hal-system-storage-mount 2006-02-14 19:49:55.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-storage-mount 2006-08-04 09:57:32.000000000 +0200
-@@ -15,6 +15,20 @@
- exit 1
- fi
-
-+# check validity of user id
-+if [ "$HAL_METHOD_INVOKED_BY_UID" = "0" ]; then
-+ echo "Script was called with HAL_METHOD_INVOKED_BY_UID=0, aborting." >&2
-+ exit 1
-+fi
-+PWD=`getent passwd "$HAL_METHOD_INVOKED_BY_UID"` || {
-+ echo "User id $HAL_METHOD_INVOKED_BY_UID does not exist." >&2
-+ exit 1
-+}
-+USER="`echo "$PWD" | cut -f 1 -d:`"
-+
-+su -c "pmount-hal \"$HAL_PROP_BLOCK_DEVICE\"" "$USER"
-+exit $?
-+
- # check if device is already mounted
- if [ "$HAL_PROP_VOLUME_IS_MOUNTED" = "true" ]; then
- echo "org.freedesktop.Hal.Device.Volume.AlreadyMounted" >&2
-diff -Nur hal/build-tree/hal-0.5.7.1/tools/hal-system-storage-unmount hal.new/build-tree/hal-0.5.7.1/tools/hal-system-storage-unmount
---- hal-0.5.7.1/tools/hal-system-storage-unmount 2006-02-13 08:29:44.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-storage-unmount 2006-08-04 09:57:39.000000000 +0200
-@@ -13,6 +13,20 @@
- exit 1
- fi
-
-+# check validity of user id
-+if [ "$HAL_METHOD_INVOKED_BY_UID" = "0" ]; then
-+ echo "Script was called with HAL_METHOD_INVOKED_BY_UID=0, aborting." >&2
-+ exit 1
-+fi
-+PWD=`getent passwd "$HAL_METHOD_INVOKED_BY_UID"` || {
-+ echo "User id $HAL_METHOD_INVOKED_BY_UID does not exist." >&2
-+ exit 1
-+}
-+USER="`echo "$PWD" | cut -f 1 -d:`"
-+
-+su -c "pumount \"$HAL_PROP_BLOCK_DEVICE\"" "$USER"
-+exit $?
-+
- MOUNT_POINT="$HAL_PROP_INFO_HAL_MOUNT_CREATED_MOUNT_POINT"
- if [ "$MOUNT_POINT" == "" ]; then
- MOUNT_POINT="$HAL_PROP_VOLUME_MOUNT_POINT"
Deleted: packages/unstable/hal/debian/patches/16_dont_stat_autofs.patch
===================================================================
--- packages/unstable/hal/debian/patches/16_dont_stat_autofs.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/16_dont_stat_autofs.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,1370 +0,0 @@
-diff -ruN hal-0.5.7.1-old/hald/linux2/blockdev.c hal-0.5.7.1/hald/linux2/blockdev.c
---- hal-0.5.7.1-old/hald/linux2/blockdev.c 2006-02-24 05:29:06.000000000 +0100
-+++ hal-0.5.7.1/hald/linux2/blockdev.c 2006-08-15 13:26:26.000000000 +0200
-@@ -185,6 +185,7 @@
- dev_t devt = makedev(0, 0);
- GSList *volumes = NULL;
- GSList *volume;
-+ GSList *autofs_mounts = NULL;
-
- /* open /proc/mounts */
- g_snprintf (buf, sizeof (buf), "%s/mounts", get_hal_proc_path ());
-@@ -205,6 +206,28 @@
- while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) {
- struct stat statbuf;
-
-+ /* If this is an autofs mount (fstype == 'autofs')
-+ * store the mount in a list for later use.
-+ * On mounts managed by autofs accessing files below the mount
-+ * point cause the mount point to be remounted after an
-+ * unmount. We keep the list so we do not check for
-+ * the .created-by-hal file on mounts under autofs mount points
-+ */
-+ if (strcmp(mnt.mnt_type, "autofs") == 0) {
-+ char *mnt_dir;
-+
-+ if (mnt.mnt_dir[strlen (mnt.mnt_dir) - 1] != '/')
-+ mnt_dir = g_strdup_printf ("%s/", mnt.mnt_dir);
-+ else
-+ mnt_dir = g_strdup (mnt.mnt_dir);
-+
-+ autofs_mounts = g_slist_append (autofs_mounts,
-+ mnt_dir);
-+
-+
-+ continue;
-+ }
-+
- /* check the underlying device of the mount point */
- if (stat (mnt.mnt_dir, &statbuf) != 0)
- continue;
-@@ -242,6 +265,7 @@
- HalDevice *dev;
- char *mount_point;
- char *mount_point_hal_file;
-+ GSList *autofs_node;
-
- dev = HAL_DEVICE (volume->data);
- mount_point = g_strdup (hal_device_property_get_string (dev, "volume.mount_point"));
-@@ -251,8 +275,20 @@
- device_property_atomic_update_end ();
- HAL_INFO (("set %s to unmounted", hal_device_get_udi (dev)));
-
-+ /* check to see if mount point falls under autofs */
-+ autofs_node = autofs_mounts;
-+ while (autofs_node != NULL) {
-+ char *am = (char *)autofs_node->data;
-+
-+ if (strncmp (am, mount_point, strlen (am)) == 0);
-+ break;
-+
-+ autofs_node = autofs_node->next;
-+ }
-+
- mount_point_hal_file = g_strdup_printf ("%s/.created-by-hal", mount_point);
-- if (g_file_test (mount_point_hal_file, G_FILE_TEST_EXISTS)) {
-+ if (!autofs_node &&
-+ g_file_test (mount_point_hal_file, G_FILE_TEST_EXISTS)) {
- char *cleanup_stdin;
- char *extra_env[2];
-
-@@ -279,6 +315,8 @@
- g_free (mount_point);
- }
- g_slist_free (volumes);
-+ g_slist_foreach (autofs_mounts, (GFunc) g_free, NULL);
-+ g_slist_free (autofs_mounts);
- exit:
- endmntent (f);
- }
-diff -ruN hal-0.5.7.1-old/hald/linux2/blockdev.c.orig hal-0.5.7.1/hald/linux2/blockdev.c.orig
---- hal-0.5.7.1-old/hald/linux2/blockdev.c.orig 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.7.1/hald/linux2/blockdev.c.orig 2006-02-24 05:29:06.000000000 +0100
-@@ -0,0 +1,1287 @@
-+/***************************************************************************
-+ * CVSID: $Id: blockdev.c,v 1.38 2006/02/24 04:29:06 david Exp $
-+ *
-+ * blockdev.c : Handling of block devices
-+ *
-+ * Copyright (C) 2005 David Zeuthen, <david at fubar.dk>
-+ * Copyright (C) 2005,2006 Kay Sievers, <kay.sievers at vrfy.org>
-+ *
-+ * Licensed under the Academic Free License version 2.1
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-+ *
-+ **************************************************************************/
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <stdarg.h>
-+#include <string.h>
-+#include <mntent.h>
-+#include <errno.h>
-+#include <stdint.h>
-+#include <sys/stat.h>
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+#include <sys/utsname.h>
-+#include <unistd.h>
-+#include <ctype.h>
-+#include <unistd.h>
-+#include <linux/kdev_t.h>
-+
-+#include <limits.h>
-+#include <errno.h>
-+#include <stdint.h>
-+#include <sys/stat.h>
-+#include <sys/ioctl.h>
-+#include <fcntl.h>
-+
-+#include <glib.h>
-+#include <dbus/dbus.h>
-+#include <dbus/dbus-glib.h>
-+
-+#include "../osspec.h"
-+#include "../logger.h"
-+#include "../hald.h"
-+#include "../device_info.h"
-+#include "../hald_dbus.h"
-+#include "../util.h"
-+#include "../hald_runner.h"
-+
-+#include "osspec_linux.h"
-+
-+#include "coldplug.h"
-+#include "hotplug_helper.h"
-+
-+#include "hotplug.h"
-+#include "blockdev.h"
-+
-+/*--------------------------------------------------------------------------------------------------------------*/
-+
-+static gboolean
-+blockdev_compute_udi (HalDevice *d)
-+{
-+ gchar udi[256];
-+
-+ if (hal_device_property_get_bool (d, "block.is_volume")) {
-+ const char *label;
-+ const char *uuid;
-+
-+ label = hal_device_property_get_string (d, "volume.label");
-+ uuid = hal_device_property_get_string (d, "volume.uuid");
-+
-+ if (uuid != NULL && strlen (uuid) > 0) {
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/volume_uuid_%s", uuid);
-+ } else if (label != NULL && strlen (label) > 0) {
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/volume_label_%s", label);
-+ } else if (hal_device_property_get_bool(d, "volume.is_disc") &&
-+ hal_device_property_get_bool(d, "volume.disc.is_blank")) {
-+ /* this should be a empty CD/DVD */
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/volume_empty_%s",
-+ hal_device_property_get_string (d, "volume.disc.type"));
-+ } else {
-+ /* fallback to partition number, size */
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/volume_part%d_size_%lld",
-+ hal_device_property_get_int (d, "volume.partition.number"),
-+ hal_device_property_get_uint64 (d, "volume.size"));
-+ }
-+ } else {
-+ const char *model;
-+ const char *serial;
-+
-+ model = hal_device_property_get_string (d, "storage.model");
-+ serial = hal_device_property_get_string (d, "storage.serial");
-+
-+ if (serial != NULL) {
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/storage_serial_%s",
-+ serial);
-+ } else if ((model != NULL) && (strlen(model) != 0) ) {
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/storage_model_%s",
-+ model);
-+ } else {
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "%s_storage",
-+ hal_device_property_get_string (d, "storage.physical_device"));
-+ }
-+ }
-+
-+ hal_device_set_udi (d, udi);
-+ hal_device_property_set_string (d, "info.udi", udi);
-+
-+ return TRUE;
-+}
-+
-+
-+static void
-+blockdev_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
-+{
-+ void *end_token = (void *) userdata1;
-+
-+ HAL_INFO (("Add callouts completed udi=%s", d->udi));
-+
-+ /* Move from temporary to global device store */
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ hal_device_store_add (hald_get_gdl (), d);
-+
-+ hotplug_event_end (end_token);
-+}
-+
-+static void
-+blockdev_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
-+{
-+ void *end_token = (void *) userdata1;
-+
-+ HAL_INFO (("Remove callouts completed udi=%s", d->udi));
-+
-+ if (!hal_device_store_remove (hald_get_gdl (), d)) {
-+ HAL_WARNING (("Error removing device"));
-+ }
-+ g_object_unref (d);
-+
-+ hotplug_event_end (end_token);
-+}
-+
-+static void
-+cleanup_mountpoint_cb (HalDevice *d, guint32 exit_type,
-+ gint return_code, gchar **error,
-+ gpointer data1, gpointer data2)
-+{
-+ char *mount_point = (char *) data1;
-+ HAL_INFO (("In cleanup_mountpoint_cb for '%s'", mount_point));
-+ g_free (mount_point);
-+}
-+
-+
-+void
-+blockdev_refresh_mount_state (HalDevice *d)
-+{
-+ FILE *f;
-+ struct mntent mnt;
-+ struct mntent *mnte;
-+ char buf[1024];
-+ unsigned int major;
-+ unsigned int minor;
-+ dev_t devt = makedev(0, 0);
-+ GSList *volumes = NULL;
-+ GSList *volume;
-+
-+ /* open /proc/mounts */
-+ g_snprintf (buf, sizeof (buf), "%s/mounts", get_hal_proc_path ());
-+ if ((f = setmntent (buf, "r")) == NULL) {
-+ HAL_ERROR (("Could not open /proc/mounts"));
-+ return;
-+ }
-+
-+ if (d)
-+ volumes = g_slist_append (NULL, d);
-+ else
-+ volumes = hal_device_store_match_multiple_key_value_string (hald_get_gdl (), "info.category", "volume");
-+
-+ if (!volumes)
-+ goto exit;
-+
-+ /* loop over /proc/mounts */
-+ while ((mnte = getmntent_r (f, &mnt, buf, sizeof(buf))) != NULL) {
-+ struct stat statbuf;
-+
-+ /* check the underlying device of the mount point */
-+ if (stat (mnt.mnt_dir, &statbuf) != 0)
-+ continue;
-+ if (major(statbuf.st_dev) == 0)
-+ continue;
-+
-+ HAL_INFO (("* found mounts dev %s (%i:%i)", mnt.mnt_fsname, major(statbuf.st_dev), minor(statbuf.st_dev)));
-+ /* match against all hal volumes */
-+ for (volume = volumes; volume != NULL; volume = g_slist_next (volume)) {
-+ HalDevice *dev;
-+
-+ dev = HAL_DEVICE (volume->data);
-+ major = hal_device_property_get_int (dev, "block.major");
-+ if (major == 0)
-+ continue;
-+ minor = hal_device_property_get_int (dev, "block.minor");
-+ devt = makedev(major, minor);
-+ HAL_INFO ((" match %s (%i:%i)", hal_device_get_udi (dev), major, minor));
-+
-+ if (statbuf.st_dev == devt) {
-+ /* found entry for this device in /proc/mounts */
-+ device_property_atomic_update_begin ();
-+ hal_device_property_set_bool (dev, "volume.is_mounted", TRUE);
-+ hal_device_property_set_string (dev, "volume.mount_point", mnt.mnt_dir);
-+ device_property_atomic_update_end ();
-+ HAL_INFO ((" set %s to be mounted at %s", hal_device_get_udi (dev), mnt.mnt_dir));
-+ volumes = g_slist_delete_link (volumes, volume);
-+ break;
-+ }
-+ }
-+ }
-+
-+ /* all remaining volumes are not mounted */
-+ for (volume = volumes; volume != NULL; volume = g_slist_next (volume)) {
-+ HalDevice *dev;
-+ char *mount_point;
-+ char *mount_point_hal_file;
-+
-+ dev = HAL_DEVICE (volume->data);
-+ mount_point = g_strdup (hal_device_property_get_string (dev, "volume.mount_point"));
-+ device_property_atomic_update_begin ();
-+ hal_device_property_set_bool (dev, "volume.is_mounted", FALSE);
-+ hal_device_property_set_string (dev, "volume.mount_point", "");
-+ device_property_atomic_update_end ();
-+ HAL_INFO (("set %s to unmounted", hal_device_get_udi (dev)));
-+
-+ mount_point_hal_file = g_strdup_printf ("%s/.created-by-hal", mount_point);
-+ if (g_file_test (mount_point_hal_file, G_FILE_TEST_EXISTS)) {
-+ char *cleanup_stdin;
-+ char *extra_env[2];
-+
-+ HAL_INFO (("Cleaning up directory '%s' since it was created by hal Mount()", mount_point));
-+
-+ extra_env[0] = g_strdup_printf ("HALD_CLEANUP=%s", mount_point);
-+ extra_env[1] = NULL;
-+ cleanup_stdin = "\n";
-+
-+ hald_runner_run_method (dev,
-+ "hal-system-storage-cleanup-mountpoint",
-+ extra_env,
-+ cleanup_stdin, TRUE,
-+ 0,
-+ cleanup_mountpoint_cb,
-+ g_strdup (mount_point), NULL);
-+
-+ hal_device_property_remove (dev, "info.hal_mount.created_mount_point");
-+ hal_device_property_remove (dev, "info.hal_mount.mounted_by_uid");
-+
-+ }
-+
-+ g_free (mount_point_hal_file);
-+ g_free (mount_point);
-+ }
-+ g_slist_free (volumes);
-+exit:
-+ endmntent (f);
-+}
-+
-+static void
-+generate_fakevolume_hotplug_event_add_for_storage_device (HalDevice *d)
-+{
-+ const char *sysfs_path;
-+ const char *device_file;
-+ HotplugEvent *hotplug_event;
-+ char fake_sysfs_path[HAL_PATH_MAX];
-+
-+ sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
-+ device_file = hal_device_property_get_string (d, "block.device");
-+
-+ snprintf (fake_sysfs_path, sizeof(fake_sysfs_path), "%s/fakevolume", sysfs_path);
-+
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_ADD;
-+ hotplug_event->type = HOTPLUG_EVENT_SYSFS;
-+ g_strlcpy (hotplug_event->sysfs.subsystem, "block", sizeof (hotplug_event->sysfs.subsystem));
-+ g_strlcpy (hotplug_event->sysfs.sysfs_path, fake_sysfs_path, sizeof (hotplug_event->sysfs.sysfs_path));
-+ if (device_file != NULL)
-+ g_strlcpy (hotplug_event->sysfs.device_file, device_file, sizeof (hotplug_event->sysfs.device_file));
-+ else
-+ hotplug_event->sysfs.device_file[0] = '\0';
-+ hotplug_event->sysfs.net_ifindex = -1;
-+
-+ hotplug_event_enqueue (hotplug_event);
-+ hotplug_event_process_queue ();
-+}
-+
-+static void
-+add_blockdev_probing_helper_done (HalDevice *d, guint32 exit_type,
-+ gint return_code, char **error,
-+ gpointer data1, gpointer data2)
-+{
-+ void *end_token = (void *) data1;
-+ gboolean is_volume;
-+
-+ /* helper_data may be null if probing is skipped */
-+
-+ HAL_INFO (("entering; exit_type=%d, return_code=%d", exit_type, return_code));
-+
-+ if (d == NULL) {
-+ HAL_INFO (("Device object already removed"));
-+ hotplug_event_end (end_token);
-+ goto out;
-+ }
-+
-+ is_volume = hal_device_property_get_bool (d, "block.is_volume");
-+
-+ /* Discard device if probing reports failure
-+ *
-+ * (return code 2 means fs found on main block device (for non-volumes))
-+ */
-+ if (exit_type != HALD_RUN_SUCCESS
-+ || !(return_code == 0 || (!is_volume && return_code == 2))) {
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ g_object_unref (d);
-+ hotplug_event_end (end_token);
-+ goto out;
-+ }
-+
-+ if (!blockdev_compute_udi (d)) {
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ g_object_unref (d);
-+ hotplug_event_end (end_token);
-+ goto out;
-+ }
-+
-+ /* set block.storage_device for storage devices since only now we know the UDI */
-+ if (!is_volume) {
-+ hal_device_copy_property (d, "info.udi", d, "block.storage_device");
-+ } else {
-+ /* check for mount point */
-+ blockdev_refresh_mount_state (d);
-+ }
-+
-+ /* Merge properties from .fdi files */
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
-+
-+ /* TODO: Merge persistent properties */
-+
-+ /* Run callouts */
-+ hal_util_callout_device_add (d, blockdev_callouts_add_done, end_token, NULL);
-+
-+ /* Yay, got a file system on the main block device...
-+ *
-+ * Generate a fake hotplug event to get this added
-+ */
-+ if (!is_volume && return_code == 2) {
-+ generate_fakevolume_hotplug_event_add_for_storage_device (d);
-+ }
-+
-+
-+out:
-+ return;
-+}
-+
-+static void
-+blockdev_callouts_preprobing_storage_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
-+{
-+ void *end_token = (void *) userdata1;
-+
-+ if (hal_device_property_get_bool (d, "info.ignore")) {
-+ /* Leave the device here with info.ignore==TRUE so we won't pick up children
-+ * Also remove category and all capabilities
-+ */
-+ hal_device_property_remove (d, "info.category");
-+ hal_device_property_remove (d, "info.capabilities");
-+ hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device");
-+ hal_device_property_set_string (d, "info.product", "Ignored Device");
-+
-+ HAL_INFO (("Preprobing merged info.ignore==TRUE"));
-+
-+ /* Move from temporary to global device store */
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ hal_device_store_add (hald_get_gdl (), d);
-+
-+ hotplug_event_end (end_token);
-+ goto out;
-+ }
-+
-+ if (!hal_device_property_get_bool (d, "storage.media_check_enabled") &&
-+ hal_device_property_get_bool (d, "storage.no_partitions_hint")) {
-+
-+ /* special probe for PC floppy drives */
-+ if (strcmp (hal_device_property_get_string (d, "storage.bus"), "platform") == 0 &&
-+ strcmp (hal_device_property_get_string (d, "storage.drive_type"), "floppy") == 0) {
-+ HAL_INFO (("Probing PC floppy %s to see if it is present",
-+ hal_device_property_get_string (d, "block.device")));
-+
-+ hald_runner_run(d,
-+ "hald-probe-pc-floppy", NULL,
-+ HAL_HELPER_TIMEOUT,
-+ add_blockdev_probing_helper_done,
-+ (gpointer) end_token, NULL);
-+ goto out;
-+ } else {
-+ char *synerror[1] = {NULL};
-+
-+ HAL_INFO (("Not probing storage device %s",
-+ hal_device_property_get_string (d, "block.device")));
-+
-+ add_blockdev_probing_helper_done (d, FALSE, 0, synerror, (gpointer) end_token, NULL);
-+ goto out;
-+ }
-+ }
-+
-+ /* run prober for
-+ *
-+ * - cdrom drive properties
-+ * - non-partitioned filesystem on main block device
-+ */
-+
-+ HAL_INFO (("Probing storage device %s", hal_device_property_get_string (d, "block.device")));
-+
-+ /* probe the device */
-+ hald_runner_run(d,
-+ "hald-probe-storage", NULL,
-+ HAL_HELPER_TIMEOUT,
-+ add_blockdev_probing_helper_done,
-+ (gpointer) end_token, NULL);
-+
-+out:
-+ return;
-+}
-+
-+static void
-+blockdev_callouts_preprobing_volume_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
-+{
-+ void *end_token = (void *) userdata1;
-+
-+ if (hal_device_property_get_bool (d, "info.ignore")) {
-+ /* Leave the device here with info.ignore==TRUE so we won't pick up children
-+ * Also remove category and all capabilities
-+ */
-+ hal_device_property_remove (d, "info.category");
-+ hal_device_property_remove (d, "info.capabilities");
-+ hal_device_property_set_string (d, "info.udi", "/org/freedesktop/Hal/devices/ignored-device");
-+ hal_device_property_set_string (d, "info.product", "Ignored Device");
-+
-+ HAL_INFO (("Preprobing merged info.ignore==TRUE"));
-+
-+ /* Move from temporary to global device store */
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ hal_device_store_add (hald_get_gdl (), d);
-+
-+ hotplug_event_end (end_token);
-+ goto out;
-+ }
-+
-+ /* probe the device */
-+ hald_runner_run (d,
-+ "hald-probe-volume", NULL,
-+ HAL_HELPER_TIMEOUT,
-+ add_blockdev_probing_helper_done,
-+ (gpointer) end_token, NULL);
-+out:
-+ return;
-+}
-+
-+static const gchar *
-+blockdev_get_luks_uuid(const gchar *device_file)
-+{
-+ const gchar *luks_uuid = NULL;
-+ unsigned int major;
-+ unsigned int minor;
-+ const char *last_elem;
-+
-+ HAL_INFO (("get_luks_uuid: device_file=%s", device_file));
-+
-+ major = 253; /* FIXME: replace by devmapper constant */
-+ last_elem = hal_util_get_last_element (device_file);
-+ if (sscanf (last_elem, "dm-%d", &minor) == 1) {
-+ GDir *dir;
-+ HAL_INFO (("path=%s is a device mapper dev, major/minor=%d/%d", device_file, major, minor));
-+ /* Ugly hack to see if we're a LUKS crypto device; should
-+ * be replaced by some ioctl or libdevmapper stuff by where
-+ * we can ask about the name for /dev/dm-0; as e.g. given by
-+ * 'dmsetup info'
-+ *
-+ * Our assumption is that luks-setup have invoked
-+ * dmsetup; e.g. the naming convention is
-+ *
-+ * luks_crypto_<luks_uuid>
-+ *
-+ * where <luks_uuid> is the UUID encoded in the luks
-+ * metadata.
-+ */
-+ /* Ugly sleep of 0.5s here as well to allow dmsetup to do the mknod */
-+ if (!hald_is_initialising)
-+ usleep (1000 * 1000 * 5 / 10);
-+ if ((dir = g_dir_open ("/dev/mapper", 0, NULL)) != NULL) {
-+ const gchar *f;
-+ char devpath[256];
-+ struct stat statbuf;
-+ while ((f = g_dir_read_name (dir)) != NULL) {
-+ char luks_prefix[] = "luks_crypto_";
-+ g_snprintf (devpath, sizeof (devpath), "/dev/mapper/%s", f);
-+ if (stat (devpath, &statbuf) == 0) {
-+ HAL_INFO (("looking at /dev/mapper/%s with %d:%d",
-+ f, MAJOR(statbuf.st_rdev), MINOR(statbuf.st_rdev)));
-+ if (S_ISBLK (statbuf.st_mode) &&
-+ MAJOR(statbuf.st_rdev) == major &&
-+ MINOR(statbuf.st_rdev) == minor &&
-+ strncmp (f, luks_prefix, sizeof (luks_prefix) - 1) == 0) {
-+ luks_uuid = f + sizeof (luks_prefix) - 1;
-+ HAL_INFO (("found %s; luks_uuid='%s'!", devpath, luks_uuid));
-+ break;
-+ }
-+ }
-+ }
-+ g_dir_close (dir);
-+ }
-+ }
-+ return luks_uuid;
-+}
-+
-+static HalDevice *
-+blockdev_get_luks_parent (const gchar *luks_uuid, HalDevice *device)
-+{
-+ HalDevice *parent = NULL;
-+ HalDevice *backing_volume;
-+
-+ HAL_INFO (("get_luks_parent: luks_uuid=%s device=0x%08x",
-+ luks_uuid, device));
-+
-+ backing_volume = hal_device_store_match_key_value_string (hald_get_gdl (),
-+ "volume.uuid",
-+ luks_uuid);
-+ if (backing_volume != NULL) {
-+ const char *backing_volume_stordev_udi;
-+ HAL_INFO (("backing_volume udi='%s'!", backing_volume->udi));
-+ backing_volume_stordev_udi = hal_device_property_get_string (backing_volume, "block.storage_device");
-+ if (backing_volume_stordev_udi != NULL) {
-+ HAL_INFO (("backing_volume_stordev_udi='%s'!", backing_volume_stordev_udi));
-+ parent = hal_device_store_find (hald_get_gdl (), backing_volume_stordev_udi);
-+ if (parent != NULL) {
-+ HAL_INFO (("parent='%s'!", parent->udi));
-+ hal_device_property_set_string (device, "volume.crypto_luks.clear.backing_volume", backing_volume->udi);
-+ }
-+ }
-+ }
-+ return parent;
-+}
-+
-+void
-+hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_file, gboolean is_partition,
-+ HalDevice *parent, void *end_token)
-+{
-+ HotplugEvent *hotplug_event = (HotplugEvent *) end_token;
-+ gchar *major_minor;
-+ HalDevice *d;
-+ unsigned int major, minor;
-+ gboolean is_fakevolume;
-+ char *sysfs_path_real = NULL;
-+ int floppy_num;
-+
-+ HAL_INFO (("block_add: sysfs_path=%s dev=%s is_part=%d, parent=0x%08x",
-+ sysfs_path, device_file, is_partition, parent));
-+
-+ if (parent != NULL && hal_device_property_get_bool (parent, "info.ignore")) {
-+ HAL_INFO (("Ignoring block_add since parent has info.ignore==TRUE"));
-+ goto out;
-+ }
-+
-+ if (strcmp (hal_util_get_last_element (sysfs_path), "fakevolume") == 0) {
-+ is_fakevolume = TRUE;
-+ sysfs_path_real = hal_util_get_parent_path (sysfs_path);
-+ HAL_INFO (("Handling %s as fakevolume - sysfs_path_real=%s", device_file, sysfs_path_real));
-+ } else {
-+ is_fakevolume = FALSE;
-+ sysfs_path_real = g_strdup (sysfs_path);
-+ }
-+
-+ /* See if we already have device (which we may have as we're ignoring rem/add
-+ * for certain classes of devices - see hotplug_event_begin_remove_blockdev)
-+ */
-+ d = hal_device_store_match_key_value_string (hald_get_gdl (), "linux.sysfs_path", sysfs_path);
-+ if (d != NULL) {
-+ HAL_INFO (("Ignoring hotplug event - device is already added"));
-+ goto out;
-+ }
-+
-+ d = hal_device_new ();
-+
-+ if (parent == NULL) {
-+ const gchar *luks_uuid = blockdev_get_luks_uuid (device_file);
-+ if (luks_uuid != NULL) {
-+ is_partition = TRUE;
-+ parent = blockdev_get_luks_parent (luks_uuid, d);
-+ }
-+ }
-+
-+ if (parent == NULL) {
-+ HAL_INFO (("Ignoring hotplug event - no parent"));
-+ goto error;
-+ }
-+
-+ if (!is_fakevolume && hal_device_property_get_bool (parent, "storage.no_partitions_hint")) {
-+ HAL_INFO (("Ignoring blockdev since not a fakevolume and parent has "
-+ "storage.no_partitions_hint==TRUE"));
-+ goto error;
-+ }
-+
-+ hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-+ hal_device_property_set_string (d, "linux.sysfs_path_device", sysfs_path);
-+ hal_device_property_set_string (d, "info.parent", parent->udi);
-+ hal_device_property_set_int (d, "linux.hotplug_type", HOTPLUG_EVENT_SYSFS_BLOCK);
-+
-+ hal_device_property_set_string (d, "block.device", device_file);
-+ if ((major_minor = hal_util_get_string_from_file (sysfs_path_real, "dev")) == NULL ||
-+ sscanf (major_minor, "%d:%d", &major, &minor) != 2) {
-+ HAL_INFO (("Ignoring hotplug event - cannot read major:minor"));
-+ goto error;
-+ }
-+
-+ hal_device_property_set_int (d, "block.major", major);
-+ hal_device_property_set_int (d, "block.minor", minor);
-+ hal_device_property_set_bool (d, "block.is_volume", is_partition);
-+
-+ if (hal_device_has_property(parent, "info.bus") &&
-+ (strcmp(hal_device_property_get_string(parent, "info.bus"), "platform") == 0) &&
-+ (sscanf(hal_device_property_get_string(parent, "platform.id"), "floppy.%d", &floppy_num) == 1)) {
-+ /* for now, just cheat here for floppy drives */
-+
-+ HAL_INFO (("doing floppy drive hack for floppy %d", floppy_num));
-+
-+ hal_device_property_set_string (d, "storage.bus", "platform");
-+ hal_device_property_set_bool (d, "storage.no_partitions_hint", TRUE);
-+ hal_device_property_set_bool (d, "storage.media_check_enabled", FALSE);
-+ hal_device_property_set_bool (d, "storage.automount_enabled_hint", TRUE);
-+ hal_device_property_set_string (d, "storage.model", "");
-+ hal_device_property_set_string (d, "storage.vendor", "PC Floppy Drive");
-+ hal_device_property_set_string (d, "info.vendor", "");
-+ hal_device_property_set_string (d, "info.product", "PC Floppy Drive");
-+ hal_device_property_set_string (d, "storage.drive_type", "floppy");
-+ hal_device_property_set_string (d, "storage.physical_device", parent->udi);
-+ hal_device_property_set_bool (d, "storage.removable", TRUE);
-+ hal_device_property_set_bool (d, "storage.hotpluggable", FALSE);
-+ hal_device_property_set_bool (d, "storage.requires_eject", FALSE);
-+
-+ hal_device_property_set_string (d, "info.category", "storage");
-+ hal_device_add_capability (d, "storage");
-+ hal_device_add_capability (d, "block");
-+
-+ /* add to TDL so preprobing callouts and prober can access it */
-+ hal_device_store_add (hald_get_tdl (), d);
-+
-+ /* Process preprobe fdi files */
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
-+
-+ /* Run preprobe callouts */
-+ hal_util_callout_device_preprobe (d, blockdev_callouts_preprobing_storage_done, end_token, NULL);
-+ goto out2;
-+ }
-+
-+ if (!is_partition) {
-+ const char *udi_it;
-+ const char *physdev_udi;
-+ HalDevice *scsidev;
-+ HalDevice *physdev;
-+ gboolean is_hotpluggable;
-+ gboolean is_removable;
-+ gboolean requires_eject;
-+ gboolean no_partitions_hint;
-+ const gchar *bus;
-+ const gchar *parent_bus;
-+
-+ /********************************
-+ * storage devices
-+ *******************************/
-+
-+ scsidev = NULL;
-+ physdev = NULL;
-+ physdev_udi = NULL;
-+
-+ is_removable = FALSE;
-+ is_hotpluggable = FALSE;
-+ requires_eject = FALSE;
-+ no_partitions_hint = FALSE;
-+
-+ /* defaults */
-+ hal_device_property_set_string (d, "storage.bus", "unknown");
-+ hal_device_property_set_bool (d, "storage.no_partitions_hint", TRUE);
-+ hal_device_property_set_bool (d, "storage.media_check_enabled", TRUE);
-+ hal_device_property_set_bool (d, "storage.automount_enabled_hint", TRUE);
-+ hal_device_property_set_string (d, "storage.drive_type", "disk");
-+
-+ /* persistent properties from udev (may be empty) */
-+ hal_device_property_set_string (d, "storage.model", hotplug_event->sysfs.model);
-+ hal_device_property_set_string (d, "storage.vendor", hotplug_event->sysfs.vendor);
-+ if (hotplug_event->sysfs.serial[0] != '\0')
-+ hal_device_property_set_string (d, "storage.serial", hotplug_event->sysfs.serial);
-+ if (hotplug_event->sysfs.revision[0] != '\0')
-+ hal_device_property_set_string (d, "storage.firmware_version", hotplug_event->sysfs.revision);
-+
-+ /* walk up the device chain to find the physical device,
-+ * start with our parent. On the way, optionally pick up
-+ * the scsi if it exists */
-+ udi_it = parent->udi;
-+ while (udi_it != NULL) {
-+ HalDevice *d_it;
-+
-+ /*************************
-+ *
-+ * STORAGE
-+ *
-+ ************************/
-+
-+ /* Find device */
-+ d_it = hal_device_store_find (hald_get_gdl (), udi_it);
-+ g_assert (d_it != NULL);
-+
-+ /* Check info.bus */
-+ if ((bus = hal_device_property_get_string (d_it, "info.bus")) != NULL) {
-+ if (strcmp (bus, "scsi") == 0) {
-+ scsidev = d_it;
-+ physdev = d_it;
-+ physdev_udi = udi_it;
-+ hal_device_property_set_string (d, "storage.bus", "scsi");
-+ hal_device_copy_property (scsidev, "scsi.lun", d, "storage.lun");
-+ /* want to continue here, because it may be USB or IEEE1394 */
-+ }
-+
-+ if (strcmp (bus, "usb") == 0) {
-+ physdev = d_it;
-+ physdev_udi = udi_it;
-+ is_hotpluggable = TRUE;
-+ hal_device_property_set_string (d, "storage.bus", "usb");
-+ break;
-+ } else if (strcmp (bus, "ieee1394") == 0) {
-+ physdev = d_it;
-+ physdev_udi = udi_it;
-+ is_hotpluggable = TRUE;
-+ hal_device_property_set_string (d, "storage.bus", "ieee1394");
-+ break;
-+ } else if (strcmp (bus, "ide") == 0) {
-+ physdev = d_it;
-+ physdev_udi = udi_it;
-+ hal_device_property_set_string (d, "storage.bus", "ide");
-+ break;
-+ } else if (strcmp (bus, "mmc") == 0) {
-+ physdev = d_it;
-+ physdev_udi = udi_it;
-+ is_hotpluggable = TRUE;
-+ hal_device_property_set_string (d, "storage.bus", "mmc");
-+ break;
-+ } else if (strcmp (bus, "ccw") == 0) {
-+ physdev = d_it;
-+ physdev_udi = udi_it;
-+ is_hotpluggable = TRUE;
-+ hal_device_property_set_string
-+ (d, "storage.bus", "ccw");
-+ }
-+ }
-+
-+ /* Go to parent */
-+ udi_it = hal_device_property_get_string (d_it, "info.parent");
-+ }
-+
-+ /* needs physical device */
-+ if (physdev_udi == NULL) {
-+ HAL_WARNING (("No physical device?"));
-+ goto error;
-+ }
-+
-+ hal_device_property_set_string (d, "storage.physical_device", physdev_udi);
-+
-+ if (!hal_util_get_int_from_file (sysfs_path, "removable", (gint *) &is_removable, 10)) {
-+ HAL_WARNING (("Cannot get 'removable' file"));
-+ goto error;
-+ }
-+
-+ hal_device_property_set_bool (d, "storage.removable", is_removable);
-+
-+ /* by default, do checks for media if, and only if, the removable file is set to 1
-+ *
-+ * Problematic buses, like IDE, may override this.
-+ */
-+ hal_device_property_set_bool (d, "storage.media_check_enabled", is_removable);
-+
-+ parent_bus = hal_device_property_get_string (parent, "info.bus");
-+ HAL_INFO (("parent_bus is %s", parent_bus));
-+
-+ /* per-bus specific properties */
-+ if (strcmp (parent_bus, "ide") == 0) {
-+ char buf[256];
-+ gchar *media;
-+ gchar *model;
-+
-+ /* Be conservative and don't poll IDE drives at all (except CD-ROM's, see below) */
-+ hal_device_property_set_bool (d, "storage.media_check_enabled", FALSE);
-+
-+ /* according to kernel source, media can assume the following values:
-+ *
-+ * "disk", "cdrom", "tape", "floppy", "UNKNOWN"
-+ */
-+ snprintf (buf, sizeof (buf), "%s/ide/%s", get_hal_proc_path (), hal_util_get_last_element (sysfs_path));
-+ if ((media = hal_util_get_string_from_file (buf, "media")) != NULL) {
-+ if (strcmp (media, "disk") == 0 ||
-+ strcmp (media, "cdrom") == 0 ||
-+ strcmp (media, "floppy") == 0) {
-+ hal_device_property_set_string (d, "storage.drive_type", media);
-+ } else {
-+ HAL_WARNING (("Cannot determine IDE drive type from file %s/media", buf));
-+ goto error;
-+ }
-+
-+ if (strcmp (media, "cdrom") == 0) {
-+ /* only optical drives are the only IDE devices that can safely be polled */
-+ hal_device_property_set_bool (d, "storage.media_check_enabled", TRUE);
-+ }
-+ }
-+
-+ if ((model = hal_util_get_string_from_file (buf, "model")) != NULL) {
-+ hal_device_property_set_string (d, "storage.model", model);
-+ hal_device_property_set_string (d, "info.product", model);
-+ }
-+
-+ } else if (strcmp (parent_bus, "scsi") == 0) {
-+ if (strcmp (hal_device_property_get_string (parent, "scsi.type"), "unknown") == 0) {
-+ HAL_WARNING (("scsi.type is unknown"));
-+ goto error;
-+ }
-+ hal_device_copy_property (parent, "scsi.type", d, "storage.drive_type");
-+ hal_device_copy_property (parent, "scsi.vendor", d, "storage.vendor");
-+ hal_device_copy_property (parent, "scsi.model", d, "storage.model");
-+
-+ hal_device_copy_property (d, "storage.vendor", d, "info.vendor");
-+ hal_device_copy_property (d, "storage.model", d, "info.product");
-+
-+ /* Check for USB floppy drive by looking at USB Mass Storage interface class
-+ * instead of Protocol: Uniform Floppy Interface (UFI) in /proc as we did before.
-+ *
-+ * (should fix RH bug 133834)
-+ */
-+ if (physdev != NULL) {
-+ if (hal_device_property_get_int (physdev, "usb.interface.class") == 8 &&
-+ hal_device_property_get_int (physdev, "usb.interface.subclass") == 4 ) {
-+
-+ hal_device_property_set_string (d, "storage.drive_type", "floppy");
-+
-+ /* My experiments with my USB LaCie Floppy disk
-+ * drive is that polling indeed work (Yay!), so
-+ * we don't set storage.media_check_enabled to
-+ * FALSE - for devices where this doesn't work,
-+ * we can override it with .fdi files
-+ */
-+ }
-+ }
-+
-+ } else if (strcmp (parent_bus, "mmc") == 0) {
-+ hal_device_property_set_string (d, "storage.drive_type", "sd_mmc");
-+ }
-+
-+ hal_device_property_set_string (d, "info.category", "storage");
-+ hal_device_add_capability (d, "storage");
-+ hal_device_add_capability (d, "block");
-+
-+ if (strcmp (hal_device_property_get_string (d, "storage.drive_type"), "cdrom") == 0) {
-+ hal_device_add_capability (d, "storage.cdrom");
-+ no_partitions_hint = TRUE;
-+ requires_eject = TRUE;
-+ }
-+
-+ if (strcmp (hal_device_property_get_string (d, "storage.drive_type"), "floppy") == 0) {
-+ no_partitions_hint = TRUE;
-+ }
-+
-+ hal_device_property_set_bool (d, "storage.hotpluggable", is_hotpluggable);
-+ hal_device_property_set_bool (d, "storage.requires_eject", requires_eject);
-+ hal_device_property_set_bool (d, "storage.no_partitions_hint", no_partitions_hint);
-+
-+ /* add to TDL so preprobing callouts and prober can access it */
-+ hal_device_store_add (hald_get_tdl (), d);
-+
-+ /* Process preprobe fdi files */
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
-+
-+ /* Run preprobe callouts */
-+ hal_util_callout_device_preprobe (d, blockdev_callouts_preprobing_storage_done, end_token, NULL);
-+
-+ } else {
-+ guint sysfs_path_len;
-+
-+ /*************************
-+ *
-+ * VOLUMES
-+ *
-+ ************************/
-+ hal_device_property_set_string (d, "block.storage_device", parent->udi);
-+
-+ /* defaults */
-+ hal_device_property_set_string (d, "storage.model", "");
-+ hal_device_property_set_string (d, "volume.fstype", "");
-+ hal_device_property_set_string (d, "volume.fsusage", "");
-+ hal_device_property_set_string (d, "volume.fsversion", "");
-+ hal_device_property_set_string (d, "volume.uuid", "");
-+ hal_device_property_set_string (d, "volume.label", "");
-+ hal_device_property_set_string (d, "volume.mount_point", "");
-+ hal_device_property_set_bool (d, "volume.is_mounted", FALSE);
-+ hal_device_property_set_bool (
-+ d, "volume.is_disc",
-+ strcmp (hal_device_property_get_string (parent, "storage.drive_type"), "cdrom") == 0);
-+ hal_device_property_set_bool (d, "volume.is_partition", TRUE);
-+
-+ hal_device_property_set_string (d, "info.category", "volume");
-+ hal_device_add_capability (d, "volume");
-+ hal_device_add_capability (d, "block");
-+
-+ /* determine partition number - unless, of course, we're a fakevolume */
-+ sysfs_path_len = strlen (sysfs_path);
-+ if (!is_fakevolume) {
-+ if (sysfs_path_len > 0 && isdigit (sysfs_path[sysfs_path_len - 1])) {
-+ guint i;
-+ for (i = sysfs_path_len - 1; isdigit (sysfs_path[i]); --i)
-+ ;
-+ if (isdigit (sysfs_path[i+1])) {
-+ guint partition_number;
-+ partition_number = atoi (&sysfs_path[i+1]);
-+ hal_device_property_set_int (d, "volume.partition.number", partition_number);
-+ } else {
-+ HAL_WARNING (("Cannot determine partition number?"));
-+ goto error;
-+ }
-+ } else {
-+ HAL_WARNING (("Cannot determine partition number"));
-+ goto error;
-+ }
-+ }
-+
-+ /* first estimate - prober may override this...
-+ *
-+ * (block size requires opening the device file)
-+ */
-+ hal_device_property_set_int (d, "volume.block_size", 512);
-+ if (!hal_util_set_int_from_file (d, "volume.num_blocks", sysfs_path_real, "size", 0)) {
-+ HAL_INFO (("Ignoring hotplug event - cannot read 'size'"));
-+ goto error;
-+ }
-+ hal_device_property_set_uint64 (
-+ d, "volume.size",
-+ ((dbus_uint64_t)(512)) * ((dbus_uint64_t)(hal_device_property_set_int (d, "volume.block_size", 512))));
-+
-+ /* add to TDL so preprobing callouts and prober can access it */
-+ hal_device_store_add (hald_get_tdl (), d);
-+
-+ /* Process preprobe fdi files */
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_PREPROBE);
-+
-+ /* Run preprobe callouts */
-+ hal_util_callout_device_preprobe (d, blockdev_callouts_preprobing_volume_done, end_token, NULL);
-+ }
-+out2:
-+ g_free (sysfs_path_real);
-+ return;
-+
-+error:
-+ HAL_WARNING (("Not adding device object"));
-+ if (d != NULL)
-+ g_object_unref (d);
-+out:
-+ hotplug_event_end (end_token);
-+ g_free (sysfs_path_real);
-+}
-+
-+static void
-+force_unmount_cb (HalDevice *d, guint32 exit_type,
-+ gint return_code, gchar **error,
-+ gpointer data1, gpointer data2)
-+{
-+ void *end_token = (void *) data1;
-+
-+ HAL_INFO (("force_unmount_cb for udi='%s', exit_type=%d, return_code=%d", d->udi, exit_type, return_code));
-+
-+ if (exit_type == HALD_RUN_SUCCESS && error != NULL &&
-+ error[0] != NULL && error[1] != NULL) {
-+ char *exp_name = NULL;
-+ char *exp_detail = NULL;
-+
-+ exp_name = error[0];
-+ if (error[0] != NULL) {
-+ exp_detail = error[1];
-+ }
-+ HAL_INFO (("failed with '%s' '%s'", exp_name, exp_detail));
-+ }
-+
-+ hal_util_callout_device_remove (d, blockdev_callouts_remove_done, end_token, NULL);
-+
-+}
-+
-+static void
-+force_unmount (HalDevice *d, void *end_token)
-+{
-+ char *unmount_stdin;
-+ char *extra_env[2];
-+
-+ extra_env[0] = "HAL_METHOD_INVOKED_BY_UID=0";
-+ extra_env[1] = NULL;
-+
-+ HAL_INFO (("force_unmount for udi='%s'", d->udi));
-+
-+ unmount_stdin = "lazy\n";
-+
-+ hald_runner_run_method (d,
-+ "hal-system-storage-unmount", extra_env,
-+ unmount_stdin, TRUE,
-+ 0,
-+ force_unmount_cb,
-+ end_token, NULL);
-+}
-+
-+void
-+hotplug_event_begin_remove_blockdev (const gchar *sysfs_path, gboolean is_partition, void *end_token)
-+{
-+ HalDevice *d;
-+
-+ HAL_INFO (("block_rem: sysfs_path=%s is_part=%d", sysfs_path, is_partition));
-+
-+ d = hal_device_store_match_key_value_string (hald_get_gdl (), "linux.sysfs_path", sysfs_path);
-+ if (d == NULL) {
-+ HAL_WARNING (("Error removing device"));
-+ hotplug_event_end (end_token);
-+ } else {
-+ const char *stor_udi;
-+ HalDevice *stor_dev;
-+ gboolean is_fakevolume;
-+
-+ is_partition = hal_device_property_get_bool (d, "volume.is_partition");
-+
-+ if (strcmp (hal_util_get_last_element (sysfs_path), "fakevolume") == 0)
-+ is_fakevolume = TRUE;
-+ else
-+ is_fakevolume = FALSE;
-+
-+ /* ignore hotplug events on IDE partitions since ide-cs and others causes hotplug
-+ * rem/add when the last closer (including mount) closes the device. (Unless it's
-+ * a fakevolume)
-+ *
-+ * This causes an infinite loop since we open the device to probe. How nice.
-+ *
-+ * Instead - we'll be removing the partition once the main block device
-+ * goes away
-+ */
-+ stor_udi = hal_device_property_get_string (d, "block.storage_device");
-+ if (is_partition &&
-+ !is_fakevolume &&
-+ stor_udi != NULL &&
-+ ((stor_dev = hal_device_store_find (hald_get_gdl (), stor_udi)) != NULL)) {
-+ const char *stor_bus;
-+ stor_bus = hal_device_property_get_string (stor_dev, "storage.bus");
-+ if (strcmp (stor_bus, "ide") == 0) {
-+ /* unless we are already delayed, cf. the code below */
-+ if (hal_device_property_get_bool (d, ".already_delayed") != TRUE) {
-+ HAL_INFO (("Ignoring hotplug event"));
-+ hotplug_event_end (end_token);
-+ goto out;
-+ }
-+ }
-+ } else if (!is_partition) {
-+ GSList *i;
-+ GSList *partitions;
-+ unsigned int num_childs;
-+ /* see if there any partitions lying around that we refused to remove above */
-+
-+ partitions = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
-+ "block.storage_device",
-+ stor_udi);
-+
-+ /* have to count number of childs first */
-+ num_childs = 0;
-+ for (i = partitions; i != NULL; i = g_slist_next (i)) {
-+ HalDevice *child;
-+ child = HAL_DEVICE (i->data);
-+ /* ignore ourself */
-+ if (child == d)
-+ continue;
-+ num_childs++;
-+ }
-+
-+ if (num_childs > 0) {
-+
-+ /* OK, so we did have childs to remove before removing ourself
-+ *
-+ * Enqueue at front of queue; the childs will get in front of us
-+ * because they will also queue up in front of use (damn kids!)
-+ */
-+ HAL_INFO (("Delaying hotplug event until childs are done and gone"));
-+ hotplug_event_enqueue_at_front ((HotplugEvent *) end_token);
-+
-+ for (i = partitions; i != NULL; i = g_slist_next (i)) {
-+ HalDevice *child;
-+ HotplugEvent *hotplug_event;
-+ child = HAL_DEVICE (i->data);
-+ /* ignore ourself */
-+ if (child == d)
-+ continue;
-+
-+ /* set a flag such that we *will* get removed above */
-+ hal_device_property_set_bool (child, ".already_delayed", TRUE);
-+
-+ HAL_INFO (("Generating hotplug rem for ignored fakevolume/ide_part with udi %s",
-+ child->udi));
-+ /* yay! - gen hotplug event and fast track us to the front of the queue :-) */
-+ hotplug_event = blockdev_generate_remove_hotplug_event (child);
-+ hotplug_event_enqueue_at_front (hotplug_event);
-+ }
-+
-+ g_slist_free (partitions);
-+
-+ /* since we pushed ourselves into the queue again above, say that we're done
-+ * but the event shouldn't get deleted
-+ */
-+ hotplug_event_reposted (end_token);
-+ goto out;
-+
-+ } else {
-+ /* No childs to remove before ourself; just remove ourself, e.g. carry on below */
-+ g_slist_free (partitions);
-+ }
-+ }
-+
-+ /* if we're mounted, then do a lazy unmount so the system can gracefully recover */
-+ if (hal_device_property_get_bool (d, "volume.is_mounted")) {
-+ force_unmount (d, end_token);
-+ } else {
-+ hal_util_callout_device_remove (d, blockdev_callouts_remove_done, end_token, NULL);
-+ }
-+ }
-+out:
-+ ;
-+}
-+
-+static void
-+block_rescan_storage_done (HalDevice *d, guint32 exit_type,
-+ gint return_code, gchar **error,
-+ gpointer data1, gpointer data2)
-+{
-+ const char *sysfs_path;
-+ HalDevice *fakevolume;
-+ char fake_sysfs_path[HAL_PATH_MAX];
-+
-+ HAL_INFO (("hald-probe-storage --only-check-for-media returned %d (exit_type=%d)", return_code, exit_type));
-+
-+ if (d == NULL) {
-+ HAL_INFO (("Device object already removed"));
-+ goto out;
-+ }
-+
-+ sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
-+
-+ /* see if we already got a fake volume */
-+ snprintf (fake_sysfs_path, sizeof(fake_sysfs_path), "%s/fakevolume", sysfs_path);
-+ fakevolume = hal_device_store_match_key_value_string (hald_get_gdl (), "linux.sysfs_path", fake_sysfs_path);
-+
-+ if (return_code == 2) {
-+ /* we've got a fs on the main block device - add fakevolume if we haven't got one already */
-+ if (fakevolume == NULL) {
-+ generate_fakevolume_hotplug_event_add_for_storage_device (d);
-+ }
-+ } else {
-+ /* no fs on the main block device - remove fakevolume if we have one */
-+ if (fakevolume != NULL) {
-+ /* generate hotplug event to remove the fakevolume */
-+ HotplugEvent *hotplug_event;
-+ hotplug_event = blockdev_generate_remove_hotplug_event (fakevolume);
-+ if (hotplug_event != NULL) {
-+ hotplug_event_enqueue (hotplug_event);
-+ hotplug_event_process_queue ();
-+ }
-+ }
-+ }
-+
-+out:
-+ ;
-+}
-+
-+gboolean
-+blockdev_rescan_device (HalDevice *d)
-+{
-+ gboolean ret;
-+
-+ ret = FALSE;
-+
-+ HAL_INFO (("Entering, udi=%s", d->udi));
-+
-+ /* This only makes sense on storage devices */
-+ if (hal_device_property_get_bool (d, "block.is_volume")) {
-+ HAL_INFO (("No action on volumes", d->udi));
-+ goto out;
-+ }
-+
-+ /* now see if we got a file system on the main block device */
-+ hald_runner_run (d,
-+ "hald-probe-storage --only-check-for-media", NULL,
-+ HAL_HELPER_TIMEOUT,
-+ block_rescan_storage_done,
-+ NULL, NULL);
-+ ret = TRUE;
-+
-+out:
-+ return ret;
-+}
-+
-+
-+HotplugEvent *
-+blockdev_generate_add_hotplug_event (HalDevice *d)
-+{
-+ const char *sysfs_path;
-+ const char *device_file;
-+ const char *model;
-+ const char *vendor;
-+ const char *serial;
-+ const char *revision;
-+ HotplugEvent *hotplug_event;
-+ const char *nul;
-+
-+ nul = "\0";
-+
-+ sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
-+
-+ device_file = hal_device_property_get_string (d, "block.device");
-+ model = hal_device_property_get_string (d, "storage.model");
-+ vendor = hal_device_property_get_string (d, "storage.vendor");
-+ serial = hal_device_property_get_string (d, "storage.serial");
-+ revision = hal_device_property_get_string (d, "storage.firmware_revision");
-+
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_ADD;
-+ hotplug_event->type = HOTPLUG_EVENT_SYSFS;
-+ g_strlcpy (hotplug_event->sysfs.subsystem, "block", sizeof (hotplug_event->sysfs.subsystem));
-+ g_strlcpy (hotplug_event->sysfs.sysfs_path, sysfs_path, sizeof (hotplug_event->sysfs.sysfs_path));
-+
-+ g_strlcpy (hotplug_event->sysfs.device_file, device_file != NULL ? device_file : nul, HAL_NAME_MAX);
-+ g_strlcpy (hotplug_event->sysfs.vendor, vendor != NULL ? vendor : nul, HAL_NAME_MAX);
-+ g_strlcpy (hotplug_event->sysfs.model, model != NULL ? model : nul, HAL_NAME_MAX);
-+ g_strlcpy (hotplug_event->sysfs.serial, serial != NULL ? serial : nul, HAL_NAME_MAX);
-+ g_strlcpy (hotplug_event->sysfs.revision, revision != NULL ? revision : nul, HAL_NAME_MAX);
-+
-+ hotplug_event->sysfs.net_ifindex = -1;
-+
-+ return hotplug_event;
-+}
-+
-+HotplugEvent *
-+blockdev_generate_remove_hotplug_event (HalDevice *d)
-+{
-+ const char *sysfs_path;
-+ HotplugEvent *hotplug_event;
-+
-+ sysfs_path = hal_device_property_get_string (d, "linux.sysfs_path");
-+
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_REMOVE;
-+ hotplug_event->type = HOTPLUG_EVENT_SYSFS;
-+ g_strlcpy (hotplug_event->sysfs.subsystem, "block", sizeof (hotplug_event->sysfs.subsystem));
-+ g_strlcpy (hotplug_event->sysfs.sysfs_path, sysfs_path, sizeof (hotplug_event->sysfs.sysfs_path));
-+ hotplug_event->sysfs.device_file[0] = '\0';
-+ hotplug_event->sysfs.net_ifindex = -1;
-+
-+ return hotplug_event;
-+}
Deleted: packages/unstable/hal/debian/patches/17_fix_dbus_090_build.patch
===================================================================
--- packages/unstable/hal/debian/patches/17_fix_dbus_090_build.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/17_fix_dbus_090_build.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,33 +0,0 @@
-commit 2901c216a1d5867ac997e8c7805a3e530201fe71
-Author: Kay Sievers <kay.sievers at vrfy.org>
-Date: Fri Jul 14 17:46:57 2006 +0000
-
- Replace dbus_connection_disconnect() with dbus_connection_close() (D-BUS
- api rename)
-
-diff --git a/tools/hal-device.c b/tools/hal-device.c
-index 06d6b22..a5b7c83 100644
---- a/tools/hal-device.c
-+++ b/tools/hal-device.c
-@@ -155,7 +155,7 @@ int main(int argc, char **argv)
-
- libhal_ctx_shutdown(hal_ctx, &error);
- libhal_ctx_free(hal_ctx);
-- dbus_connection_disconnect(conn);
-+ dbus_connection_close(conn);
- dbus_connection_unref(conn);
- dbus_error_free(&error);
-
-diff --git a/tools/lshal.c b/tools/lshal.c
-index 8c05759..42e9907 100644
---- a/tools/lshal.c
-+++ b/tools/lshal.c
-@@ -705,7 +705,7 @@ main (int argc, char *argv[])
- libhal_ctx_shutdown (hal_ctx, &error);
- libhal_ctx_free (hal_ctx);
-
-- dbus_connection_disconnect (conn);
-+ dbus_connection_close (conn);
- dbus_connection_unref (conn);
-
- if (show_device)
Deleted: packages/unstable/hal/debian/patches/18_hald_runner_fd_leak.patch
===================================================================
--- packages/unstable/hal/debian/patches/18_hald_runner_fd_leak.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/18_hald_runner_fd_leak.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,12 +0,0 @@
-diff --git a/hald-runner/runner.c b/hald-runner/runner.c
-index a2d1a21..7301233 100644
---- a/hald-runner/runner.c
-+++ b/hald-runner/runner.c
-@@ -163,6 +163,7 @@ run_exited(GPid pid, gint status, gpoint
- if (rd->stderr_v >= 0) {
- /* Need to read stderr */
- error = get_string_array_from_fd(rd->stderr_v);
-+ close(rd->stderr_v);
- rd->stderr_v = -1;
- }
- if (rd->msg != NULL)
Modified: packages/unstable/hal/debian/patches/19_sonypi_support.patch
===================================================================
--- packages/unstable/hal/debian/patches/19_sonypi_support.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/19_sonypi_support.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,1506 +1,24 @@
-diff -u hal-0.5.7/tools/hal-system-lcd-get-brightness hal-0.5.7.1/tools/hal-system-lcd-get-brightness
---- hal-0.5.7/tools/hal-system-lcd-get-brightness 2006-03-01 15:03:53.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-lcd-get-brightness 2006-08-15 15:03:50.000000000 +0200
-@@ -58,6 +58,17 @@
- # cat /proc/omnibook/lcd
- # LCD brightness: 7
- value="`cat $HAL_PROP_LINUX_ACPI_PATH | awk '{print $3;}'`"
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sonypi" ]; then
-+ # spicctrl -B
-+ # 70
-+ # 0..255
-+ value="`/usr/bin/spicctrl -B`"
-+ RETVAL=$?
-+ if [ $RETVAL != 0 ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-+ exit 1;
-+ fi
-+ exit ${value}
- else
- echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
- echo "No ACPI method found" >&2
-diff -u hal-0.5.7/tools/hal-system-lcd-set-brightness hal-0.5.7.1/tools/hal-system-lcd-set-brightness
---- hal-0.5.7/tools/hal-system-lcd-set-brightness 2006-03-01 15:03:53.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-lcd-set-brightness 2006-08-15 15:07:52.000000000 +0200
-@@ -19,7 +19,7 @@
- read value
-
- # Check for values outside range
--if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
-+if [ ${value} -lt 0 ] || [ ${value} -ge $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
- echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
- exit 1
-@@ -34,6 +34,12 @@
- exit 0
- fi
-
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sonypi" ]; then
-+ # spicctrl -b "{0..255}"
-+ /usr/bin/spicctrl -b ${value}
-+ exit 0
-+fi
-+
- # Check for file existance and that it's writable
- if [ ! -w "$HAL_PROP_LINUX_ACPI_PATH" ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-only in patch2:
-unchanged:
---- hal-0.5.7.1-old/hald/linux2/acpi.c 2006-02-19 00:11:23.000000000 +0100
-+++ hal-0.5.7.1/hald/linux2/acpi.c 2006-08-15 15:03:50.000000000 +0200
-@@ -48,6 +48,7 @@
- ACPI_TYPE_PANASONIC_DISPLAY,
- ACPI_TYPE_SONY_DISPLAY,
- ACPI_TYPE_OMNIBOOK_DISPLAY,
-+ ACPI_TYPE_SONYPI_DISPLAY,
- ACPI_TYPE_BUTTON
- };
-
-@@ -698,6 +699,10 @@
- type = "omnibook";
- desc = "Omnibook LCD Panel";
- br_levels = 8;
-+ } else if (acpi_type == ACPI_TYPE_SONYPI_DISPLAY) {
-+ type = "sonypi";
-+ desc = "Sony LCD Panel";
-+ br_levels = 256;
- } else {
- type = "unknown";
- desc = "Unknown LCD Panel";
-@@ -851,6 +856,44 @@
- acpi_synthesize_item (path, method);
- }
-
-+static int sonypi_irq_list[] = { 11, 10, 9, 6, 5 };
-+
-+/** Synthesizes a sonypi object.
-+ */
-+static void
-+acpi_synthesize_sonypi_display (void)
-+{
-+ HotplugEvent *hotplug_event;
-+ gboolean found = FALSE;
-+ guint i;
-+ gchar *path;
-+
-+ HAL_INFO (("Processing sonypi display"));
-+
-+ /* Find the sonypi device, this doesn't work
-+ * if the sonypi device doesn't have an IRQ, sorry */
-+ for (i = 0; i < G_N_ELEMENTS (sonypi_irq_list); i++) {
-+ path = g_strdup_printf ("/proc/irq/%d/sonypi", sonypi_irq_list[i]);
-+ if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
-+ found = TRUE;
-+ break;
-+ }
-+ g_free (path);
-+ }
-+
-+ if (!found)
-+ return;
-+
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_ADD;
-+ hotplug_event->type = HOTPLUG_EVENT_ACPI;
-+ g_strlcpy (hotplug_event->acpi.acpi_path, path, sizeof (hotplug_event->acpi.acpi_path));
-+ hotplug_event->acpi.acpi_type = ACPI_TYPE_SONYPI_DISPLAY;
-+ hotplug_event_enqueue (hotplug_event);
-+
-+ g_free (path);
-+}
-+
- /** Scan the data structures exported by the kernel and add hotplug
- * events for adding ACPI objects.
- *
-@@ -913,8 +956,10 @@
- acpi_synthesize_display ("acpi/pcc", "brightness", ACPI_TYPE_PANASONIC_DISPLAY);
- acpi_synthesize_display ("acpi/ibm", "brightness", ACPI_TYPE_IBM_DISPLAY);
- acpi_synthesize_display ("acpi/sony", "brightness", ACPI_TYPE_SONY_DISPLAY);
-- /* onmibook does not live under acpi GNOME#331458 */
-+ /* omnibook does not live under acpi GNOME#331458 */
- acpi_synthesize_display ("omnibook", "lcd", ACPI_TYPE_OMNIBOOK_DISPLAY);
-+ /* sonypi doesn't have an acpi object fd.o#6729 */
-+ acpi_synthesize_sonypi_display ();
-
- /* setup timer for things that we need to poll */
- g_timeout_add (ACPI_POLL_INTERVAL,
-@@ -1037,6 +1082,14 @@
- .remove = acpi_generic_remove
- };
-
-+static ACPIDevHandler acpidev_handler_laptop_panel_sonypi = {
-+ .acpi_type = ACPI_TYPE_SONYPI_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
- static ACPIDevHandler acpidev_handler_button = {
- .acpi_type = ACPI_TYPE_BUTTON,
- .add = acpi_generic_add,
-@@ -1065,6 +1118,7 @@
- &acpidev_handler_laptop_panel_asus,
- &acpidev_handler_laptop_panel_sony,
- &acpidev_handler_laptop_panel_omnibook,
-+ &acpidev_handler_laptop_panel_sonypi,
- NULL
- };
-
-only in patch2:
-unchanged:
---- hal-0.5.7.1-old/hald/linux2/acpi.c.orig 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.7.1/hald/linux2/acpi.c.orig 2006-08-15 15:03:27.000000000 +0200
-@@ -0,0 +1,1234 @@
-+/***************************************************************************
-+ * CVSID: $Id: acpi.c,v 1.47 2006/02/18 23:11:23 hughsient Exp $
-+ *
-+ * Copyright (C) 2005 Richard Hughes <richard at hughsie.com>
-+ * Copyright (C) 2005 David Zeuthen, Red Hat Inc., <davidz at redhat.com>
-+ * Copyright (C) 2005 Danny Kukawka, <danny.kukawka at web.de>
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-+ *
-+ **************************************************************************/
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include <string.h>
-+
-+#include "../device_info.h"
-+#include "../logger.h"
-+#include "../hald_dbus.h"
-+#include "../util.h"
-+
-+#include "osspec_linux.h"
-+
-+#include "acpi.h"
-+#include "hotplug.h"
-+
-+enum {
-+ ACPI_TYPE_BATTERY,
-+ ACPI_TYPE_PROCESSOR,
-+ ACPI_TYPE_FAN,
-+ ACPI_TYPE_AC_ADAPTER,
-+ ACPI_TYPE_TOSHIBA_DISPLAY,
-+ ACPI_TYPE_ASUS_DISPLAY,
-+ ACPI_TYPE_IBM_DISPLAY,
-+ ACPI_TYPE_PANASONIC_DISPLAY,
-+ ACPI_TYPE_SONY_DISPLAY,
-+ ACPI_TYPE_OMNIBOOK_DISPLAY,
-+ ACPI_TYPE_BUTTON
-+};
-+
-+#define ACPI_POLL_INTERVAL 30000
-+
-+typedef struct ACPIDevHandler_s
-+{
-+ int acpi_type;
-+ HalDevice *(*add) (const gchar *acpi_path, HalDevice *parent, struct ACPIDevHandler_s *handler);
-+ gboolean (*compute_udi) (HalDevice *d, struct ACPIDevHandler_s *handler);
-+ gboolean (*remove) (HalDevice *d, struct ACPIDevHandler_s *handler);
-+ gboolean (*refresh) (HalDevice *d, struct ACPIDevHandler_s *handler);
-+} ACPIDevHandler;
-+
-+/** Just sets the ac_adapter.present key when called
-+ *
-+ * @param d valid ac_adaptor HalDevice
-+ */
-+static void
-+ac_adapter_refresh_poll (HalDevice *d)
-+{
-+ const char *path;
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return;
-+ hal_util_set_bool_elem_from_file (d, "ac_adapter.present", path, "state", "state", 0, "on-line", FALSE);
-+}
-+
-+static void
-+battery_refresh_poll (HalDevice *d)
-+{
-+ const char *path;
-+ const char *reporting_unit;
-+ int reporting_current;
-+ int reporting_lastfull;
-+ int reporting_rate;
-+ int normalised_current;
-+ int normalised_lastfull;
-+ int normalised_rate;
-+ int design_voltage;
-+ int voltage;
-+ int remaining_time;
-+ int remaining_percentage;
-+ gboolean charging;
-+ gboolean discharging;
-+
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return;
-+
-+ hal_util_set_bool_elem_from_file (d, "battery.rechargeable.is_charging", path,
-+ "state", "charging state", 0, "charging", TRUE);
-+ hal_util_set_bool_elem_from_file (d, "battery.rechargeable.is_discharging", path,
-+ "state", "charging state", 0, "discharging", TRUE);
-+ hal_util_set_string_elem_from_file (d, "battery.charge_level.capacity_state", path,
-+ "state", "capacity state", 0, TRUE);
-+ /*
-+ * we'll use the .reporting prefix as we don't know
-+ * if this data is energy (mWh) or unit enery (mAh)
-+ */
-+ if (!hal_util_set_int_elem_from_file (d, "battery.reporting.current", path,
-+ "state", "remaining capacity", 0, 10, TRUE))
-+ hal_device_property_set_int (d, "battery.reporting.current", 0);
-+ if (!hal_util_set_int_elem_from_file (d, "battery.reporting.rate", path,
-+ "state", "present rate", 0, 10, TRUE))
-+ hal_device_property_set_int (d, "battery.reporting.rate", 0);
-+ /*
-+ * we'll need this if we need to convert mAh to mWh, but we should
-+ * also update it here anyway as the value will have changed
-+ */
-+ hal_util_set_int_elem_from_file (d, "battery.voltage.current", path,
-+ "state", "present voltage", 0, 10, TRUE);
-+ /* get all the data we know */
-+ reporting_unit = hal_device_property_get_string (d,
-+ "battery.reporting.unit");
-+ reporting_current = hal_device_property_get_int (d,
-+ "battery.reporting.current");
-+ reporting_lastfull = hal_device_property_get_int (d,
-+ "battery.reporting.last_full");
-+ reporting_rate = hal_device_property_get_int (d,
-+ "battery.reporting.rate");
-+
-+ /*
-+ * We are converting the unknown units into mWh because of ACPI's nature
-+ * of not having a standard "energy" unit.
-+ *
-+ * full details here: http://bugzilla.gnome.org/show_bug.cgi?id=309944
-+ */
-+ if (reporting_unit && strcmp (reporting_unit, "mWh") == 0) {
-+ /* units do not need conversion */
-+ normalised_current = reporting_current;
-+ normalised_lastfull = reporting_lastfull;
-+ normalised_rate = reporting_rate;
-+ } else if (reporting_unit && strcmp (reporting_unit, "mAh") == 0) {
-+ /* convert mAh to mWh by multiplying by voltage. due to the
-+ * general wonkiness of ACPI implementations, this is a lot
-+ * harder than it should have to be...
-+ */
-+
-+ design_voltage = hal_device_property_get_int (d, "battery.voltage.design");
-+ voltage = hal_device_property_get_int (d, "battery.voltage.current");
-+
-+ /* Just in case we don't get design voltage information, then
-+ * this will pretend that we have 1mV. This degrades our
-+ * ability to report accurate times on multi-battery systems
-+ * but will always prevent negative charge levels and allow
-+ * accurate reporting on single-battery systems.
-+ */
-+ if (design_voltage <= 0)
-+ design_voltage = 1;
-+
-+ /* If the current voltage is unknown or greater than design,
-+ * then use design voltage.
-+ */
-+ if (voltage <= 0 || voltage > design_voltage)
-+ voltage = design_voltage;
-+
-+ normalised_current = reporting_current * voltage;
-+ normalised_lastfull = reporting_lastfull * voltage;
-+ normalised_rate = reporting_rate * voltage;
-+ } else {
-+ /*
-+ * handle as if mWh, which is the most common case.
-+ */
-+ normalised_current = reporting_current;
-+ normalised_lastfull = reporting_lastfull;
-+ normalised_rate = reporting_rate;
-+ }
-+
-+ /*
-+ * Set the normalised keys.
-+ */
-+ if (normalised_current < 0)
-+ normalised_current = 0;
-+ if (normalised_lastfull < 0)
-+ normalised_lastfull = 0;
-+ if (normalised_rate < 0)
-+ normalised_rate = 0;
-+
-+ /*
-+ * Some laptops report a rate even when not charging or discharging.
-+ * If not charging and not discharging force rate to be zero.
-+ *
-+ * http://bugzilla.gnome.org/show_bug.cgi?id=323186
-+ */
-+ charging = hal_device_property_get_bool (d, "battery.rechargeable.is_charging");
-+ discharging = hal_device_property_get_bool (d, "battery.rechargeable.is_discharging");
-+
-+ if (!charging && !discharging)
-+ normalised_rate = 0;
-+
-+ /*
-+ * Some laptops report current charge much larger than
-+ * full charge when at 100%. Clamp back down to 100%.
-+ */
-+ if (normalised_current > normalised_lastfull)
-+ normalised_current = normalised_lastfull;
-+
-+ hal_device_property_set_int (d, "battery.charge_level.current", normalised_current);
-+ hal_device_property_set_int (d, "battery.charge_level.last_full", normalised_lastfull);
-+ hal_device_property_set_int (d, "battery.charge_level.rate", normalised_rate);
-+
-+ remaining_time = util_compute_time_remaining (d->udi, normalised_rate, normalised_current, normalised_lastfull,
-+ hal_device_property_get_bool (d, "battery.rechargeable.is_discharging"),
-+ hal_device_property_get_bool (d, "battery.rechargeable.is_charging"),
-+ hal_device_property_get_bool (d, "battery.remaining_time.calculate_per_time"));
-+ remaining_percentage = util_compute_percentage_charge (d->udi, normalised_current, normalised_lastfull);
-+ /*
-+ * Only set keys if no error (signified with negative return value)
-+ * Scrict checking is needed to ensure that the values presented by HAL
-+ * are 100% acurate.
-+ */
-+
-+ if (remaining_time > 0)
-+ hal_device_property_set_int (d, "battery.remaining_time", remaining_time);
-+ else
-+ hal_device_property_remove (d, "battery.remaining_time");
-+
-+ if (remaining_percentage > 0)
-+ hal_device_property_set_int (d, "battery.charge_level.percentage", remaining_percentage);
-+ else
-+ hal_device_property_remove (d, "battery.charge_level.percentage");
-+}
-+
-+/** Recalculates the battery.reporting.last_full key as this may drift
-+ * over time.
-+ *
-+ * @param data Ignored
-+ * @return TRUE if we updated values
-+ *
-+ * @note This is called 120x less often than battery_refresh_poll
-+ */
-+static gboolean
-+battery_poll_infrequently (gpointer data) {
-+
-+ GSList *i;
-+ GSList *battery_devices;
-+ HalDevice *d;
-+ const char *path;
-+
-+ battery_devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
-+ "battery.type",
-+ "primary");
-+
-+ for (i = battery_devices; i != NULL; i = g_slist_next (i)) {
-+ d = HAL_DEVICE (i->data);
-+ if (hal_device_has_property (d, "linux.acpi_type") &&
-+ hal_device_property_get_bool (d, "battery.present")) {
-+ hal_util_grep_discard_existing_data ();
-+ device_property_atomic_update_begin ();
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path != NULL)
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.last_full", path,
-+ "info", "last full capacity", 0, 10, TRUE);
-+ device_property_atomic_update_end ();
-+ }
-+ }
-+
-+ g_slist_free (battery_devices);
-+ return TRUE;
-+}
-+
-+
-+/** Fallback polling method to refresh battery objects is plugged in
-+ *
-+ * @return TRUE
-+ *
-+ * @note This just calls battery_refresh_poll for each battery
-+ */
-+static gboolean
-+acpi_poll_battery (void)
-+{
-+ GSList *i;
-+ GSList *battery_devices;
-+ HalDevice *d;
-+
-+ battery_devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
-+ "battery.type",
-+ "primary");
-+ /*
-+ * These forced updates take care of really broken BIOS's that don't
-+ * emit batt events.
-+ */
-+ for (i = battery_devices; i != NULL; i = g_slist_next (i)) {
-+ d = HAL_DEVICE (i->data);
-+ if (hal_device_has_property (d, "linux.acpi_type") &&
-+ hal_device_property_get_bool (d, "battery.present")) {
-+ hal_util_grep_discard_existing_data ();
-+ device_property_atomic_update_begin ();
-+ battery_refresh_poll (d);
-+ device_property_atomic_update_end ();
-+ }
-+ }
-+
-+ g_slist_free (battery_devices);
-+ return TRUE;
-+}
-+
-+/** Fallback polling method to detect if the ac_adaptor is plugged in
-+ *
-+ * @return TRUE
-+ *
-+ * @note This just calls ac_adapter_refresh_poll for each ac_adapter
-+ */
-+static gboolean
-+acpi_poll_acadap (void)
-+{
-+ GSList *i;
-+ GSList *acadap_devices;
-+ HalDevice *d;
-+
-+ acadap_devices = hal_device_store_match_multiple_key_value_string (hald_get_gdl (),
-+ "info.category",
-+ "ac_adapter");
-+ /*
-+ * These forced updates take care of really broken BIOS's that don't
-+ * emit acad events.
-+ */
-+ for (i = acadap_devices; i != NULL; i = g_slist_next (i)) {
-+ d = HAL_DEVICE (i->data);
-+ if (hal_device_has_property (d, "linux.acpi_type")) {
-+ hal_util_grep_discard_existing_data ();
-+ device_property_atomic_update_begin ();
-+ ac_adapter_refresh_poll (d);
-+ device_property_atomic_update_end ();
-+ }
-+ }
-+ g_slist_free (acadap_devices);
-+ return TRUE;
-+}
-+
-+/** Fallback polling method called every minute.
-+ *
-+ * @param data Ignored
-+ * @return TRUE
-+ *
-+ * @note This just forces a poll refresh for *every* ac_adaptor
-+ * and primary battery in the system.
-+ */
-+static gboolean
-+acpi_poll (gpointer data)
-+{
-+ /*
-+ * These forced updates take care of really broken BIOS's that don't
-+ * emit acad or acadapt events.
-+ */
-+ acpi_poll_acadap ();
-+ acpi_poll_battery ();
-+ return TRUE;
-+}
-+
-+static gboolean
-+ac_adapter_refresh (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ const char *path;
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return FALSE;
-+
-+ device_property_atomic_update_begin ();
-+ /* only set up device new if really needed */
-+ if (!hal_device_has_capability (d, "ac_adapter")){
-+ hal_device_property_set_string (d, "info.product", "AC Adapter");
-+ hal_device_property_set_string (d, "info.category", "ac_adapter");
-+ hal_device_add_capability (d, "ac_adapter");
-+ }
-+ /* get .present value */
-+ ac_adapter_refresh_poll (d);
-+ device_property_atomic_update_end ();
-+
-+ /* refresh last full if ac plugged in/out */
-+ battery_poll_infrequently (NULL);
-+
-+ /*
-+ * Refresh all the data for each battery.
-+ * This is required as the batteries may go from charging->
-+ * discharging, or charged -> discharging state, and we don't
-+ * want to wait for the next random refresh from acpi_poll.
-+ */
-+ acpi_poll_battery ();
-+
-+ return TRUE;
-+}
-+
-+/** Removes all the possible battery.* keys.
-+ *
-+ * @param d Valid battery HalDevice
-+ *
-+ * @note Removing a key that doesn't exist is OK.
-+ */
-+static void
-+battery_refresh_remove (HalDevice *d)
-+{
-+ hal_device_property_remove (d, "battery.is_rechargeable");
-+ hal_device_property_remove (d, "battery.rechargeable.is_charging");
-+ hal_device_property_remove (d, "battery.rechargeable.is_discharging");
-+ hal_device_property_remove (d, "battery.vendor");
-+ hal_device_property_remove (d, "battery.model");
-+ hal_device_property_remove (d, "battery.serial");
-+ hal_device_property_remove (d, "battery.technology");
-+ hal_device_property_remove (d, "battery.vendor");
-+ hal_device_property_remove (d, "battery.charge_level.unit");
-+ hal_device_property_remove (d, "battery.charge_level.current");
-+ hal_device_property_remove (d, "battery.charge_level.percentage");
-+ hal_device_property_remove (d, "battery.charge_level.last_full");
-+ hal_device_property_remove (d, "battery.charge_level.design");
-+ hal_device_property_remove (d, "battery.charge_level.capacity_state");
-+ hal_device_property_remove (d, "battery.charge_level.warning");
-+ hal_device_property_remove (d, "battery.charge_level.low");
-+ hal_device_property_remove (d, "battery.charge_level.granularity_1");
-+ hal_device_property_remove (d, "battery.charge_level.granularity_2");
-+ hal_device_property_remove (d, "battery.charge_level.rate");
-+ hal_device_property_remove (d, "battery.voltage.unit");
-+ hal_device_property_remove (d, "battery.voltage.design");
-+ hal_device_property_remove (d, "battery.voltage.current");
-+ hal_device_property_remove (d, "battery.alarm.unit");
-+ hal_device_property_remove (d, "battery.alarm.design");
-+ hal_device_property_remove (d, "battery.reporting.current");
-+ hal_device_property_remove (d, "battery.reporting.last_full");
-+ hal_device_property_remove (d, "battery.reporting.design");
-+ hal_device_property_remove (d, "battery.reporting.rate");
-+ hal_device_property_remove (d, "battery.reporting.warning");
-+ hal_device_property_remove (d, "battery.reporting.low");
-+ hal_device_property_remove (d, "battery.reporting.granularity_1");
-+ hal_device_property_remove (d, "battery.reporting.granularity_2");
-+ hal_device_property_remove (d, "battery.reporting.unit");
-+ hal_device_property_remove (d, "battery.remaining_time");
-+}
-+
-+/** Adds all the possible battery.* keys and does coldplug (slowpath)
-+ * type calculations.
-+ *
-+ * @param d Valid battery HalDevice
-+ */
-+static gboolean
-+battery_refresh_add (HalDevice *d, const char *path)
-+{
-+ int reporting_design;
-+ int reporting_warning;
-+ int reporting_low;
-+ int reporting_gran1;
-+ int reporting_gran2;
-+ int voltage_design;
-+
-+ const char *reporting_unit;
-+
-+ hal_util_set_string_elem_from_file (d, "battery.vendor", path, "info",
-+ "OEM info", 0, TRUE);
-+ hal_util_set_string_elem_from_file (d, "battery.model", path, "info",
-+ "model number", 0, TRUE);
-+ hal_util_set_string_elem_from_file (d, "battery.serial", path, "info",
-+ "serial number", 0, TRUE);
-+ hal_util_set_string_elem_from_file (d, "battery.technology", path, "info",
-+ "battery type", 0, TRUE);
-+ hal_util_set_string_elem_from_file (d, "battery.vendor", path, "info",
-+ "OEM info", 0, TRUE);
-+
-+ /*
-+ * we'll use the .reporting prefix as we don't know
-+ * if this data is energy (mWh) or unit enery (mAh)
-+ */
-+ hal_util_set_string_elem_from_file (d, "battery.reporting.unit", path,
-+ "info", "design capacity", 1, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.last_full", path,
-+ "info", "last full capacity", 0, 10, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.design", path,
-+ "info", "design capacity", 0, 10, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.warning", path,
-+ "info", "design capacity warning", 0, 10, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.low", path,
-+ "info", "design capacity low", 0, 10, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.granularity_1", path,
-+ "info", "capacity granularity 1", 0, 10, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.reporting.granularity_2", path,
-+ "info", "capacity granularity 2", 0, 10, TRUE);
-+ /*
-+ * we'll need this is we want to convert mAh to mWh
-+ */
-+ hal_util_set_string_elem_from_file (d, "battery.voltage.unit", path, "info",
-+ "design voltage", 1, TRUE);
-+ hal_util_set_int_elem_from_file (d, "battery.voltage.design", path,
-+ "info", "design voltage", 0, 10, TRUE);
-+ /*
-+ * Convert the mWh or mAh units into mWh...
-+ * We'll do as many as we can here as the values
-+ * are not going to change.
-+ * We'll set the correct unit (or unknown) also.
-+ */
-+ reporting_unit = hal_device_property_get_string (d, "battery.reporting.unit");
-+ reporting_design = hal_device_property_get_int (d, "battery.reporting.design");
-+ reporting_warning = hal_device_property_get_int (d, "battery.reporting.warning");
-+ reporting_low = hal_device_property_get_int (d, "battery.reporting.low");
-+ reporting_gran1 = hal_device_property_get_int (d, "battery.reporting.granularity_1");
-+ reporting_gran2 = hal_device_property_get_int (d, "battery.reporting.granularity_2");
-+
-+ if (reporting_unit && strcmp (reporting_unit, "mWh") == 0) {
-+ /* do not scale */
-+ hal_device_property_set_int (d, "battery.charge_level.design", reporting_design);
-+ hal_device_property_set_int (d, "battery.charge_level.warning", reporting_warning);
-+ hal_device_property_set_int (d, "battery.charge_level.low", reporting_low);
-+ hal_device_property_set_int (d, "battery.charge_level.granularity_1", reporting_gran1);
-+ hal_device_property_set_int (d, "battery.charge_level.granularity_2", reporting_gran2);
-+
-+ /* set unit */
-+ hal_device_property_set_string (d, "battery.charge_level.unit", "mWh");
-+ } else if (reporting_unit && strcmp (reporting_unit, "mAh") == 0) {
-+ voltage_design = hal_device_property_get_int (d, "battery.voltage.design");
-+
-+ /* If design voltage is unknown, use 1mV. */
-+ if (voltage_design <= 0)
-+ voltage_design = 1;
-+
-+ /* scale by factor battery.voltage.design */
-+ hal_device_property_set_int (d, "battery.charge_level.design",
-+ reporting_design * voltage_design);
-+ hal_device_property_set_int (d, "battery.charge_level.warning",
-+ reporting_warning * voltage_design);
-+ hal_device_property_set_int (d, "battery.charge_level.low",
-+ reporting_low * voltage_design);
-+ hal_device_property_set_int (d, "battery.charge_level.granularity_1",
-+ reporting_gran1 * voltage_design);
-+ hal_device_property_set_int (d, "battery.charge_level.granularity_2",
-+ reporting_gran2 * voltage_design);
-+
-+ /* set unit */
-+ hal_device_property_set_string (d, "battery.charge_level.unit",
-+ "mWh"); /* not mAh! */
-+ } else {
-+ /*
-+ * Some ACPI BIOS's do not report the unit,
-+ * so we'll assume they are mWh.
-+ * We will report the guessing with the
-+ * battery.charge_level.unit key.
-+ */
-+ hal_device_property_set_int (d,
-+ "battery.charge_level.design", reporting_design);
-+ hal_device_property_set_int (d,
-+ "battery.charge_level.warning", reporting_warning);
-+ hal_device_property_set_int (d,
-+ "battery.charge_level.low", reporting_low);
-+ hal_device_property_set_int (d,
-+ "battery.charge_level.granularity_1", reporting_gran1);
-+ hal_device_property_set_int (d,
-+ "battery.charge_level.granularity_2", reporting_gran2);
-+
-+ /* set "Unknown ACPI Unit" unit so we can debug */
-+ HAL_WARNING (("Unknown ACPI Unit!"));
-+ hal_device_property_set_string (d, "battery.charge_level.unit",
-+ "unknown");
-+ }
-+
-+ /* set alarm if present */
-+ if (hal_util_set_int_elem_from_file (d, "battery.alarm.design", path,
-+ "alarm", "alarm", 0, 10, TRUE))
-+ hal_util_set_string_elem_from_file (d, "battery.alarm.unit", path, "alarm",
-+ "alarm", 1, TRUE);
-+
-+ /* we are assuming a laptop battery is rechargeable */
-+ hal_device_property_set_bool (d, "battery.is_rechargeable", TRUE);
-+ return TRUE;
-+}
-+
-+static gboolean
-+battery_refresh (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ const char *path;
-+
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return FALSE;
-+
-+ hal_device_property_set_string (d, "info.product", "Battery Bay");
-+ hal_device_property_set_string (d, "battery.type", "primary");
-+ hal_device_property_set_string (d, "info.category", "battery");
-+ hal_device_add_capability (d, "battery");
-+
-+ /* Since we're using reuse==TRUE make sure we get fresh data for first read */
-+ hal_util_grep_discard_existing_data ();
-+
-+ hal_util_set_bool_elem_from_file (d, "battery.present", path, "state", "present", 0, "yes", TRUE);
-+ if (!hal_device_property_get_bool (d, "battery.present")) {
-+ /* remove battery.* tags as battery not present */
-+ device_property_atomic_update_begin ();
-+ battery_refresh_remove (d);
-+ device_property_atomic_update_end ();
-+ } else {
-+ /* battery is present */
-+ device_property_atomic_update_begin ();
-+
-+ /* So, it's pretty expensive to read from
-+ * /proc/acpi/battery/BAT%d/[info|state] so don't read
-+ * static data that won't change
-+ */
-+ if (!hal_device_has_property (d, "battery.vendor")) {
-+ /* battery has no information, so coldplug */
-+ battery_refresh_add (d, path);
-+ }
-+
-+ /* fill in the fast-path refresh values */
-+ battery_refresh_poll (d);
-+
-+ device_property_atomic_update_end ();
-+
-+ /* poll ac adapter for machines which never give ACAP events */
-+ acpi_poll_acadap ();
-+ }
-+
-+ return TRUE;
-+}
-+
-+static gboolean
-+processor_refresh (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ const char *path;
-+
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return FALSE;
-+
-+ hal_device_property_set_string (d, "info.product", "Processor");
-+ hal_device_property_set_string (d, "info.category", "processor");
-+ hal_device_add_capability (d, "processor");
-+ hal_util_set_int_elem_from_file (d, "processor.number", path,
-+ "info", "processor id", 0, 10, FALSE);
-+ hal_util_set_bool_elem_from_file (d, "processor.can_throttle", path,
-+ "info", "throttling control", 0, "yes", FALSE);
-+ return TRUE;
-+}
-+
-+static gboolean
-+fan_refresh (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ const char *path;
-+
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return FALSE;
-+
-+ hal_device_property_set_string (d, "info.product", "Fan");
-+ hal_device_property_set_string (d, "info.category", "fan");
-+ hal_device_add_capability (d, "fan");
-+ hal_util_set_bool_elem_from_file (d, "fan.enabled", path,
-+ "state", "status", 0, "on", FALSE);
-+ return TRUE;
-+}
-+
-+/*
-+ * The different laptop_panel ACPI handling code is below. When a nice sysfs
-+ * interface comes along, we'll use that instead of these hacks.
-+ * Using /proc/acpi/video does not work, this method is much more reliable.
-+ */
-+static gboolean
-+laptop_panel_refresh (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ const char *path;
-+ int acpi_type;
-+ char *type = NULL;
-+ char *desc = NULL;
-+ int br_levels = -1;
-+
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return FALSE;
-+
-+ acpi_type = hal_device_property_get_int (d, "linux.acpi_type");
-+ hal_device_property_set_string (d, "info.category", "laptop_panel");
-+ if (acpi_type == ACPI_TYPE_TOSHIBA_DISPLAY) {
-+ type = "toshiba";
-+ desc = "Toshiba LCD Panel";
-+ br_levels = 8;
-+ } else if (acpi_type == ACPI_TYPE_ASUS_DISPLAY) {
-+ type = "asus";
-+ desc = "ASUS LCD Panel";
-+ br_levels = 16;
-+ } else if (acpi_type == ACPI_TYPE_IBM_DISPLAY) {
-+ type = "ibm";
-+ desc = "IBM LCD Panel";
-+ br_levels = 8;
-+ } else if (acpi_type == ACPI_TYPE_PANASONIC_DISPLAY) {
-+ type = "panasonic";
-+ desc = "Panasonic LCD Panel";
-+ br_levels = 16;
-+ } else if (acpi_type == ACPI_TYPE_SONY_DISPLAY) {
-+ type = "sony";
-+ desc = "Sony LCD Panel";
-+ br_levels = 8;
-+ } else if (acpi_type == ACPI_TYPE_OMNIBOOK_DISPLAY) {
-+ type = "omnibook";
-+ desc = "Omnibook LCD Panel";
-+ br_levels = 8;
-+ } else {
-+ type = "unknown";
-+ desc = "Unknown LCD Panel";
-+ br_levels = 0;
-+ HAL_WARNING (("acpi_type not recognised!"));
-+ }
-+
-+ hal_device_property_set_string (d, "info.product", desc);
-+ /*
-+ * We will set laptop_panel.access_method as the scripts can use this to
-+ * determine the set/get parameters.
-+ */
-+ hal_device_property_set_string (d, "laptop_panel.access_method", type);
-+ /*
-+ * We can set laptop_panel.num_levels as it will not change, and allows us
-+ * to work out the percentage in the scripts.
-+ */
-+ hal_device_property_set_int (d, "laptop_panel.num_levels", br_levels);
-+ hal_device_add_capability (d, "laptop_panel");
-+ return TRUE;
-+}
-+
-+static gboolean
-+button_refresh (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ const char *path;
-+ gchar *parent_path;
-+ const gchar *button_type;
-+
-+ path = hal_device_property_get_string (d, "linux.acpi_path");
-+ if (path == NULL)
-+ return FALSE;
-+
-+ parent_path = hal_util_get_parent_path (path);
-+ button_type = hal_util_get_last_element (parent_path);
-+
-+ hal_device_property_set_string (d, "button.type", button_type);
-+
-+ if (strcmp (button_type, "power") == 0)
-+ hal_device_property_set_string (d, "info.product", "Power Button");
-+ else if (strcmp (button_type, "lid") == 0)
-+ hal_device_property_set_string (d, "info.product", "Lid Switch");
-+ else if (strcmp (button_type, "sleep") == 0)
-+ hal_device_property_set_string (d, "info.product", "Sleep Button");
-+
-+ hal_device_property_set_string (d, "info.category", "button");
-+ hal_device_add_capability (d, "button");
-+ if (!hal_util_set_bool_elem_from_file (d, "button.state.value", path, "state", "state", 0, "closed", FALSE)) {
-+ hal_device_property_set_bool (d, "button.has_state", FALSE);
-+ } else {
-+ hal_device_property_set_bool (d, "button.has_state", TRUE);
-+ }
-+
-+ g_free (parent_path);
-+
-+ return TRUE;
-+}
-+
-+/** Synthesizes a *specific* acpi object.
-+ *
-+ * @param fullpath The ACPI path, e.g. "/proc/acpi/battery/BAT1"
-+ * @param acpi_type The type of device, e.g. ACPI_TYPE_BATTERY
-+ */
-+static void
-+acpi_synthesize_item (const gchar *fullpath, int acpi_type)
-+{
-+ HotplugEvent *hotplug_event;
-+ HAL_INFO (("Processing %s", fullpath));
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_ADD;
-+ hotplug_event->type = HOTPLUG_EVENT_ACPI;
-+ g_strlcpy (hotplug_event->acpi.acpi_path, fullpath, sizeof (hotplug_event->acpi.acpi_path));
-+ hotplug_event->acpi.acpi_type = acpi_type;
-+ hotplug_event_enqueue (hotplug_event);
-+}
-+
-+/** Synthesizes generic acpi objects, i.e. registers all the objects of type
-+ * into HAL. This lets us have more than one type of device e.g. BATx
-+ * in the same battery class.
-+ *
-+ * @param path The ACPI path, e.g. "/proc/acpi/battery"
-+ * @param acpi_type The type of device, e.g. ACPI_TYPE_BATTERY
-+ */
-+static void
-+acpi_synthesize (const gchar *path, int acpi_type)
-+{
-+ const gchar *f;
-+ gchar _path[HAL_PATH_MAX];
-+ gboolean is_laptop = FALSE;
-+ GDir *dir;
-+ GError *error = NULL;
-+
-+ dir = g_dir_open (path, 0, &error);
-+ if (dir == NULL) {
-+ HAL_ERROR (("Couldn't open %s: %s", path, error->message));
-+ g_error_free (error);
-+ return;
-+ }
-+
-+ /* do for each object in directory */
-+ while ((f = g_dir_read_name (dir)) != NULL) {
-+ gchar buf[HAL_PATH_MAX];
-+
-+ /* check if there is a battery bay or a LID button */
-+ if (!is_laptop) {
-+ if ( acpi_type == ACPI_TYPE_BATTERY ) {
-+ is_laptop = TRUE;
-+ } else if ( acpi_type == ACPI_TYPE_BUTTON ) {
-+ snprintf (_path, sizeof (_path), "%s/acpi/button/lid", get_hal_proc_path ());
-+ if ( strcmp (path, _path) == 0 )
-+ is_laptop = TRUE;
-+ }
-+ }
-+ /* if there is a battery bay or LID, this is a laptop -> set the formfactor */
-+ if ( is_laptop ) {
-+ HalDevice *computer;
-+
-+ if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL &&
-+ (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
-+ HAL_ERROR (("No computer object?"));
-+ } else {
-+ hal_device_property_set_string (computer, "system.formfactor", "laptop");
-+ }
-+ }
-+
-+ snprintf (buf, sizeof (buf), "%s/%s", path, f);
-+ acpi_synthesize_item (buf, acpi_type);
-+ }
-+
-+ /* close directory */
-+ g_dir_close (dir);
-+}
-+
-+/** If {procfs_path}/acpi/{vendor}/{display} is found, then add the
-+ * LaptopPanel device.
-+ *
-+ * @param vendor The vendor name, e.g. sony
-+ * @param display The *possible* name of the brightness file
-+ * @param method The HAL enumerated type.
-+ */
-+static void
-+acpi_synthesize_display (char *vendor, char *display, int method)
-+{
-+ gchar path[HAL_PATH_MAX];
-+ snprintf (path, sizeof (path), "%s/%s/%s", get_hal_proc_path (), vendor, display);
-+ /*
-+ * We do not use acpi_synthesize as the target is not a directory full
-+ * of directories, but a flat file list.
-+ */
-+ if (g_file_test (path, G_FILE_TEST_EXISTS))
-+ acpi_synthesize_item (path, method);
-+}
-+
-+/** Scan the data structures exported by the kernel and add hotplug
-+ * events for adding ACPI objects.
-+ *
-+ * @return TRUE if, and only if, ACPI capabilities
-+ * were detected
-+ */
-+gboolean
-+acpi_synthesize_hotplug_events (void)
-+{
-+ HalDevice *computer;
-+ gchar path[HAL_PATH_MAX];
-+
-+ if (!g_file_test ("/proc/acpi/info", G_FILE_TEST_EXISTS))
-+ return FALSE;
-+
-+ if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) == NULL &&
-+ (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) == NULL) {
-+ HAL_ERROR (("No computer object?"));
-+ return TRUE;
-+ }
-+
-+ /* Set appropriate properties on the computer object */
-+ hal_device_property_set_string (computer, "power_management.type", "acpi");
-+ hal_util_set_string_elem_from_file (computer, "power_management.acpi.linux.version",
-+ "/proc/acpi", "info", "version", 0, FALSE);
-+
-+ /* collect batteries */
-+ snprintf (path, sizeof (path), "%s/acpi/battery", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_BATTERY);
-+
-+ /* collect processors */
-+ snprintf (path, sizeof (path), "%s/acpi/processor", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_PROCESSOR);
-+
-+ /* collect fans */
-+ snprintf (path, sizeof (path), "%s/acpi/fan", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_FAN);
-+
-+ /* collect AC adapters */
-+ snprintf (path, sizeof (path), "%s/acpi/ac_adapter", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_AC_ADAPTER);
-+
-+ /* collect buttons */
-+ snprintf (path, sizeof (path), "%s/acpi/button/lid", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_BUTTON);
-+ snprintf (path, sizeof (path), "%s/acpi/button/power", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_BUTTON);
-+ snprintf (path, sizeof (path), "%s/acpi/button/sleep", get_hal_proc_path ());
-+ acpi_synthesize (path, ACPI_TYPE_BUTTON);
-+
-+ /*
-+ * Collect video adaptors (from vendor added modules)
-+ * I *know* we should use the /proc/acpi/video/LCD method, but this
-+ * doesn't work. And it's depreciated.
-+ * When the sysfs code comes into mainline, we can use that, but until
-+ * then we can supply an abstracted interface to the user.
-+ */
-+ acpi_synthesize_display ("acpi/toshiba", "lcd", ACPI_TYPE_TOSHIBA_DISPLAY);
-+ acpi_synthesize_display ("acpi/asus", "brn", ACPI_TYPE_ASUS_DISPLAY);
-+ acpi_synthesize_display ("acpi/pcc", "brightness", ACPI_TYPE_PANASONIC_DISPLAY);
-+ acpi_synthesize_display ("acpi/ibm", "brightness", ACPI_TYPE_IBM_DISPLAY);
-+ acpi_synthesize_display ("acpi/sony", "brightness", ACPI_TYPE_SONY_DISPLAY);
-+ /* onmibook does not live under acpi GNOME#331458 */
-+ acpi_synthesize_display ("omnibook", "lcd", ACPI_TYPE_OMNIBOOK_DISPLAY);
-+
-+ /* setup timer for things that we need to poll */
-+ g_timeout_add (ACPI_POLL_INTERVAL,
-+ acpi_poll,
-+ NULL);
-+ /* setup timer for things that we need only to poll infrequently*/
-+ g_timeout_add ((ACPI_POLL_INTERVAL*120),
-+ battery_poll_infrequently,
-+ NULL);
-+
-+ return TRUE;
-+}
-+
-+static HalDevice *
-+acpi_generic_add (const gchar *acpi_path, HalDevice *parent, ACPIDevHandler *handler)
-+{
-+ HalDevice *d;
-+ 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);
-+ if (parent != NULL)
-+ hal_device_property_set_string (d, "info.parent", parent->udi);
-+ else
-+ hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
-+ if (handler->refresh == NULL || !handler->refresh (d, handler)) {
-+ g_object_unref (d);
-+ d = NULL;
-+ }
-+ return d;
-+}
-+
-+static gboolean
-+acpi_generic_compute_udi (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ gchar udi[256];
-+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
-+ "/org/freedesktop/Hal/devices/acpi_%s",
-+ hal_util_get_last_element (hal_device_property_get_string (d, "linux.acpi_path")));
-+ hal_device_set_udi (d, udi);
-+ hal_device_property_set_string (d, "info.udi", udi);
-+ return TRUE;
-+}
-+
-+static gboolean
-+acpi_generic_remove (HalDevice *d, ACPIDevHandler *handler)
-+{
-+ return TRUE;
-+}
-+
-+
-+static ACPIDevHandler acpidev_handler_battery = {
-+ .acpi_type = ACPI_TYPE_BATTERY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = battery_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_processor = {
-+ .acpi_type = ACPI_TYPE_PROCESSOR,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = processor_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_fan = {
-+ .acpi_type = ACPI_TYPE_FAN,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = fan_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_laptop_panel_toshiba = {
-+ .acpi_type = ACPI_TYPE_TOSHIBA_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_laptop_panel_asus = {
-+ .acpi_type = ACPI_TYPE_ASUS_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_laptop_panel_panasonic = {
-+ .acpi_type = ACPI_TYPE_PANASONIC_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_laptop_panel_ibm = {
-+ .acpi_type = ACPI_TYPE_IBM_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_laptop_panel_sony = {
-+ .acpi_type = ACPI_TYPE_SONY_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_laptop_panel_omnibook = {
-+ .acpi_type = ACPI_TYPE_OMNIBOOK_DISPLAY,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = laptop_panel_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_button = {
-+ .acpi_type = ACPI_TYPE_BUTTON,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = button_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler acpidev_handler_ac_adapter = {
-+ .acpi_type = ACPI_TYPE_AC_ADAPTER,
-+ .add = acpi_generic_add,
-+ .compute_udi = acpi_generic_compute_udi,
-+ .refresh = ac_adapter_refresh,
-+ .remove = acpi_generic_remove
-+};
-+
-+static ACPIDevHandler *acpi_handlers[] = {
-+ &acpidev_handler_battery,
-+ &acpidev_handler_processor,
-+ &acpidev_handler_fan,
-+ &acpidev_handler_button,
-+ &acpidev_handler_ac_adapter,
-+ &acpidev_handler_laptop_panel_toshiba,
-+ &acpidev_handler_laptop_panel_ibm,
-+ &acpidev_handler_laptop_panel_panasonic,
-+ &acpidev_handler_laptop_panel_asus,
-+ &acpidev_handler_laptop_panel_sony,
-+ &acpidev_handler_laptop_panel_omnibook,
-+ NULL
-+};
-+
-+static void
-+acpi_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
-+{
-+ void *end_token = (void *) userdata1;
-+
-+ HAL_INFO (("Add callouts completed udi=%s", d->udi));
-+
-+ /* Move from temporary to global device store */
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ hal_device_store_add (hald_get_gdl (), d);
-+
-+ hotplug_event_end (end_token);
-+}
-+
-+static void
-+acpi_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2)
-+{
-+ void *end_token = (void *) userdata1;
-+
-+ HAL_INFO (("Remove callouts completed udi=%s", d->udi));
-+
-+ if (!hal_device_store_remove (hald_get_gdl (), d)) {
-+ HAL_WARNING (("Error removing device"));
-+ }
-+
-+ hotplug_event_end (end_token);
-+}
-+
-+void
-+hotplug_event_begin_add_acpi (const gchar *acpi_path, int acpi_type, HalDevice *parent, void *end_token)
-+{
-+ guint i;
-+
-+ HAL_INFO (("acpi_add: acpi_path=%s acpi_type=%d, parent=0x%08x", acpi_path, acpi_type, parent));
-+
-+ for (i = 0; acpi_handlers [i] != NULL; i++) {
-+ ACPIDevHandler *handler;
-+
-+ handler = acpi_handlers[i];
-+ if (handler->acpi_type == acpi_type) {
-+ HalDevice *d;
-+
-+ d = handler->add (acpi_path, parent, handler);
-+ if (d == NULL) {
-+ /* didn't find anything - thus, ignore this hotplug event */
-+ hotplug_event_end (end_token);
-+ return;
-+ }
-+
-+ hal_device_property_set_int (d, "linux.hotplug_type", HOTPLUG_EVENT_ACPI);
-+
-+ /* Add to temporary device store */
-+ hal_device_store_add (hald_get_tdl (), d);
-+
-+ /* Merge properties from .fdi files */
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_INFORMATION);
-+ di_search_and_merge (d, DEVICE_INFO_TYPE_POLICY);
-+
-+
-+ /* Compute UDI */
-+ if (!handler->compute_udi (d, handler)) {
-+ hal_device_store_remove (hald_get_tdl (), d);
-+ hotplug_event_end (end_token);
-+ return;
-+ }
-+
-+ /* Run callouts */
-+ hal_util_callout_device_add (d, acpi_callouts_add_done, end_token, NULL);
-+ return;
-+ }
-+ }
-+
-+ /* didn't find anything - thus, ignore this hotplug event */
-+ hotplug_event_end (end_token);
-+}
-+
-+void
-+hotplug_event_begin_remove_acpi (const gchar *acpi_path, int acpi_type, void *end_token)
-+{
-+ guint i;
-+ HalDevice *d;
-+
-+ HAL_INFO (("acpi_rem: acpi_path=%s acpi_type=%d", acpi_path, acpi_type));
-+
-+ d = hal_device_store_match_key_value_string (hald_get_gdl (), "linux.acpi_path", acpi_path);
-+ if (d == NULL) {
-+ HAL_WARNING (("Couldn't remove device with acpi path %s - not found", acpi_path));
-+ goto out;
-+ }
-+
-+ for (i = 0; acpi_handlers [i] != NULL; i++) {
-+ ACPIDevHandler *handler;
-+
-+ handler = acpi_handlers[i];
-+ if (handler->acpi_type == acpi_type) {
-+ if (handler->remove (d, handler)) {
-+ hal_util_callout_device_remove (d, acpi_callouts_remove_done, end_token, NULL);
-+ goto out2;
-+ }
-+ }
-+ }
-+out:
-+ /* didn't find anything - thus, ignore this hotplug event */
-+ hotplug_event_end (end_token);
-+out2:
-+ ;
-+}
-+
-+gboolean
-+acpi_rescan_device (HalDevice *d)
-+{
-+ guint i;
-+ int acpi_type;
-+
-+ acpi_type = hal_device_property_get_int (d, "linux.acpi_type");
-+
-+ for (i = 0; acpi_handlers [i] != NULL; i++) {
-+ ACPIDevHandler *handler;
-+
-+ handler = acpi_handlers[i];
-+ if (handler->acpi_type == acpi_type) {
-+ return handler->refresh (d, handler);
-+ }
-+ }
-+
-+ HAL_WARNING (("Didn't find a rescan handler for udi %s", d->udi));
-+ return TRUE;
-+}
-+
-+HotplugEvent *
-+acpi_generate_add_hotplug_event (HalDevice *d)
-+{
-+ int acpi_type;
-+ const char *acpi_path;
-+ HotplugEvent *hotplug_event;
-+
-+ acpi_path = hal_device_property_get_string (d, "linux.acpi_path");
-+ acpi_type = hal_device_property_get_int (d, "linux.acpi_type");
-+
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_ADD;
-+ hotplug_event->type = HOTPLUG_EVENT_ACPI;
-+ g_strlcpy (hotplug_event->acpi.acpi_path, acpi_path, sizeof (hotplug_event->acpi.acpi_path));
-+ hotplug_event->acpi.acpi_type = acpi_type;
-+ return hotplug_event;
-+}
-+
-+HotplugEvent *
-+acpi_generate_remove_hotplug_event (HalDevice *d)
-+{
-+ int acpi_type;
-+ const char *acpi_path;
-+ HotplugEvent *hotplug_event;
-+
-+ acpi_path = hal_device_property_get_string (d, "linux.acpi_path");
-+ acpi_type = hal_device_property_get_int (d, "linux.acpi_type");
-+
-+ hotplug_event = g_new0 (HotplugEvent, 1);
-+ hotplug_event->action = HOTPLUG_ACTION_REMOVE;
-+ hotplug_event->type = HOTPLUG_EVENT_ACPI;
-+ g_strlcpy (hotplug_event->acpi.acpi_path, acpi_path, sizeof (hotplug_event->acpi.acpi_path));
-+ hotplug_event->acpi.acpi_type = acpi_type;
-+ return hotplug_event;
-+}
-only in patch2:
-unchanged:
---- hal-0.5.7.1-old/tools/hal-system-lcd-set-brightness.orig 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-lcd-set-brightness.orig 2006-08-15 15:03:44.000000000 +0200
-@@ -0,0 +1,74 @@
-+#!/bin/sh
-+#
-+# Copyright (C) 2005 Richard Hughes <richard at hughsie.com>
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+
-+# Check for environment variables
-+if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ] ||
-+ [ -z "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" ] ; then
-+ echo "Missing or empty environment variable(s)." >&2
-+ echo "This script should be started by hald." >&2
-+ exit 1
-+fi
-+
-+# read value for set brightness
-+read value
-+
-+# Check for values outside range
-+if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
-+ echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
-+ exit 1
-+fi
-+
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
-+ hal-system-power-pmu setlcd $value
-+ if [ $? -ne 0 ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-+ exit 1
-+ fi
-+ exit 0
-+fi
-+
-+# Check for file existance and that it's writable
-+if [ ! -w "$HAL_PROP_LINUX_ACPI_PATH" ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-+ echo "$1 not writable!" >&2
-+ exit 1
-+fi
-+
-+
-+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
-+ # echo "brightness: {0..x}" >/proc/acpi/toshiba/lcd
-+ echo "brightness: $value" > $HAL_PROP_LINUX_ACPI_PATH
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
-+ # echo {0..15} > /proc/acpi/asus/brn
-+ # http://www.taupro.com/wiki/ChemBook/LCDdisplayPowerConfiguration
-+ echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
-+ # echo {0..15} > /proc/acpi/pcc/brightness
-+ # http://readlist.com/lists/vger.kernel.org/linux-kernel/7/36405.html
-+ echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
-+ # echo "level {0..7}" > /proc/acpi/ibm/brightness
-+ # http://ibm-acpi.sourceforge.net/README
-+ echo "level $value" > $HAL_PROP_LINUX_ACPI_PATH
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
-+ # echo "{1..8}" > /proc/acpi/sony/brightness
-+ # http://popies.net/sonypi/2.6-sony_acpi4.patch
-+ echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
-+ # echo "{0..7}" > /proc/omnibook/lcd
-+ # http://bugzilla.gnome.org/show_bug.cgi?id=331458
-+ echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-+else
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-+ echo "No ACPI method found" >&2
-+ exit 1
-+ fi
-+
-+exit 0
-only in patch2:
-unchanged:
---- hal-0.5.7.1-old/tools/hal-system-lcd-set-brightness.rej 1970-01-01 01:00:00.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-lcd-set-brightness.rej 2006-08-15 15:03:50.000000000 +0200
-@@ -0,0 +1,34 @@
-+*************** if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METH
-+*** 27,41 ****
-+ exit 0
-+ fi
-+
-+- # Check for file existance and that it's writable
-+- if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-+ echo "$1 not writable!" >&2
-+ exit 1
-+ fi
-+
-+ # Check for values outside range
-+- if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
-+ echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
-+ exit 1
-+--- 27,42 ----
-+ exit 0
-+ fi
-+
-++ # Check for file existance and that it's writable and that we don't have a sonypi
-++ # access method
-++ if [ ! -w $HAL_PROP_LINUX_ACPI_PATH -a "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" != "sonypi" ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
-+ echo "$1 not writable!" >&2
-+ exit 1
-+ fi
-+
-+ # Check for values outside range
-++ if [ ${value} -lt 0 ] || [ ${value} -ge $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
-+ echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
-+ echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
-+ exit 1
+diff -aur hal-0.5.8.vanilla/tools/linux/hal-system-lcd-get-brightness-linux hal-0.5.8/tools/linux/hal-system-lcd-get-brightness-linux
+--- hal-0.5.8.vanilla/tools/linux/hal-system-lcd-get-brightness-linux 2006-09-11 23:56:40.000000000 +0200
++++ hal-0.5.8/tools/linux/hal-system-lcd-get-brightness-linux 2006-09-17 12:20:05.000000000 +0200
+@@ -55,7 +55,7 @@
+ # spicctrl -B
+ # 70
+ # 0..255
+- value="`/usr/sbin/spicctrl -B`"
++ value="`/usr/bin/spicctrl -B`"
+ RETVAL=$?
+ if [ $RETVAL != 0 ]; then
+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
+diff -aur hal-0.5.8.vanilla/tools/linux/hal-system-lcd-set-brightness-linux hal-0.5.8/tools/linux/hal-system-lcd-set-brightness-linux
+--- hal-0.5.8.vanilla/tools/linux/hal-system-lcd-set-brightness-linux 2006-09-11 23:56:40.000000000 +0200
++++ hal-0.5.8/tools/linux/hal-system-lcd-set-brightness-linux 2006-09-17 12:20:17.000000000 +0200
+@@ -50,7 +50,7 @@
+ # spicctrl -B
+ # 70
+ # 0..255
+- value="`/usr/sbin/spicctrl -B`"
++ value="`/usr/bin/spicctrl -B`"
+ RETVAL=$?
+ if [ $RETVAL != 0 ]; then
+ echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
Deleted: packages/unstable/hal/debian/patches/20_uswsusp.patch
===================================================================
--- packages/unstable/hal/debian/patches/20_uswsusp.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/20_uswsusp.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,28 +0,0 @@
-diff -u hal-0.5.7.1/tools/hal-system-power-suspend hal-0.5.7.1/tools/hal-system-power-suspend
---- hal-0.5.7.1/tools/hal-system-power-suspend 2006-08-15 15:16:59.000000000 +0200
-+++ hal-0.5.7.1/tools/hal-system-power-suspend 2006-08-15 15:33:55.000000000 +0200
-@@ -53,6 +53,9 @@
- elif [ -x "/usr/sbin/pmi" ] ; then
- /usr/sbin/pmi action suspend force
- RET=$?
-+ elif [ -x "/usr/sbin/s2both" ] ; then
-+ /usr/sbin/s2both
-+ RET=$?
- elif [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" = "pmu" ]; then
- #PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
- hal-system-power-pmu sleep
-only in patch2:
-unchanged:
---- hal-0.5.7/tools/hal-system-power-hibernate 2006-03-01 15:03:53.000000000 +0100
-+++ hal-0.5.7.1/tools/hal-system-power-hibernate 2006-08-15 15:33:55.000000000 +0200
-@@ -43,6 +43,10 @@
- # Suspend2 tools installed
- /usr/sbin/hibernate --force
- RET=$?
-+ elif [ -x "/usr/sbin/s2disk" ] ; then
-+ # uswsusp tools installed
-+ /usr/sbin/s2disk
-+ RET=$?
- elif [ -w "/sys/power/state" ] &&
- [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" != pmu ] ; then
- # Use the raw kernel sysfs interface if possible (not on pmu yet)
Deleted: packages/unstable/hal/debian/patches/21_acpi_support.patch
===================================================================
--- packages/unstable/hal/debian/patches/21_acpi_support.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/21_acpi_support.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,28 +0,0 @@
-diff -u hal-0.5.7.1/tools/hal-system-power-hibernate hal-0.5.7.1/tools/hal-system-power-hibernate
---- hal-0.5.7.1/tools/hal-system-power-hibernate 2006-08-15 15:33:55.000000000 +0200
-+++ hal-0.5.7.1/tools/hal-system-power-hibernate 2006-08-15 15:42:06.000000000 +0200
-@@ -47,6 +47,10 @@
- # uswsusp tools installed
- /usr/sbin/s2disk
- RET=$?
-+ elif [ -x "/etc/acpi/hibernate.sh" ] ; then
-+ # acpi-support installed
-+ /etc/acpi/hibernate.sh force
-+ RET=$?
- elif [ -w "/sys/power/state" ] &&
- [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" != pmu ] ; then
- # Use the raw kernel sysfs interface if possible (not on pmu yet)
-diff -u hal-0.5.7.1/tools/hal-system-power-suspend hal-0.5.7.1/tools/hal-system-power-suspend
---- hal-0.5.7.1/tools/hal-system-power-suspend 2006-08-15 15:33:55.000000000 +0200
-+++ hal-0.5.7.1/tools/hal-system-power-suspend 2006-08-15 15:39:57.000000000 +0200
-@@ -64,6 +64,10 @@
- # Use hibernate configured for suspend-to-ram
- /usr/sbin/hibernate -F/etc/hibernate/ram.conf
- RET=$?
-+ elif [ -x "/etc/acpi/sleep.sh" ] ; then
-+ # Use acpi-support for suspend to ram
-+ /etc/acpi/sleep.sh force
-+ RET=$?
- elif [ -w "/sys/power/state" ] ; then
- # Use the raw kernel sysfs interface
- echo "mem" > /sys/power/state
Deleted: packages/unstable/hal/debian/patches/22_recognize_partitions.patch
===================================================================
--- packages/unstable/hal/debian/patches/22_recognize_partitions.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/22_recognize_partitions.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,115 +0,0 @@
-diff -Naur hal-0.5.7.1.vanilla/hald/linux2/blockdev.c hal-0.5.7.1/hald/linux2/blockdev.c
---- hal-0.5.7.1.vanilla/hald/linux2/blockdev.c 2006-09-04 14:46:58.000000000 +0200
-+++ hal-0.5.7.1/hald/linux2/blockdev.c 2006-09-04 15:16:21.000000000 +0200
-@@ -679,7 +679,7 @@
-
- hal_device_property_set_int (d, "block.major", major);
- hal_device_property_set_int (d, "block.minor", minor);
-- hal_device_property_set_bool (d, "block.is_volume", is_partition);
-+ hal_device_property_set_bool (d, "block.is_volume", is_partition || is_fakevolume);
-
- if (hal_device_has_property(parent, "info.bus") &&
- (strcmp(hal_device_property_get_string(parent, "info.bus"), "platform") == 0) &&
-@@ -717,7 +717,7 @@
- goto out2;
- }
-
-- if (!is_partition) {
-+ if (!is_partition && !is_fakevolume) {
- const char *udi_it;
- const char *physdev_udi;
- HalDevice *scsidev;
-@@ -1036,11 +1036,11 @@
- }
-
- void
--hotplug_event_begin_remove_blockdev (const gchar *sysfs_path, gboolean is_partition, void *end_token)
-+hotplug_event_begin_remove_blockdev (const gchar *sysfs_path, void *end_token)
- {
- HalDevice *d;
-
-- HAL_INFO (("block_rem: sysfs_path=%s is_part=%d", sysfs_path, is_partition));
-+ HAL_INFO (("block_rem: sysfs_path=%s", sysfs_path));
-
- d = hal_device_store_match_key_value_string (hald_get_gdl (), "linux.sysfs_path", sysfs_path);
- if (d == NULL) {
-@@ -1050,6 +1050,7 @@
- const char *stor_udi;
- HalDevice *stor_dev;
- gboolean is_fakevolume;
-+ gboolean is_partition;
-
- is_partition = hal_device_property_get_bool (d, "volume.is_partition");
-
-diff -Naur hal-0.5.7.1.vanilla/hald/linux2/blockdev.h hal-0.5.7.1/hald/linux2/blockdev.h
---- hal-0.5.7.1.vanilla/hald/linux2/blockdev.h 2006-09-04 14:46:58.000000000 +0200
-+++ hal-0.5.7.1/hald/linux2/blockdev.h 2006-09-04 15:14:46.000000000 +0200
-@@ -30,7 +30,7 @@
-
- void hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const char *device_file, gboolean is_partition, HalDevice *parent, void *end_token);
-
--void hotplug_event_begin_remove_blockdev (const gchar *sysfs_path, gboolean is_partition, void *end_token);
-+void hotplug_event_begin_remove_blockdev (const gchar *sysfs_path, void *end_token);
-
- gboolean blockdev_rescan_device (HalDevice *d);
-
-diff -Naur hal-0.5.7.1.vanilla/hald/linux2/hotplug.c hal-0.5.7.1/hald/linux2/hotplug.c
---- hal-0.5.7.1.vanilla/hald/linux2/hotplug.c 2006-09-04 14:46:58.000000000 +0200
-+++ hal-0.5.7.1/hald/linux2/hotplug.c 2006-09-04 15:16:49.000000000 +0200
-@@ -103,7 +103,7 @@
-
- g_snprintf (path, HAL_PATH_MAX, "%s/class/net" , get_hal_sysfs_path());
- if ((dir = g_dir_open (path, 0, &err)) == NULL) {
-- HAL_ERROR (("Unable to open %/class/net: %s", get_hal_sysfs_path(), err->message));
-+ HAL_ERROR (("Unable to open %s/class/net: %s", get_hal_sysfs_path(), err->message));
- g_error_free (err);
- goto out;
- }
-@@ -278,17 +278,31 @@
- (void *) hotplug_event);
- }
- } else if (hotplug_event->type == HOTPLUG_EVENT_SYSFS_BLOCK) {
-- gboolean is_partition;
-- size_t len;
--
-- len = strlen(hotplug_event->sysfs.sysfs_path);
-- is_partition = isdigit(hotplug_event->sysfs.sysfs_path[len - 1]) ||
-- strstr (hotplug_event->sysfs.sysfs_path, "/fakevolume") ;
--
- if (hotplug_event->action == HOTPLUG_ACTION_ADD) {
- HalDevice *parent = NULL;
-+ int range;
-+ gboolean is_partition;
-+ gboolean is_fakevolume;
-+
-+ /* it's a partition if and only if it doesn't have the range file...
-+ *
-+ * notably the device mapper partitions do have a range file, but that's
-+ * fine, we don't count them as partitions anyway...
-+ *
-+ * also, if the sysfs ends with "fakevolume" the hotplug event is synthesized
-+ * from within HAL for partitions on the main block device
-+ */
-+ is_fakevolume = FALSE;
-+ if (strcmp (hal_util_get_last_element (hotplug_event->sysfs.sysfs_path), "fakevolume") == 0) {
-+ is_fakevolume = TRUE;
-+ }
-+ is_partition = TRUE;
-+ if (is_fakevolume ||
-+ hal_util_get_int_from_file (hotplug_event->sysfs.sysfs_path, "range", &range, 0)) {
-+ is_partition = FALSE;
-+ }
-
-- if (is_partition) {
-+ if (is_partition || is_fakevolume) {
- gchar *parent_path;
-
- parent_path = hal_util_get_parent_path (hotplug_event->sysfs.sysfs_path);
-@@ -321,7 +335,6 @@
- (void *) hotplug_event);
- } else if (hotplug_event->action == HOTPLUG_ACTION_REMOVE) {
- hotplug_event_begin_remove_blockdev (hotplug_event->sysfs.sysfs_path,
-- is_partition,
- (void *) hotplug_event);
- }
- } else {
Modified: packages/unstable/hal/debian/patches/23_addon_acpi.patch
===================================================================
--- packages/unstable/hal/debian/patches/23_addon_acpi.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/23_addon_acpi.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,7 +1,15 @@
-diff -Naur hal-0.5.7.1.vanilla/hald/linux2/addons/addon-acpi.c hal-0.5.7.1/hald/linux2/addons/addon-acpi.c
---- hal-0.5.7.1.vanilla/hald/linux2/addons/addon-acpi.c 2006-09-04 20:07:20.000000000 +0200
-+++ hal-0.5.7.1/hald/linux2/addons/addon-acpi.c 2006-09-04 20:33:15.000000000 +0200
-@@ -46,9 +46,14 @@
+diff -aur hal-0.5.8.vanilla/hald/linux/addons/addon-acpi.c hal-0.5.8/hald/linux/addons/addon-acpi.c
+--- hal-0.5.8.vanilla/hald/linux/addons/addon-acpi.c 2006-09-11 23:56:39.000000000 +0200
++++ hal-0.5.8/hald/linux/addons/addon-acpi.c 2006-09-17 16:12:51.000000000 +0200
+@@ -32,6 +32,7 @@
+ #include <string.h>
+ #include <sys/socket.h>
+ #include <sys/types.h>
++#include <sys/stat.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+
+@@ -45,9 +46,14 @@
acpi_get_event_fp_kernel (void)
{
FILE *fp = NULL;
@@ -9,11 +17,12 @@
- fp = fopen ("/proc/acpi/event", "r");
+ if (stat("/usr/sbin/acpid", &sbuf) == 0) {
-+ dbg("acpid installed, not using the kernel acpi event interface");
++ HAL_DEBUG (("acpid installed, not using the kernel acpi event interface"));
+ return NULL;
+ }
+ fp = fopen ("/proc/acpi/event", "r");
if (fp == NULL)
- dbg ("Cannot open /proc/acpi/event: %s", strerror (errno));
+ HAL_ERROR (("Cannot open /proc/acpi/event: %s", strerror (errno)));
+Only in hal-0.5.8/hald/linux/addons: addon-acpi.c.orig
Deleted: packages/unstable/hal/debian/patches/hdm-python2.4.patch
===================================================================
--- packages/unstable/hal/debian/patches/hdm-python2.4.patch 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/patches/hdm-python2.4.patch 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,9 +0,0 @@
-diff -ruN tools/device-manager/hal-device-manager tools/device-manager/hal-device-manager
---- tools/device-manager/hal-device-manager.in 2005-08-26 17:51:51.000000000 +0200
-+++ tools/device-manager/hal-device-manager.in 2005-10-30 18:56:39.000000000 +0100
-@@ -1,4 +1,4 @@
--#!/usr/bin/python
-+#!/usr/bin/python2.4
-
- """This is the main executable for DeviceManager. GTK+/Glade code is based
- on simplepy from Shannon -jj Behrens <jjinux at yahoo.com>"""
Modified: packages/unstable/hal/debian/rules
===================================================================
--- packages/unstable/hal/debian/rules 2006-09-16 21:40:45 UTC (rev 1021)
+++ packages/unstable/hal/debian/rules 2006-09-17 15:46:31 UTC (rev 1022)
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
-DEB_TAR_SRCDIR=hal-0.5.7.1
+DEB_TAR_SRCDIR=hal-0.5.8
include /usr/share/cdbs/1/rules/tarball.mk
include /usr/share/cdbs/1/rules/debhelper.mk
@@ -12,7 +12,8 @@
DEB_CONFIGURE_EXTRA_FLAGS := --enable-hotplug-map \
--with-pid-file=/var/run/hal/hald.pid \
--enable-pcmcia-support \
- --with-hwdata=/usr/share/misc
+ --with-hwdata=/usr/share/misc \
+ --disable-policy-kit
binary-predeb/hal-device-manager::
dh_pysupport -phal-device-manager
More information about the Pkg-utopia-commits
mailing list