wait for usb-storage devices to show up, if any

This commit is contained in:
Sergey Bolshakov 2008-04-16 14:36:23 +03:00
parent b0433a8b77
commit 8d129a2d40
3 changed files with 6 additions and 6 deletions

View File

@ -123,8 +123,6 @@ enum return_type cdrom_prepare(void)
char * choice;
int i, count = 0;
enum return_type results;
my_insmod("ide-cd", NULL);
my_insmod("sr_mod", NULL);
update_splash();
get_medias(CDROM, &medias, &medias_models);

2
disk.c
View File

@ -282,8 +282,6 @@ enum return_type disk_prepare(void)
int i, count = 0;
enum return_type results;
my_insmod("ide-disk", NULL);
my_insmod("sd_mod", NULL);
get_medias(DISK, &medias, &medias_models);
ptr = medias;

View File

@ -121,6 +121,12 @@ static void find_media(void)
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);
remove_wait_message();
}
if ((dir = opendir("/sys/block")) == NULL) {
log_message("failed to open /sys/block directory");
return;
@ -174,10 +180,8 @@ static void find_media(void)
if (lstat(path, &st) == 0 && S_ISREG(st.st_mode)) {
tmp[count].name = strdup(dirent->d_name);
tmp[count].type = UNKNOWN_MEDIA;
log_message("IDE: name: %s", dirent->d_name);
if ((f = fopen(path, "r")) != NULL) {
if (fgets(buf, sizeof(buf), f)) {
log_message("IDE: type: %s", buf);
if (!strncmp("disk", buf, 4))
tmp[count].type = DISK;
else if (!strncmp("cdrom", buf, 5))