cdrom.c: Try to mount multiple devices in automatic mode
This commit is contained in:
parent
c1feb23c6d
commit
6beeb2ccca
16
cdrom.c
16
cdrom.c
@ -228,6 +228,7 @@ enum return_type cdrom_prepare(void)
|
|||||||
|
|
||||||
if (IS_AUTOMATIC) {
|
if (IS_AUTOMATIC) {
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
enum return_type automatic_result = RETURN_OK;
|
||||||
|
|
||||||
for (j = 0; j < 15; ++j) {
|
for (j = 0; j < 15; ++j) {
|
||||||
udev_settle();
|
udev_settle();
|
||||||
@ -254,14 +255,23 @@ enum return_type cdrom_prepare(void)
|
|||||||
get_medias(CDROM, &medias, &medias_models);
|
get_medias(CDROM, &medias, &medias_models);
|
||||||
remove_wait_message();
|
remove_wait_message();
|
||||||
}
|
}
|
||||||
if ((i = try_automatic(medias, medias_models)) != -1) {
|
while ((i = try_automatic(medias, medias_models)) != -1) {
|
||||||
if (j) {
|
if (j && automatic_result == RETURN_OK) {
|
||||||
log_message("found /dev/%s %s after %d seconds of waiting",
|
log_message("found /dev/%s %s after %d seconds of waiting",
|
||||||
medias[i], medias_models[i], j);
|
medias[i], medias_models[i], j);
|
||||||
remove_wait_message();
|
remove_wait_message();
|
||||||
}
|
}
|
||||||
return do_with_device(medias[i], medias_models[i]);
|
if (automatic_result != RETURN_OK) {
|
||||||
|
log_message("try next found device /dev/%s %s",
|
||||||
|
medias[i], medias_models[i]);
|
||||||
|
}
|
||||||
|
automatic_result = do_with_device(medias[i], medias_models[i]);
|
||||||
|
if (automatic_result == RETURN_OK)
|
||||||
|
return RETURN_OK;
|
||||||
|
log_message("mount device /dev/%s %s failed", medias[i], medias_models[i]);
|
||||||
}
|
}
|
||||||
|
if (automatic_result != RETURN_OK)
|
||||||
|
return automatic_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = medias;
|
ptr = medias;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user