pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/hal Add reboot, shutdown, suspend support. Bu...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2a9cf31e1303
branches:  trunk
changeset: 550711:2a9cf31e1303
user:      jmcneill <jmcneill%pkgsrc.org@localhost>
date:      Thu Nov 27 03:32:19 2008 +0000

description:
Add reboot, shutdown, suspend support. Bump PKGREVISION.

diffstat:

 sysutils/hal/Makefile                                            |   5 +-
 sysutils/hal/PLIST.NetBSD                                        |   6 +-
 sysutils/hal/distinfo                                            |   5 +-
 sysutils/hal/files/hald-netbsd/devinfo_misc.c                    |  37 +++++---
 sysutils/hal/files/tools-netbsd/Makefile.am                      |  40 ++++++++++
 sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd   |  19 ++++
 sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd |  19 ++++
 sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd  |  29 +++++++
 sysutils/hal/patches/patch-na                                    |  22 +++-
 sysutils/hal/patches/patch-nc                                    |  17 ++++
 10 files changed, 173 insertions(+), 26 deletions(-)

diffs (truncated from 340 to 300 lines):

diff -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/Makefile
--- a/sysutils/hal/Makefile     Thu Nov 27 01:49:24 2008 +0000
+++ b/sysutils/hal/Makefile     Thu Nov 27 03:32:19 2008 +0000
@@ -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 @@
 
 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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/PLIST.NetBSD
--- a/sysutils/hal/PLIST.NetBSD Thu Nov 27 01:49:24 2008 +0000
+++ b/sysutils/hal/PLIST.NetBSD Thu Nov 27 03:32:19 2008 +0000
@@ -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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/distinfo
--- a/sysutils/hal/distinfo     Thu Nov 27 01:49:24 2008 +0000
+++ b/sysutils/hal/distinfo     Thu Nov 27 03:32:19 2008 +0000
@@ -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-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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/files/hald-netbsd/devinfo_misc.c
--- a/sysutils/hal/files/hald-netbsd/devinfo_misc.c     Thu Nov 27 01:49:24 2008 +0000
+++ b/sysutils/hal/files/hald-netbsd/devinfo_misc.c     Thu Nov 27 03:32:19 2008 +0000
@@ -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 @@
 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_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 @@
 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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/files/tools-netbsd/Makefile.am
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/tools-netbsd/Makefile.am       Thu Nov 27 03:32:19 2008 +0000
@@ -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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/tools-netbsd/hal-system-power-reboot-netbsd    Thu Nov 27 03:32:19 2008 +0000
@@ -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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/tools-netbsd/hal-system-power-shutdown-netbsd  Thu Nov 27 03:32:19 2008 +0000
@@ -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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/hal/files/tools-netbsd/hal-system-power-suspend-netbsd   Thu Nov 27 03:32:19 2008 +0000
@@ -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 -r f431b8293151 -r 2a9cf31e1303 sysutils/hal/patches/patch-na
--- a/sysutils/hal/patches/patch-na     Thu Nov 27 01:49:24 2008 +0000
+++ b/sysutils/hal/patches/patch-na     Thu Nov 27 03:32:19 2008 +0000
@@ -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 @@
            [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 @@
          *-*-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 @@
  AC_SUBST(HALD_BACKEND)



Home | Main Index | Thread Index | Old Index