hal: Branch 'master' - 4 commits

Joe Marcus Clarke marcus at kemper.freedesktop.org
Sat Jan 23 12:05:45 PST 2010


 configure.in                                |    9 +++++++++
 hald/freebsd/hf-usb.c                       |    8 ++++----
 hald/freebsd/hf-usb2.c                      |   18 +-----------------
 hald/freebsd/probing/Makefile.am            |    2 +-
 hald/freebsd/probing/probe-hiddev.c         |    2 +-
 hald/freebsd/probing/probe-usb2-device.c    |    4 ++--
 hald/freebsd/probing/probe-usb2-interface.c |    2 +-
 hald/freebsd/probing/probe-volume.c         |    4 ++++
 8 files changed, 23 insertions(+), 26 deletions(-)

New commits:
commit 0065d6e2d15f1d3c6c46b8f23781508286b85b23
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Jan 23 15:05:39 2010 -0500

    Fix the properties for USB interface devices
    
    USB interfaces in hal should have usb.X for properties, compared to
    usb_device for the parent.

diff --git a/hald/freebsd/hf-usb2.c b/hald/freebsd/hf-usb2.c
index f1a02e2..301846f 100644
--- a/hald/freebsd/hf-usb2.c
+++ b/hald/freebsd/hf-usb2.c
@@ -42,22 +42,6 @@
 static struct libusb20_backend *hf_usb2_be = NULL;
 
 static void
