X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=wait_for_sysfs.c;h=25a3fb4eef9bcf4279a5f07e5c4c4770ca2461ca;hp=2252c30cd82229057ae836b8eb1b3c6163449d0b;hb=396bb4c3d33dfd68c5817da5e03251fbd82e2713;hpb=cdd95f9a2d80beb3e4e32a10349fe6a69aa95f5a diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 2252c30cd..25a3fb4ee 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -47,7 +47,7 @@ void log_message(int level, const char *format, ...) } #endif -#define WAIT_MAX_SECONDS 5 +#define WAIT_MAX_SECONDS 10 #define WAIT_LOOP_PER_SECOND 20 /* wait for specific file to show up, normally the "dev"-file */ @@ -60,9 +60,10 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "net", .file = "ifindex" }, { .subsystem = "scsi_host", .file = "unique_id" }, { .subsystem = "scsi_device", .file = NULL }, - { .subsystem = "pcmcia_socket", .file = "card_type" }, + { .subsystem = "pcmcia_socket", .file = NULL }, /* all files are unreadable in empty slot :( */ { .subsystem = "usb_host", .file = NULL }, { .subsystem = "bluetooth", .file = "address" }, + { .subsystem = "firmware", .file = "data" }, { .subsystem = "i2c-adapter", .file = NULL }, { .subsystem = "pci_bus", .file = NULL }, { .subsystem = "ieee1394", .file = NULL }, @@ -101,11 +102,11 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev return -1; } -/* skip waiting for physical device */ +/* check if we need to wait for a physical device */ static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) { - /* List of devices without a "device" symlink - * set .device to NULL to accept all devices in that subsystem */ + /* list of devices without a "device" symlink to the physical device + * if device is set to NULL, no devices in that subsystem has a link */ static struct class_device { char *subsystem; char *device; @@ -143,6 +144,8 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "ppp" }, { .subsystem = "net", .device = "lo" }, { .subsystem = "net", .device = "tap" }, + { .subsystem = "net", .device = "ipsec" }, + { .subsystem = "net", .device = "irda" }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, { .subsystem = "nvidia", .device = NULL }, @@ -154,15 +157,15 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "ieee1394", .device = NULL }, { .subsystem = "ieee1394_host", .device = NULL }, { .subsystem = "ieee1394_node", .device = NULL }, + { .subsystem = "raw", .device = NULL }, { NULL, NULL } }; struct class_device *classdevice; int len; - /* look if we want to look for another file instead of "dev" */ for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { - /* if device is NULL, all devices in this class are ok */ + /* see if no device in this class is expected to have a device-link */ if (classdevice->device == NULL) return 1; @@ -172,11 +175,11 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d if (strncmp(class_dev->name, classdevice->device, len) != 0) continue; - /* exact match */ + /* exact name match */ if (strlen(class_dev->name) == len) return 1; - /* instance numbers are matching too */ + /* name match with instance number */ if (isdigit(class_dev->name[len])) return 1; }