home: hub: mkinitfs

Download patch

ref: e5432e3f5601126ec8c19bbb5a8c62268d5c0148
parent: 1b9609b547dceec3da39074adbc0ab5e4d9998ec
author: Natanael Copa <ncopa@alpinelinux.org>
date: Fri Oct 9 04:56:11 CDT 2015

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.

--- 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 @@
 	char *devname;
 	char *major;
 	char *minor;
+	char *driver;
 	char devnode[256];
 };
 
@@ -475,6 +477,8 @@
 
 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 @@
 		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 @@
 			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")) {