hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Thu Dec 6 11:43:53 PST 2007


 hald/linux/device.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit b30e4ade3a041d86bfebbaaa9a21a7bc55784b0d
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Thu Dec 6 20:43:37 2007 +0100

    don't add pci devices without pci vendor/product ID
    
    Since pci.vendor_id and pci.product_id are mandatory for devices in the pci
    namespace/subsystem and get also used to generate the UDI, I would propose to
    not add pci devices which miss one of the IDs to the device tree.
    
    This would e.g. prevent to add the /sys/bus/pci/slot devices which get
    generated by the pciehp kernel modul under linux, since they don't provide
    their IDs.

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 3c00d73..8e4e808 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1540,8 +1540,12 @@ pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 
 	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
 
-	hal_util_set_int_from_file (d, "pci.product_id", sysfs_path, "device", 16);
-	hal_util_set_int_from_file (d, "pci.vendor_id", sysfs_path, "vendor", 16);
+	if(!hal_util_set_int_from_file (d, "pci.product_id", sysfs_path, "device", 16) ||
+	   !hal_util_set_int_from_file (d, "pci.vendor_id", sysfs_path, "vendor", 16)) {
+		HAL_ERROR(("Could not get PCI product or vendor ID, don't add device, this info is mandatory!"));
+		return NULL;
+	}
+
 	hal_util_set_int_from_file (d, "pci.subsys_product_id", sysfs_path, "subsystem_device", 16);
 	hal_util_set_int_from_file (d, "pci.subsys_vendor_id", sysfs_path, "subsystem_vendor", 16);
 


More information about the hal-commit mailing list