diff options
author | jmcneill <jmcneill@pkgsrc.org> | 2008-11-27 03:32:19 +0000 |
---|---|---|
committer | jmcneill <jmcneill@pkgsrc.org> | 2008-11-27 03:32:19 +0000 |
commit | eae81391a0129894a2defb744efde941faca12c4 (patch) | |
tree | bd04573b2d628005472823fb4eeea46225f4a592 | |
parent | 991a8abd742c652b8d70f8af9d24470ddd5881f0 (diff) | |
download | pkgsrc-eae81391a0129894a2defb744efde941faca12c4.tar.gz |
Add reboot, shutdown, suspend support. Bump PKGREVISION.
-rw-r--r-- | sysutils/hal/Makefile | 5 | ||||
-rw-r--r-- | sysutils/hal/PLIST.NetBSD | 6 | ||||
-rw-r--r-- | sysutils/hal/distinfo | 5 | ||||
-rw-r--r-- | sysutils/hal/files/hald-netbsd/devinfo_misc.c | 37 | ||||
-rw-r--r-- | sysutils/hal/files/tools-netbsd/Makefile.am | 40 | ||||
-rwxr-xr-x | sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd | 19 | ||||
-rwxr-xr-x | sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd | 19 | ||||
-rwxr-xr-x | sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd | 29 | ||||
-rw-r--r-- | sysutils/hal/patches/patch-na | 22 | ||||
-rw-r--r-- | sysutils/hal/patches/patch-nc | 17 |
10 files changed, 173 insertions, 26 deletions
diff --git a/sysutils/hal/Makefile b/sysutils/hal/Makefile index de29a4889e1..028b5a18586 100644 --- a/sysutils/hal/Makefile +++ b/sysutils/hal/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.9 2008/11/27 01:45:00 jmcneill Exp $ +# $NetBSD: Makefile,v 1.10 2008/11/27 03:32:19 jmcneill Exp $ # DISTNAME= hal-0.5.11 -PKGREVISION= 5 +PKGREVISION= 6 CATEGORIES= sysutils MASTER_SITES= http://hal.freedesktop.org/releases/ EXTRACT_SUFX= .tar.bz2 @@ -76,6 +76,7 @@ FILES_SUBST+= HAL_GROUP=${HAL_GROUP} post-extract: ${CP} -r ${FILESDIR}/hald-netbsd ${WRKSRC}/hald/netbsd + ${CP} -r ${FILESDIR}/tools-netbsd ${WRKSRC}/tools/netbsd pre-configure: cd ${WRKSRC} && autoreconf -vi diff --git a/sysutils/hal/PLIST.NetBSD b/sysutils/hal/PLIST.NetBSD index 1d36895b767..69cefd32223 100644 --- a/sysutils/hal/PLIST.NetBSD +++ b/sysutils/hal/PLIST.NetBSD @@ -1,4 +1,8 @@ -@comment $NetBSD: PLIST.NetBSD,v 1.1 2008/11/25 23:10:23 jmcneill Exp $ +@comment $NetBSD: PLIST.NetBSD,v 1.2 2008/11/27 03:32:19 jmcneill Exp $ +lib/hal/scripts/netbsd/hal-system-power-reboot-netbsd +lib/hal/scripts/netbsd/hal-system-power-shutdown-netbsd +lib/hal/scripts/netbsd/hal-system-power-suspend-netbsd libexec/hald-addon-storage libexec/hald-probe-storage libexec/hald-probe-volume +@dirrm lib/hal/scripts/netbsd diff --git a/sysutils/hal/distinfo b/sysutils/hal/distinfo index c9944ae47d4..497da06f0f6 100644 --- a/sysutils/hal/distinfo +++ b/sysutils/hal/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.5 2008/11/25 23:10:23 jmcneill Exp $ +$NetBSD: distinfo,v 1.6 2008/11/27 03:32:19 jmcneill Exp $ SHA1 (hal-0.5.11.tar.bz2) = 1ddb7895d2ddc2464b553ad11f7ba38860478ae9 RMD160 (hal-0.5.11.tar.bz2) = 741cfe82f0bc2d67106b24cfe526a754ab36e45f @@ -18,5 +18,6 @@ SHA1 (patch-al) = 8279947ecb720f3e99777dae8c20d4afe0e19039 SHA1 (patch-am) = 6a4940006e583300d9a983511bdcb05268f74b1a SHA1 (patch-an) = 0307b2f0f6bb5e4a6d7bf837163e74749b7d24b2 SHA1 (patch-ao) = 9099fa4783921a0389b874b8f6d3f7b890810b34 -SHA1 (patch-na) = bbeb48b6fa909c8fcf7cbaf609019a0d4d4b8082 +SHA1 (patch-na) = 410e84ef0ffc100f8c2731e8a5ba9b4ff5d4e526 SHA1 (patch-nb) = 1693b7a2faa5bee20a594f0b60b8ff6caea0efdc +SHA1 (patch-nc) = 32453e49734902749ce24eb4364fc7f531986227 diff --git a/sysutils/hal/files/hald-netbsd/devinfo_misc.c b/sysutils/hal/files/hald-netbsd/devinfo_misc.c index 7cc20e4b1ff..e7c766b4fee 100644 --- a/sysutils/hal/files/hald-netbsd/devinfo_misc.c +++ b/sysutils/hal/files/hald-netbsd/devinfo_misc.c @@ -9,13 +9,16 @@ * **************************************************************************/ +#include <sys/types.h> +#include <sys/sysctl.h> + #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <sys/utsname.h> #include <stdio.h> #include <string.h> -#include <sys/utsname.h> #include "../osspec.h" #include "../logger.h" @@ -57,8 +60,10 @@ DevinfoDevHandler devinfo_default_handler = { static HalDevice * devinfo_computer_add(HalDevice *parent, const char *devnode, char *devfs_path, char *device_type) { - HalDevice *d, *local_d; + HalDevice *d; struct utsname un; + char acpi_supported_states[20]; + size_t len = sizeof(acpi_supported_states); if (strcmp (devnode, "mainbus0") != 0) { return (NULL); @@ -82,17 +87,19 @@ devinfo_computer_add(HalDevice *parent, const char *devnode, char *devfs_path, c devinfo_add_enqueue (d, devfs_path, &devinfo_computer_handler); - /* all devinfo devices belong to the 'local' branch */ - local_d = hal_device_new (); + if (sysctlbyname ("hw.acpi.supported_states", acpi_supported_states, &len, NULL, 0) == 0) { + hal_device_property_set_string (d, "power_management.type", "acpi"); + if (strstr (acpi_supported_states, "S3") != NULL) + hal_device_property_set_bool (d, "power_management.can_suspend", TRUE); + else + hal_device_property_set_bool (d, "power_management.can_suspend", FALSE); - hal_device_property_set_string (local_d, "info.parent", hal_device_get_udi (d)); - hal_device_property_set_string (local_d, "info.subsystem", "unknown"); - hal_device_property_set_string (local_d, "info.product", "Local devices"); - hal_device_property_set_string (local_d, "netbsd.device", devnode); + hal_device_property_set_bool (d, "power_management.can_hibernate", FALSE); + } - devinfo_add_enqueue (local_d, devnode, &devinfo_default_handler); + devinfo_add_enqueue (d, devnode, &devinfo_default_handler); - return (local_d); + return d; } static HalDevice * @@ -120,21 +127,23 @@ devinfo_cpu_add(HalDevice *parent, const char *devnode, char *devfs_path, char * static void devinfo_default_apply_quirks(HalDevice *d, const char *devnode) { + HalDevice *computer = hal_device_store_match_key_value_string (hald_get_gdl (), "info.udi", "/org/freedesktop/Hal/devices/computer"); /* acpiacad(4) */ if (strncmp (devnode, "acpiacad", 8) == 0) { + HAL_INFO (("%s: applying acpiacad quirks")); hal_device_add_capability (d, "ac_adapter"); /* acpibat(4) */ } else if (strncmp (devnode, "acpibat", 7) == 0) { - HalDevice *computer; - + HAL_INFO (("%s: applying acpibat quirks")); hal_device_add_capability (d, "battery"); hal_device_property_set_string (d, "battery.type", "primary"); - computer = hal_device_store_find(hald_get_gdl (), "/org/freedesktop/Hal/devices/computer"); - if (computer) + if (computer) { + HAL_INFO (("%s: applying acpibat computer quirks")); hal_device_property_set_string (computer, "system.formfactor", "laptop"); + } } } diff --git a/sysutils/hal/files/tools-netbsd/Makefile.am b/sysutils/hal/files/tools-netbsd/Makefile.am new file mode 100644 index 00000000000..e29d6956047 --- /dev/null +++ b/sysutils/hal/files/tools-netbsd/Makefile.am @@ -0,0 +1,40 @@ +## Process this file with automake to produce Makefile.in +# $NetBSD: Makefile.am,v 1.1 2008/11/27 03:32:19 jmcneill Exp $ + +AM_CPPFLAGS = \ + -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \ + -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \ + -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ + -DPACKAGE_BIN_DIR=\""$(bindir)"\" \ + -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \ + -DPACKAGE_SCRIPT_DIR=\""$(libdir)/hal/scripts"\" \ + -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ + -I$(top_srcdir) -I$(top_srcdir)/libhal -I$(top_srcdir)/libhal-storage \ + @DBUS_CFLAGS@ @GLIB_CFLAGS@ @POLKIT_CFLAGS@ + +scriptdir = $(libdir)/hal/scripts/netbsd + +script_SCRIPTS = \ + hal-system-power-suspend-netbsd \ + hal-system-power-shutdown-netbsd \ + hal-system-power-reboot-netbsd + +EXTRA_DIST = $(script_SCRIPTS) + +check: + for f in $(script_SCRIPTS); do \ + echo -n "Validate bash syntax in $$f : "; \ + bash -n $(srcdir)/$$f 2> bash.error;\ + if test -s bash.error; then \ + echo failed; \ + cat bash.error; \ + rm -f bash.error; \ + exit 1; \ + else \ + echo ok; \ + rm -f bash.error; \ + fi; \ + done; + +clean-local : + rm -f *~ diff --git a/sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd b/sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd new file mode 100755 index 00000000000..7d1a62d1da5 --- /dev/null +++ b/sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd @@ -0,0 +1,19 @@ +#!/bin/sh +# $NetBSD: hal-system-power-reboot-netbsd,v 1.1 2008/11/27 03:32:19 jmcneill Exp $ + +unsupported() { + echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2 + echo "No reboot command found" >&2 + exit 1 +} + +#Try for common tools +if [ -x "/sbin/shutdown" ] ; then + /sbin/shutdown -r now + exit $? +elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -r now + exit $? +else + unsupported +fi diff --git a/sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd b/sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd new file mode 100755 index 00000000000..d05d8bca9b2 --- /dev/null +++ b/sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd @@ -0,0 +1,19 @@ +#!/bin/sh +# $NetBSD: hal-system-power-shutdown-netbsd,v 1.1 2008/11/27 03:32:19 jmcneill Exp $ + +unsupported() { + echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2 + echo "No shutdown command found" >&2 + exit 1 +} + +#Try for common tools +if [ -x "/sbin/shutdown" ] ; then + /sbin/shutdown -p now + exit $? +elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -p now + exit $? +else + unsupported +fi diff --git a/sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd b/sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd new file mode 100755 index 00000000000..21b2ed38afc --- /dev/null +++ b/sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd @@ -0,0 +1,29 @@ +#!/bin/sh +# $NetBSD: hal-system-power-suspend-netbsd,v 1.1 2008/11/27 03:32:19 jmcneill Exp $ + +alarm_not_supported() { + echo org.freedesktop.Hal.Device.SystemPowerManagement.AlarmNotSupported >&2 + echo Waking the system up is not supported >&2 + exit 1 +} + +unsupported() { + echo org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported >&2 + echo No suspend method found >&2 + exit 1 +} + +read seconds_to_sleep + +if [ -x /usr/sbin/apm ] ; then + if [ -e /var/run/apmdev ]; then + /usr/sbin/apm -z 2>/dev/null + else + /usr/sbin/apm -z -d 2>/dev/null + fi + RET=$? +else + unsupported +fi + +exit $RET diff --git a/sysutils/hal/patches/patch-na b/sysutils/hal/patches/patch-na index e56c3510034..e14f8a45f96 100644 --- a/sysutils/hal/patches/patch-na +++ b/sysutils/hal/patches/patch-na @@ -1,8 +1,8 @@ -$NetBSD: patch-na,v 1.1 2008/11/25 23:10:23 jmcneill Exp $ +$NetBSD: patch-na,v 1.2 2008/11/27 03:32:19 jmcneill Exp $ ---- configure.in.orig 2008-11-24 15:25:20.000000000 -0500 -+++ configure.in -@@ -448,7 +448,7 @@ AM_CONDITIONAL([HAVE_LIBPCI], [test "x$U +--- configure.in.orig 2008-05-07 19:24:31.000000000 -0400 ++++ configure.in 2008-11-26 21:32:46.000000000 -0500 +@@ -448,7 +448,7 @@ AC_ARG_WITH([backend], AS_HELP_STRING([--with-backend=<name>], @@ -11,7 +11,7 @@ $NetBSD: patch-na,v 1.1 2008/11/25 23:10:23 jmcneill Exp $ [backend=$withval]) if ! test -z "$with_backend" ; then HALD_BACKEND="$with_backend" -@@ -457,6 +457,9 @@ else +@@ -457,6 +457,9 @@ *-*-solaris*) HALD_BACKEND="solaris" ;; @@ -21,7 +21,7 @@ $NetBSD: patch-na,v 1.1 2008/11/25 23:10:23 jmcneill Exp $ *-*-freebsd*) HALD_BACKEND="freebsd" ;; -@@ -472,6 +475,7 @@ AM_CONDITIONAL(HALD_COMPILE_DUMMY, [test +@@ -472,6 +475,7 @@ AM_CONDITIONAL(HALD_COMPILE_LINUX, [test x$HALD_BACKEND = xlinux], [Compiling for Linux]) AM_CONDITIONAL(HALD_COMPILE_FREEBSD, [test x$HALD_BACKEND = xfreebsd], [Compiling for FreeBSD]) AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compiling for Solaris]) @@ -29,7 +29,7 @@ $NetBSD: patch-na,v 1.1 2008/11/25 23:10:23 jmcneill Exp $ AC_SUBST(HALD_BACKEND) dnl DBUS API is subject to changes -@@ -1004,6 +1008,9 @@ hald/linux/addons/Makefile +@@ -1004,6 +1008,9 @@ hald/solaris/Makefile hald/solaris/probing/Makefile hald/solaris/addons/Makefile @@ -39,3 +39,11 @@ $NetBSD: patch-na,v 1.1 2008/11/25 23:10:23 jmcneill Exp $ hald/freebsd/Makefile hald/freebsd/probing/Makefile hald/freebsd/libprobe/Makefile +@@ -1014,6 +1021,7 @@ + tools/Makefile + tools/freebsd/Makefile + tools/linux/Makefile ++tools/netbsd/Makefile + partutil/Makefile + policy/Makefile + fdi/Makefile diff --git a/sysutils/hal/patches/patch-nc b/sysutils/hal/patches/patch-nc new file mode 100644 index 00000000000..395843798b1 --- /dev/null +++ b/sysutils/hal/patches/patch-nc @@ -0,0 +1,17 @@ +$NetBSD: patch-nc,v 1.1 2008/11/27 03:32:19 jmcneill Exp $ + +--- tools/Makefile.am.orig 2008-11-26 21:01:00.000000000 -0500 ++++ tools/Makefile.am 2008-11-26 21:01:24.000000000 -0500 +@@ -8,8 +8,11 @@ + if HALD_COMPILE_FREEBSD + SUBDIRS += freebsd + endif ++if HALD_COMPILE_NETBSD ++SUBDIRS += netbsd ++endif + +-DIST_SUBDIRS = freebsd linux ++DIST_SUBDIRS = freebsd linux netbsd + + AM_CPPFLAGS = \ + -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \ |