Avoided random percentage display at start of blanking

This commit is contained in:
Thomas Schmitt 2010-02-17 14:12:23 +00:00
parent 471a0d0058
commit 255e5362f9
4 changed files with 41 additions and 3 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2010.02.16.194147"
#define Cdrskin_timestamP "2010.02.17.141409"

View File

@ -232,6 +232,22 @@ static void *scan_worker_func(struct w_list *w)
return NULL;
}
static void reset_progress(struct burn_drive *d, int sessions, int tracks,
int indices, int sectors, int flag)
{
/* reset the progress indicator */
d->progress.session = 0;
d->progress.sessions = sessions;
d->progress.track = 0;
d->progress.tracks = tracks;
d->progress.index = 0;
d->progress.indices = indices;
d->progress.start_sector = 0;
d->progress.sectors = sectors;
d->progress.sector = 0;
}
int burn_drive_scan(struct burn_drive_info *drives[], unsigned int *n_drives)
{
struct scan_opts o;
@ -314,6 +330,7 @@ void burn_disc_erase(struct burn_drive *drive, int fast)
/* a ssert(drive); */
/* a ssert(!SCAN_GOING()); */
/* a ssert(!find_worker(drive)); */
if((drive == NULL)) {
libdax_msgs_submit(libdax_messenger, drive->global_index,
0x00020104,
@ -329,6 +346,9 @@ void burn_disc_erase(struct burn_drive *drive, int fast)
0, 0);
return;
}
reset_progress(drive, 1, 1, 1, 0x10000, 0);
/* A70103 : will be set to 0 by burn_disc_erase_sync() */
drive->cancel = 1;
@ -383,6 +403,8 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag)
int ok = 0, ret;
char msg[160];
reset_progress(drive, 1, 1, 1, 0x10000, 0);
if ((SCAN_GOING()) || find_worker(drive) != NULL) {
libdax_msgs_submit(libdax_messenger, drive->global_index,
0x00020102,
@ -547,6 +569,9 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
return;
}
reset_progress(d, disc->sessions, disc->session[0]->tracks,
disc->session[0]->track[0]->indices, 0, 0);
/* For the next lines any return indicates failure */
d->cancel = 1;

View File

@ -621,8 +621,9 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
d->idata->product);
d->cancel = 0;
d->busy = BURN_DRIVE_ERASING;
d->erase(d, fast);
#ifdef Libburn_reset_progress_asynC
/* <<< This is now done in async.c */
/* reset the progress */
d->progress.session = 0;
d->progress.sessions = 1;
@ -633,6 +634,11 @@ void burn_disc_erase_sync(struct burn_drive *d, int fast)
d->progress.start_sector = 0;
d->progress.sectors = 0x10000;
d->progress.sector = 0;
#endif /* Libburn_reset_progress_asynC */
d->erase(d, fast);
d->busy = BURN_DRIVE_ERASING;
/* read the initial 0 stage */
while (!d->test_unit_ready(d) && d->get_erase_progress(d) == 0)
sleep(1);
@ -659,6 +665,8 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
char msg[80];
struct buffer buf, *buf_mem = d->buffer;
#ifdef Libburn_reset_progress_asynC
/* <<< This is now done in async.c */
/* reset the progress */
d->progress.session = 0;
d->progress.sessions = 1;
@ -669,6 +677,8 @@ void burn_disc_format_sync(struct burn_drive *d, off_t size, int flag)
d->progress.start_sector = 0;
d->progress.sectors = 0x10000;
d->progress.sector = 0;
#endif /* Libburn_reset_progress_asynC */
stages = 1 + ((flag & 1) && size > 1024 * 1024);
d->cancel = 0;
d->busy = BURN_DRIVE_FORMATTING;

View File

@ -942,6 +942,8 @@ int burn_disc_init_write_status(struct burn_write_opts *o,
d->cancel = 0;
#ifdef Libburn_reset_progress_asynC
/* <<< This is now done in async.c */
/* init progress before showing the state */
d->progress.session = 0;
d->progress.sessions = disc->sessions;
@ -956,6 +958,7 @@ int burn_disc_init_write_status(struct burn_write_opts *o,
d->progress.sectors = 0;
d->progress.sector = 0;
d->progress.track = 0;
#endif /* Libburn_reset_progress_asynC */
/* ts A61023 */
d->progress.buffer_capacity = 0;