From f5872070521064bd0692aeae4ada9f50bf2541d0 Mon Sep 17 00:00:00 2001 From: Danny Kukawka Date: Thu, 6 Dec 2007 20:43:37 +0100 Subject: [PATCH] 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. --- hald/linux/device.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hald/linux/device.c b/hald/linux/device.c index 6175a0c..2e68378 100644 --- a/hald/linux/device.c +++ b/hald/linux/device.c @@ -1535,8 +1535,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); -- 1.5.3.7