-hf_usb2_copy_parent (HalDevice *parent,
-		     const char *key,
-		     gpointer user_data)
-{
-  HalDevice *device;
-
-  g_return_if_fail(HAL_IS_DEVICE(parent));
-  g_return_if_fail(HAL_IS_DEVICE(user_data));
-
-  device = HAL_DEVICE(user_data);
-
-  if (! strncmp(key, "usb_device.", strlen("usb_device.")))
-    hal_device_copy_property(parent, key, device, key);
-}
-
-static void
 hf_usb2_probe_interfaces(HalDevice *parent)
 {
   int num_interfaces;
@@ -79,9 +63,9 @@ hf_usb2_probe_interfaces(HalDevice *parent)
 
       hal_device_property_set_string(device, "info.subsystem", "usb");
       hal_device_property_set_int(device, "usb.interface.number", i);
-      hal_device_property_foreach(parent, hf_usb2_copy_parent, device);
       hal_device_copy_property(parent, "info.product", device, "info.product");
       hal_device_copy_property(parent, "info.vendor", device, "info.vendor");
+      hal_device_merge_with_rewrite(device, parent, "usb.", "usb_device.");
 
       if (hf_device_preprobe(device))
         {
commit 8f7a14e44b019b80a1e77fea7896fd8533011a1f
Author: Michael Biebl <mbiebl at gmail.com>
Date:   Sat Jan 23 15:04:14 2010 -0500

    Fix compilation when building against libusb2
    
    Use the correct macros for kFreeBSD.

diff --git a/hald/freebsd/hf-usb.c b/hald/freebsd/hf-usb.c
index 280e0db..3f36087 100644
--- a/hald/freebsd/hf-usb.c
+++ b/hald/freebsd/hf-usb.c
@@ -32,8 +32,8 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-#if __FreeBSD_version < 800092
-#if __FreeBSD_version >= 800064
+#if (__FreeBSD_version < 800092) || (__FreeBSD_kernel_version < 800092)
+#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064)
 #include <legacy/dev/usb/usb.h>
 #else
 #include <dev/usb/usb.h>
@@ -47,9 +47,9 @@
 #include "hf-devtree.h"
 #include "hf-util.h"
 
-#if __FreeBSD_version < 800092
+#if (__FreeBSD_version < 800092) || (__FreeBSD_kernel_version < 800092)
 #define HF_USB_DEVICE			"/dev/usb"
-#if __FreeBSD_version < 800066
+#if (__FreeBSD_version < 800066) || (__FreeBSD_kernel_version < 800066)
 #define HF_USB2_DEVICE			"/dev/usb "
 #else
 #define HF_USB2_DEVICE			"/dev/usbctl"
diff --git a/hald/freebsd/probing/probe-hiddev.c b/hald/freebsd/probing/probe-hiddev.c
index f0c598b..054b159 100644
--- a/hald/freebsd/probing/probe-hiddev.c
+++ b/hald/freebsd/probing/probe-hiddev.c
@@ -34,7 +34,7 @@
 #include <dev/usb/usb.h>
 #include <dev/usb/usbhid.h>
 #else
-#if __FreeBSD_version >= 800064
+#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064)
 #include <dev/usb/usbhid.h>
 #else
 #include <dev/usb2/include/usb2_hid.h>
diff --git a/hald/freebsd/probing/probe-usb2-device.c b/hald/freebsd/probing/probe-usb2-device.c
index 129a1b1..8a3596a 100644
--- a/hald/freebsd/probing/probe-usb2-device.c
+++ b/hald/freebsd/probing/probe-usb2-device.c
@@ -34,7 +34,7 @@
 
 #include <libusb20_desc.h>
 #include <libusb20.h>
-#if __FreeBSD_version >= 800064
+#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064)
 #include <dev/usb/usb_ioctl.h>
 #else
 #include <dev/usb2/include/usb2_standard.h>
@@ -73,7 +73,7 @@ main(int argc, char **argv)
     {
       struct LIBUSB20_DEVICE_DESC_DECODED *ddesc;
       struct LIBUSB20_CONFIG_DESC_DECODED *cdesc;
-#if __FreeBSD_version >= 800092
+#if (__FreeBSD_version >= 800092) || (__FreeBSD_kernel_version >= 800092)
       struct usb_device_info di;
 #else
       struct usb2_device_info di;
diff --git a/hald/freebsd/probing/probe-usb2-interface.c b/hald/freebsd/probing/probe-usb2-interface.c
index f57bb77..a41e047 100644
--- a/hald/freebsd/probing/probe-usb2-interface.c
+++ b/hald/freebsd/probing/probe-usb2-interface.c
@@ -34,7 +34,7 @@
 
 #include <libusb20_desc.h>
 #include <libusb20.h>
-#if __FreeBSD_version >= 800064
+#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064)
 #include <dev/usb/usb_ioctl.h>
 #else
 #include <dev/usb2/include/usb2_standard.h>
commit eb3879122867c6376c9c7e155d8919e0609f9fdf
Author: Michael Biebl <mbiebl at gmail.com>
Date:   Sat Jan 23 15:01:21 2010 -0500

    Check for availability of libufs on (k)freebsd
    
    Check for availability of libufs on (k)freebsd and compile the code
    conditionally.

diff --git a/configure.in b/configure.in
index 2c74863..2394c45 100644
--- a/configure.in
+++ b/configure.in
@@ -508,6 +508,14 @@ AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compilin
 AC_SUBST(HALD_BACKEND)
 if test "x$HALD_BACKEND" = "xfreebsd"; then
     AC_SEARCH_LIBS([clock_gettime], [rt])
+    LIBUFS_LIBS=""
+    AC_CHECK_HEADERS([libufs.h],
+		     [AC_CHECK_LIB([libufs], [ufs_disk_fillout], [USE_LIBUFS="yes"], [], [])])
+    if test "x$USE_LIBUFS" = "xyes"; then
+	AC_DEFINE(HAVE_LIBUFS, 1, [Set if we have libufs])
+	LIBUFS_LIBS="-lufs"
+	AC_SUBST(LIBUFS_LIBS)
+    fi
     USE_BSDLIBUSB20=no
     USE_BSDLIBUSB=no
     LIBUSB20_LIBS=""
diff --git a/hald/freebsd/probing/Makefile.am b/hald/freebsd/probing/Makefile.am
index 3e439b5..67b8dcf 100644
--- a/hald/freebsd/probing/Makefile.am
+++ b/hald/freebsd/probing/Makefile.am
@@ -67,5 +67,5 @@ hald_probe_volume_CPPFLAGS = $(AM_CPPFLAGS) @GLIB_CFLAGS@ @VOLUME_ID_CFLAGS@
 hald_probe_volume_LDADD = \
 	@GLIB_LIBS@							\
 	@VOLUME_ID_LIBS@						\
-	-lufs								\
+	@LIBUFS_LIBS@							\
 	$(top_builddir)/hald/freebsd/libprobe/libhald_freebsd_probe.la
diff --git a/hald/freebsd/probing/probe-volume.c b/hald/freebsd/probing/probe-volume.c
index e4e1689..9c8abde 100644
--- a/hald/freebsd/probing/probe-volume.c
+++ b/hald/freebsd/probing/probe-volume.c
@@ -38,10 +38,12 @@
 #include <sys/param.h>
 #include <sys/mount.h>
 #include <sys/types.h>
+#ifdef HAVE_LIBUFS
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/dinode.h>
 #include <ufs/ffs/fs.h>
 #include <libufs.h>
+#endif /* HAVE_LIBUFS */
 #include <isofs/cd9660/iso.h>
 #include <glib.h>
 #include <libvolume_id.h>
@@ -561,6 +563,7 @@ main (int argc, char **argv)
 
   libhal_device_set_property_bool(hfp_ctx, hfp_udi, "volume.ignore", has_children || is_swap, &hfp_error);
 
+#ifdef HAVE_LIBUFS
   if (vid && ! strcmp (vid->type, "ufs"))
     {
       struct uufsd ufsdisk;
@@ -602,6 +605,7 @@ main (int argc, char **argv)
 	  ufs_disk_close(&ufsdisk);
 	}
     }
+#endif /* HAVE_LIBUFS */
 
   if (has_children)
     usage = "partitiontable";
commit c083adf8e79036a2e9a7218ea556f73671c08ff1
Author: Michael Biebl <mbiebl at gmail.com>
Date:   Sat Jan 23 14:58:03 2010 -0500

    Link against -lrt for clock_gettime
    
    Link against -lrt as we need that for clock_gettime on kfreebsd.
    AC_SEARCH_LIBS should handle the case nicely that on freebsd this
    function is already part of libc.

diff --git a/configure.in b/configure.in
index 8363595..2c74863 100644
--- a/configure.in
+++ b/configure.in
@@ -507,6 +507,7 @@ AM_CONDITIONAL(HALD_COMPILE_FREEBSD, [test x$HALD_BACKEND = xfreebsd], [Compilin
 AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compiling for Solaris])
 AC_SUBST(HALD_BACKEND)
 if test "x$HALD_BACKEND" = "xfreebsd"; then
+    AC_SEARCH_LIBS([clock_gettime], [rt])
     USE_BSDLIBUSB20=no
     USE_BSDLIBUSB=no
     LIBUSB20_LIBS=""


More information about the hal-commit mailing list