diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-10-09 09:56:11 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-10-09 09:56:11 +0000 |
commit | e5432e3f5601126ec8c19bbb5a8c62268d5c0148 (patch) | |
tree | eaa085c5252addd942825bbab1ed491e6fa28097 /nlplug-findfs.c | |
parent | 1b9609b547dceec3da39074adbc0ab5e4d9998ec (diff) | |
download | mkinitfs-e5432e3f5601126ec8c19bbb5a8c62268d5c0148.tar.bz2 mkinitfs-e5432e3f5601126ec8c19bbb5a8c62268d5c0148.tar.xz |
nlplug-findfs: increase timeout if usb-storage was found
usb storage need some time to settle, we increase the timeout with 2
seconds if we detext usb-storage.
Diffstat (limited to 'nlplug-findfs.c')
-rw-r--r-- | nlplug-findfs.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/nlplug-findfs.c b/nlplug-findfs.c index 9b145d5..be112d9 100644 --- a/nlplug-findfs.c +++ b/nlplug-findfs.c @@ -37,7 +37,8 @@ #include "arg.h" -#define DEFAULT_EVENT_TIMEOUT 250 +#define DEFAULT_EVENT_TIMEOUT 250 +#define USB_STORAGE_TIMEOUT 2000 #define FOUND_DEVICE 0x1 #define FOUND_BOOTREPO 0x2 @@ -74,6 +75,7 @@ struct uevent { char *devname; char *major; char *minor; + char *driver; char devnode[256]; }; @@ -475,6 +477,8 @@ int searchdev(char *devname, const char *searchdev, char *bootrepos, int dispatch_uevent(struct uevent *ev, struct ueventconf *conf) { + static int timeout_increment = USB_STORAGE_TIMEOUT; + if (conf->subsystem_filter && ev->subsystem && strcmp(ev->subsystem, conf->subsystem_filter) != 0) { dbg("subsystem '%s' filtered out (by '%s').", @@ -489,6 +493,10 @@ int dispatch_uevent(struct uevent *ev, struct ueventconf *conf) load_kmod(ev->modalias); conf->modalias_count++; + } else if (ev->driver != NULL && strcmp(ev->driver, "usb-storage") == 0) { + conf->timeout += timeout_increment; + timeout_increment = 0; + } else if (ev->devname != NULL) { if (conf->program_argv[0] != NULL) { run_child(conf->program_argv); @@ -557,6 +565,8 @@ int process_uevent(char *buf, const size_t len, struct ueventconf *conf) ev.major = value; } else if (strcmp(key, "MINOR") == 0) { ev.minor = value; + } else if (strcmp(key, "DRIVER") == 0) { + ev.driver = value; } if (strcmp(key, "PATH")) { |