From c9b8dbfb652a10d2f1c1b122a3806c21cab87ab4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Jun 2005 02:11:59 +0200 Subject: [PATCH] fix the fix and change the file to wait for to the "bus" link Signed-off-by: Kay Sievers --- udev.c | 40 ++++++++++++++++++-------------------- udev_sysfs.c | 54 ++++++++++++++++++++++++++-------------------------- udev_sysfs.h | 2 +- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/udev.c b/udev.c index 67d081d0..36ff21d5 100644 --- a/udev.c +++ b/udev.c @@ -179,27 +179,25 @@ int main(int argc, char *argv[], char *envp[]) /* export name of device node or netif */ if (udev.devname[0] != '\0') setenv("DEVNAME", udev.devname, 1); - } else if (udev.type == DEV_DEVICE) { - if (strcmp(action, "add") == 0) { - struct sysfs_device *devices_dev; - - /* wait for sysfs of /sys/devices/ */ - dbg("devices add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); - path[sizeof(path)-1] = '\0'; - devices_dev = wait_devices_device_open(path); - if (!devices_dev) { - dbg("devices device unavailable (probably remove has beaten us)"); - goto run; - } - dbg("devices device opened '%s'", path); - wait_for_devices_device(devices_dev, &error); - udev_rules_get_run(&udev, devices_dev); - sysfs_close_device(devices_dev); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } + } else if (udev.type == DEV_DEVICE && strcmp(action, "add") == 0) { + struct sysfs_device *devices_dev; + + /* wait for sysfs of /sys/devices/ */ + dbg("devices add"); + snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); + path[sizeof(path)-1] = '\0'; + devices_dev = wait_devices_device_open(path); + if (!devices_dev) { + dbg("devices device unavailable (probably remove has beaten us)"); + goto run; + } + dbg("devices device opened '%s'", path); + wait_for_devices_device(devices_dev, &error); + udev_rules_get_run(&udev, devices_dev); + sysfs_close_device(devices_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; } } else { dbg("default handling"); diff --git a/udev_sysfs.c b/udev_sysfs.c index 5c431906..90ce48ca 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -297,38 +297,38 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, { .bus = "usb", .file = "bNumEndpoints" }, - { .bus = "usb-serial", .file = "power" }, - { .bus = "ide", .file = "power" }, + { .bus = "usb-serial", .file = "bus" }, + { .bus = "ide", .file = "bus" }, { .bus = "pci", .file = "vendor" }, - { .bus = "platform", .file = "power" }, - { .bus = "pcmcia", .file = "power" }, - { .bus = "i2c", .file = "power" }, + { .bus = "platform", .file = "bus" }, + { .bus = "pcmcia", .file = "bus" }, + { .bus = "i2c", .file = "bus" }, { .bus = "ieee1394", .file = "node_count" }, { .bus = "ieee1394", .file = "nodeid" }, { .bus = "ieee1394", .file = "address" }, { .bus = "bttv-sub", .file = NULL }, - { .bus = "pnp", .file = "power" }, - { .bus = "eisa", .file = "power" }, - { .bus = "serio", .file = "power" }, - { .bus = "pseudo", .file = "power" }, - { .bus = "mmc", .file = "power" }, - { .bus = "macio", .file = "power" }, - { .bus = "of_platform", .file = "power" }, - { .bus = "vio", .file = "power" }, - { .bus = "ecard", .file = "power" }, - { .bus = "sa1111-rab", .file = "power" }, - { .bus = "amba", .file = "power" }, - { .bus = "locomo-bus", .file = "power" }, - { .bus = "logicmodule", .file = "power" }, - { .bus = "parisc", .file = "power" }, - { .bus = "ocp", .file = "power" }, - { .bus = "dio", .file = "power" }, - { .bus = "MCA", .file = "power" }, - { .bus = "wl", .file = "power" }, - { .bus = "ccwgroup", .file = "power" }, - { .bus = "css", .file = "power" }, - { .bus = "ccw", .file = "power" }, - { .bus = "iucv", .file = "power" }, + { .bus = "pnp", .file = "bus" }, + { .bus = "eisa", .file = "bus" }, + { .bus = "serio", .file = "bus" }, + { .bus = "pseudo", .file = "bus" }, + { .bus = "mmc", .file = "bus" }, + { .bus = "macio", .file = "bus" }, + { .bus = "of_platform", .file = "bus" }, + { .bus = "vio", .file = "bus" }, + { .bus = "ecard", .file = "bus" }, + { .bus = "sa1111-rab", .file = "bus" }, + { .bus = "amba", .file = "bus" }, + { .bus = "locomo-bus", .file = "bus" }, + { .bus = "logicmodule", .file = "bus" }, + { .bus = "parisc", .file = "bus" }, + { .bus = "ocp", .file = "bus" }, + { .bus = "dio", .file = "bus" }, + { .bus = "MCA", .file = "bus" }, + { .bus = "wl", .file = "bus" }, + { .bus = "ccwgroup", .file = "bus" }, + { .bus = "css", .file = "bus" }, + { .bus = "ccw", .file = "bus" }, + { .bus = "iucv", .file = "bus" }, { NULL, NULL } }; const struct device_file *devicefile = NULL; diff --git a/udev_sysfs.h b/udev_sysfs.h index 77c0e6a8..8078f62d 100644 --- a/udev_sysfs.h +++ b/udev_sysfs.h @@ -24,7 +24,7 @@ #include "libsysfs/sysfs/libsysfs.h" -#define WAIT_MAX_SECONDS 5 +#define WAIT_MAX_SECONDS 3 #define WAIT_LOOP_PER_SECOND 20 extern dev_t get_devt(struct sysfs_class_device *class_dev); -- 2.39.5