hal: Branch 'master' - 2 commits

Joe Marcus Clarke marcus at kemper.freedesktop.org
Sat Apr 14 14:21:57 PDT 2007


 hald/freebsd/hf-pci.c     |   13 ++++++++++---
 hald/freebsd/hf-storage.c |   26 +++++++++++++++++++++++++-
 hald/freebsd/hf-usb.c     |    8 +++++---
 3 files changed, 40 insertions(+), 7 deletions(-)

New commits:
diff-tree b127bfc1e6d03a380d56d48ee189058e84c694f0 (from 15272b99f8d373b9bcd239112231f5bef099d24f)
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Apr 14 17:21:52 2007 -0400

    fix compilation on FreeBSD
    
    Fix issues with the FreeBSD backend using functions that were removed from
    HAL prior to the 0.5.9 release. This patch wouldn't be available without the
    help of Roy Marples.
    
    Submitted by:	Doug Goldstein <cardoe at gentoo.org>

diff --git a/hald/freebsd/hf-pci.c b/hald/freebsd/hf-pci.c
index 400f183..8709913 100644
--- a/hald/freebsd/hf-pci.c
+++ b/hald/freebsd/hf-pci.c
@@ -38,6 +38,7 @@
 
 #include "../hald.h"
 #include "../ids.h"
+#include "../device.h"
 #include "../logger.h"
 #include "../util.h"
 
@@ -210,9 +211,15 @@ hf_pci_probe_bus (HalDevice *parent, int
 
 	  info = g_new(DeviceInfo, 1);
 	  info->device = hf_device_store_match(hald_get_gdl(),
-			                       hal_property_new_int("pci.freebsd.bus", p->pc_sel.pc_bus),
-					       hal_property_new_int("pci.freebsd.device", p->pc_sel.pc_dev),
-					       hal_property_new_int("pci.freebsd.function", p->pc_sel.pc_func),
+			  		       "pci.freebsd.bus",
+					       HAL_PROPERTY_TYPE_INT32,
+					       p->pc_sel.pc_bus,
+					       "pci.freebsd.device",
+					       HAL_PROPERTY_TYPE_INT32,
+					       p->pc_sel.pc_dev,
+					       "pci.freebsd.function",
+					       HAL_PROPERTY_TYPE_INT32,
+					       p->pc_sel.pc_func,
 					       NULL);
 	  info->p = *p;
 	  info->secondary_bus = hf_pci_get_register(p, PCIR_SECBUS_1);
diff --git a/hald/freebsd/hf-usb.c b/hald/freebsd/hf-usb.c
index f7b2bf0..b7991b5 100644
--- a/hald/freebsd/hf-usb.c
+++ b/hald/freebsd/hf-usb.c
@@ -372,11 +372,11 @@ hf_usb_device_new (HalDevice *parent,
       can_wake_up = (config_desc.bmAttributes & UC_REMOTE_WAKEUP) != 0;
       num_interfaces = config_desc.bNumInterface;
 
-      if (config_desc->iConfiguration != 0)
+      if (config_desc.iConfiguration != 0)
 	{
 	  char *configuration;
 
-	  configuration = hf_usb_get_string_descriptor(controller->fd, di->udi_addr, config_desc->iConfiguration, NULL);
+	  configuration = hf_usb_get_string_descriptor(controller->fd, di->udi_addr, config_desc.iConfiguration, NULL);
 	  if (configuration)
 	    {
 	      hal_device_property_set_string(device, "usb_device.configuration", configuration);
@@ -424,6 +424,8 @@ hf_usb_device_new (HalDevice *parent,
 
 static HalDevice *
 hf_usb_interface_device_new (HalDevice *parent,
+			     Controller *controller,
+			     const struct usb_device_info *di,
 			     const usb_interface_descriptor_t *desc)
 {
   HalDevice *device;
@@ -576,7 +578,7 @@ hf_usb_probe_device (HalDevice *parent,
 	      break;
 	    }
 
-	  if_device = hf_usb_interface_device_new(device, if_desc);
+	  if_device = hf_usb_interface_device_new(device, controller, device_info, if_desc);
 	  hf_device_preprobe_and_add(if_device);
 
 	  p += USB_INTERFACE_DESCRIPTOR_SIZE + if_desc->bNumEndpoints * USB_ENDPOINT_DESCRIPTOR_SIZE;
diff-tree 15272b99f8d373b9bcd239112231f5bef099d24f (from e23764b2828274cbc7d4c32570cfba8b9c661903)
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date:   Sat Apr 14 17:14:15 2007 -0400

    do not re-probe devices that are managed by hald-addon-storage
    
    Do not re-probe devices that are managed by hald-addon-storage since that
    will result in a double-probe and data corruption.  In particular, this
    fixes a problem with CD unmounting when ATAPICAM is enabled.

diff --git a/hald/freebsd/hf-storage.c b/hald/freebsd/hf-storage.c
index 19c3ad7..347aef3 100644
--- a/hald/freebsd/hf-storage.c
+++ b/hald/freebsd/hf-storage.c
@@ -65,6 +65,7 @@ static GNode *hf_storage_geom_tree = NUL
 static GHashTable *hf_storage_geom_hash = NULL;
 
 static void hf_storage_init_geom (void);
+static gboolean hf_storage_device_has_addon (HalDevice *device);
 
 static void
 hf_storage_geom_free (gpointer data)
@@ -587,7 +588,8 @@ hf_storage_conftxt_timeout_cb (gpointer 
 		{
 		  /* disk changed */
 		  device = hf_devtree_find_from_name(hald_get_gdl(), disk->name);
-		  if (device && hal_device_has_capability(device, "storage"))
+		  if (device && hal_device_has_capability(device, "storage") &&
+		      ! hf_storage_device_has_addon(device))
 		    hf_storage_device_rescan_real(device);
 		}
 	    }
@@ -768,6 +770,28 @@ hf_storage_device_rescan (HalDevice *dev
     return FALSE;
 }
 
+static gboolean
+hf_storage_device_has_addon (HalDevice *device)
+{
+  HalDeviceStrListIter iter;
+
+  g_return_val_if_fail(device != NULL, FALSE);
+
+  for (hal_device_property_strlist_iter_init(device, "info.addons", &iter);
+       hal_device_property_strlist_iter_is_valid(&iter);
+       hal_device_property_strlist_iter_next(&iter))
+    {
+      const char *addon;
+
+      addon = hal_device_property_strlist_iter_get_value(&iter);
+
+      if (! strcmp(addon, "hald-addon-storage"))
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
 HFHandler hf_storage_handler = {
   .init =		hf_storage_init,
   .probe =		hf_storage_probe,


More information about the hal-commit mailing list