probing.c: enhance usb_storage long wait
It's pretty silly to wait for 10 seconds at once while not having ensured that the module is being loaded indeed... Thanks rom_as@ for pointing this out.
This commit is contained in:
parent
3b1a03f8b0
commit
8ed1a19660
18
probing.c
18
probing.c
@ -106,6 +106,11 @@ char * get_net_intf_description(char * intf_name)
|
||||
#ifndef DISABLE_MEDIAS
|
||||
static struct media_info * medias = NULL;
|
||||
|
||||
static int usb_not_there(void)
|
||||
{
|
||||
return opendir("/sys/module/usb_storage") == NULL;
|
||||
}
|
||||
|
||||
static void find_media(void)
|
||||
{
|
||||
FILE *f;
|
||||
@ -116,14 +121,19 @@ static void find_media(void)
|
||||
char path[SYSFS_PATH_MAX];
|
||||
char buf[512];
|
||||
char *s;
|
||||
int count = 0;
|
||||
int i = 0, count = 0;
|
||||
|
||||
if (medias)
|
||||
free(medias); /* that does not free the strings, by the way */
|
||||
|
||||
if ((dir = opendir("/sys/module/usb_storage")) != NULL) {
|
||||
wait_message("Waiting for USB storage devices to show up.");
|
||||
sleep(10);
|
||||
log_message("checking for /sys/module/usb_storage directory");
|
||||
if (usb_not_there()) {
|
||||
wait_message("Waiting for USB storage devices to show up...");
|
||||
my_insmod("usb_storage", NULL);
|
||||
do {
|
||||
sleep(1);
|
||||
i++;
|
||||
} while (usb_not_there() && (i < 10));
|
||||
remove_wait_message();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user