Hopefully ensured correct burn_disc_is_erasable() already after first grab

This commit is contained in:
Thomas Schmitt 2006-09-08 20:17:18 +00:00
parent d9209355fa
commit eed4a0a89e
3 changed files with 88 additions and 13 deletions

View File

@ -171,15 +171,15 @@ or
#define Cdrskin_libburn_padding_does_worK 1
#define Cdrskin_libburn_does_ejecT 1
#define Cdrskin_libburn_has_drive_get_adR 1
#define Cdrskin_progress_track_does_worK 1
#define Cdrskin_is_erasable_on_load_does_worK 1
#define Cdrskin_grab_abort_does_worK 1
#ifdef Cdrskin_new_api_tesT
/* switches from old behavior with aquiring drives to new behavior */
/* (put parasite macros under test caveat here) */
#define Cdrskin_grab_abort_does_worK 1
#endif
@ -229,6 +229,9 @@ or
#define Cdrskin_grab_abort_brokeN 1
#endif
#ifndef Cdrskin_is_erasable_on_load_does_worK
#define Cdrskin_is_erasable_on_load_is_brokeN 1
#endif
/** A macro which is able to eat up a function call like printf() */
#ifdef Cdrskin_extra_leaN
@ -2253,7 +2256,9 @@ int Cdrskin_grab_drive(struct CdrskiN *skin, int flag)
fprintf(stderr,"cdrskin: experimental: burn_drive_scan_and_grab ret=%d\n",
ret);
*/
goto unable;
fprintf(stderr,"cdrskin: FATAL : unable to open drive '%s'\n",
skin->preskin->device_adr);
goto ex;
}
skin->driveno= 0;
} else {
@ -2276,21 +2281,33 @@ int Cdrskin_grab_drive(struct CdrskiN *skin, int flag)
#endif /* ! Cdrskin_new_api_tesT */
/* RIP-14.5 + LITE-ON 48125S produce a false status if tray was unloaded */
/* Therefore the first grab is just for loading */
if(!burn_drive_grab(drive, 1)) {
unable:;
ret= burn_drive_grab(drive,1);
if(ret==0) {
fprintf(stderr,"cdrskin: FATAL : unable to open drive %d\n",
skin->driveno);
ret= 0; goto ex;
goto ex;
}
skin->drive_is_grabbed= 1;
#ifdef Cdrskin_is_erasable_on_load_is_brokeN
/* RIP-14.5 + LITE-ON 48125S produce a false status if tray was unloaded */
/* Therefore the first grab was just for loading */
skin->drive_is_grabbed= 1; /* message to eventual abort handler */
burn_drive_release(drive,0);
skin->drive_is_grabbed= 0;
/* now grab the drive for real */
if(!burn_drive_grab(drive, 1))
goto unable;
ret= burn_drive_grab(drive,1);
if(ret==0) {
fprintf(stderr,"cdrskin: FATAL : unable to open drive %d\n",
skin->driveno);
goto ex;
}
#else
if(skin->verbosity>=Cdrskin_verbose_debuG)
ClN(fprintf(stderr,
"cdrskin_debug: Trusting in burn_disc_erasable() after first grab\n"));
#endif /* ! Cdrskin_is_erasable_on_load_is_brokeN */
}
skin->drive_is_grabbed= 1;
ret= 1;

View File

@ -122,6 +122,11 @@ unsigned int burn_drive_count(void)
int burn_drive_grab(struct burn_drive *d, int le)
{
int errcode;
int was_equal = 0, must_equal = 3, max_loop = 20;
/* ts A60907 */
int loop_count, old_speed = -1234567890, new_speed = -987654321;
int old_erasable = -1234567890, new_erasable = -987654321;
if (!d->released) {
burn_print(1, "can't grab - already grabbed\n");
@ -142,9 +147,49 @@ int burn_drive_grab(struct burn_drive *d, int le)
d->status = BURN_DISC_BLANK;
if (d->mdata->cdr_write || d->mdata->cdrw_write ||
d->mdata->dvdr_write || d->mdata->dvdram_write) {
#ifdef Libburn_grab_release_and_grab_agaiN
d->read_disc_info(d);
#else
/* ts A60908 */
/* Trying to stabilize the disc status after eventual load
without closing and re-opening the drive */
/* This seems to work for burn_disc_erasable() .
Speed values on RIP-14 and LITE-ON 48125S are stable
and false, nevertheless. So cdrskin -atip is still
forced to finish-initialize. */
/*
fprintf(stderr,"libburn: experimental: read_disc_info()\n");
*/
for (loop_count = 0; loop_count < max_loop; loop_count++){
old_speed = new_speed;
old_erasable = new_erasable;
d->read_disc_info(d);
new_speed = burn_drive_get_write_speed(d);
new_erasable = burn_disc_erasable(d);
if (new_speed == old_speed &&
new_erasable == old_erasable) {
was_equal++;
if (was_equal >= must_equal)
break;
} else
was_equal = 0;
/*
if (loop_count >= 1 && was_equal == 0)
fprintf(stderr,"libburn: experimental: %d : speed %d:%d erasable %d:%d\n",
loop_count,old_speed,new_speed,old_erasable,new_erasable);
*/
usleep(100000);
}
#endif /* ! Libburn_grab_release_and_grab_agaiN */
} else {
d->read_toc(d);
}
d->busy = BURN_DRIVE_IDLE;
return 1;
}
@ -469,6 +514,9 @@ int burn_drive_info_forget(struct burn_drive_info *info, int force)
d = info->drive;
occup = burn_drive_is_occupied(d);
/*
fprintf(stderr, "libburn: experimental: occup == %d\n",occup);
*/
if(occup <= -2)
return 2;
if(occup > 0)
@ -577,6 +625,9 @@ int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr,
while (!burn_drive_scan(drive_infos, &n_drives));
if (n_drives <= 0)
return 0;
/* ts A60908 : seems we get rid of this :) */
#ifdef Libburn_grab_release_and_grab_agaiN
if (load) {
/* RIP-14.5 + LITE-ON 48125S produce a false status
if tray was unloaded */
@ -586,6 +637,8 @@ int burn_drive_scan_and_grab(struct burn_drive_info *drive_infos[], char* adr,
return -1;
burn_drive_release(drive_infos[0]->drive,0);
}
#endif /* Libburn_grab_release_and_grab_agaiN */
ret = burn_drive_grab(drive_infos[0]->drive, load);
if (ret != 1)
return -1;

View File

@ -30,7 +30,7 @@
Terminal 2 (while terminal 1 still burning):
echo | \
test/testburner --test_ticket_62 --drive 0 --stdin_size 10000000
test/testburner --test_ticket_62 --drive 0 --stdin_size 10000000 -
This should start a burn on your second drive. Wether throughput is
acceptable will depend on your system backbone.
@ -219,6 +219,7 @@ int libburner_drop_unwanted_and_grab(int *driveno)
}
printf("--test_ticket_62: Looks good so far ...\n");
#ifdef Testburner_release_and_grab_agaiN
/* Load the drive tray and avoid a bug in libburn burn_drive_grab() */
/* Some systems produce a false status if tray was unloaded */
/* Therefore the first grab is just for loading */
@ -226,6 +227,10 @@ int libburner_drop_unwanted_and_grab(int *driveno)
if (ret != 1)
return 0;
burn_drive_release(drive_list[*driveno].drive, 0);
#else
printf("--test_ticket_62: Skipped extra release and grab cycle\n");
#endif /* ! Testburner_release_and_grab_agaiN */
/* now grab for real */
ret= burn_drive_grab(drive_list[*driveno].drive, 1);
if (ret != 1)