From 8877b366253978f52be6099018e040c1a2783492 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 10 Jan 2007 21:07:48 +0000 Subject: [PATCH] Enabled explicit full formatting of DVD+RW ("de-icing") --- cdrskin/cdrskin.1 | 10 +++++++--- cdrskin/cdrskin.c | 38 +++++++++++++++++++++++-------------- cdrskin/cdrskin_timestamp.h | 2 +- libburn/async.c | 10 +++++++--- libburn/mmc.c | 29 +++++++++++++++++++--------- 5 files changed, 59 insertions(+), 30 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index f4d0d0b..93c3bb7 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -183,7 +183,7 @@ those parameters and eventually raw audio data get extracted and burned as audio track. Same is done for suffix .au and SUN Audio. .TP .BI blank= type -Blank a CD-RW or format a DVD-RW. +Blank a CD-RW or format a DVD+/-RW. This is combinable with burning in the same run of cdrskin. The type given with blank= selects the particular behavior: .RS @@ -202,15 +202,19 @@ Format a DVD-RW to "Restricted Overwrite". The user should bring some patience. (Note: format_overwrite* are not original cdrecord options.) .TP format_overwrite_quickest -Like format_overwrite without creating a 128 MB trailblazer track. +Like format_overwrite without creating a 128 MB trailblazer session. Leads to "intermediate" state which only allows sequential write beginning from address 0. The "intermediate" state ends after the first session of writing data. .TP format_overwrite_full -Like format_overwrite but claiming full media size rather than just 128 MB. +For DVD-RW this is like format_overwrite but claims full media size +rather than just 128 MB. Most traditional formatting is attempted. No data get written. Much patience is required. +.br +For DVD+RW this is the only supported explicit formatting type. It provides +complete "de-icing" so no reader slips on unwritten data areas. .RE .TP .BI \-checkdrive diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index da02ca1..841717e 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -1823,16 +1823,14 @@ return: fprintf(stderr,"\tall\t\tblank the entire disk\n"); fprintf(stderr,"\tdisc\t\tblank the entire disk\n"); fprintf(stderr,"\tdisk\t\tblank the entire disk\n"); - fprintf(stderr, - "\tfast\t\tminimally blank the entire disk\n"); - fprintf(stderr, - "\tminimal\t\tminimally blank the entire disk\n"); + fprintf(stderr,"\tfast\t\tminimally blank the entire disk\n"); + fprintf(stderr,"\tminimal\t\tminimally blank the entire disk\n"); fprintf(stderr, "\tformat_overwrite\tformat a DVD-RW to \"Restricted Overwrite\"\n"); fprintf(stderr, - "\tformat_overwrite_full\t\tto \"Restricted Overwrite\" in full size\n"); + "\tformat_overwrite_quickest\tto \"Restricted Overwrite intermediate\"\n"); fprintf(stderr, - "\tformat_overwrite_quickest\tto \"Restricted Overwrite\" intermediate\n"); + "\tformat_overwrite_full\tfull-size format a DVD-RW or DVD+RW\n"); #else /* ! Cdrskin_extra_leaN */ @@ -3972,26 +3970,38 @@ int Cdrskin_blank(struct CdrskiN *skin, int flag) return(0); } else if(profile_number == 0x14) { /* DVD-RW sequential */ if(do_format!=1) - goto unsupported_with_dvd_minus_rw; + goto unsupported_format_type; } else if(profile_number == 0x13) { /* DVD-RW restricted overwrite */ if(do_format==1 && skin->force_is_set) { /* ok */; } else if(do_format!=1) { -unsupported_with_dvd_minus_rw:; +unsupported_format_type:; fprintf(stderr, - "cdrskin: SORRY : blank=%s : unsupported format type with DVD-RW\n", + "cdrskin: SORRY : blank=%s : unsupported format and/or media type\n", fmt_text); return(0); } else { fprintf(stderr, - "cdrskin: SORRY : blank=format_overwrite : media is already formatted\n"); + "cdrskin: NOTE : blank=format_... : media is already formatted\n"); fprintf(stderr, - "cdrskin: HINT : If you really want to re-format, try option -force\n"); + "cdrskin: HINT : If you really want to re-format, add option -force\n"); + return(2); + } + } else if(profile_number == 0x1a) { /* DVD+RW */ + if(do_format!=1) + goto unsupported_format_type; + if(!((skin->blank_format_type>>8)&4)) { + fprintf(stderr, + "cdrskin: NOTE : blank=format_... : DVD+RW do not need this\n"); + fprintf(stderr, + "cdrskin: HINT : For de-icing use option blank=format_overwrite_full"); + fprintf(stderr, + "cdrskin: HINT : If you really want to re-format, add option -force\n"); return(2); } } else { fprintf(stderr, - "cdrskin: SORRY : blank=%s for now does DVD-RW only\n",fmt_text); + "cdrskin: SORRY : blank=%s for now does DVD+/-RW only\n",fmt_text); return(0); } if(s==BURN_DISC_UNSUITABLE) @@ -4065,12 +4075,12 @@ unsupported_with_dvd_minus_rw:; while(burn_drive_get_status(drive, &p) != BURN_DRIVE_IDLE) { if(loop_counter>0) if(skin->verbosity>=Cdrskin_verbose_progresS) { - int percent= 50; + double percent= 50.0; if(p.sectors>0) /* i want a display of 1 to 99 percent */ percent= 1.0+((double) p.sector+1.0)/((double) p.sectors)*98.0; fprintf(stderr, - "\rcdrskin: %s ( done %2d%% , %lu seconds elapsed ) ", + "\rcdrskin: %s ( done %.1f%% , %lu seconds elapsed ) ", presperf,percent,(unsigned long) (Sfile_microtime(0)-start_time)); } sleep(1); diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index ba06b4c..3813e9b 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.01.10.152812" +#define Cdrskin_timestamP "2007.01.10.204839" diff --git a/libburn/async.c b/libburn/async.c index 55d030d..2449be2 100644 --- a/libburn/async.c +++ b/libburn/async.c @@ -280,10 +280,14 @@ void burn_disc_format(struct burn_drive *drive, off_t size, int flag) if (drive->current_profile == 0x14) ok = 1; /* DVD-RW sequential */ - if (drive->current_profile == 0x13 && (flag & 16)) + else if (drive->current_profile == 0x13 && (flag & 16)) ok = 1; /* DVD-RW Restricted Overwrite with force bit */ - - /* >>> DVD+RW with and without force bit ? */ + else if (drive->current_profile == 0x1a) { + ok = 1; /* DVD+RW */ + size = 0; + flag &= ~(2|8); /* no insisting in size 0, no expansion */ + flag |= 4; /* format up to maximum size */ + } if (!ok) { sprintf(msg,"Will not format media type %4.4Xh", diff --git a/libburn/mmc.c b/libburn/mmc.c index b7bb84f..23ee1a3 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -1304,17 +1304,24 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag) for (i = 0; i < 4; i++) c.page->data[4 + i] = (num_of_blocks >> (24 - 8 * i)) & 0xff; if (d->current_profile == 0x1a) { /* DVD+RW */ - /* >>> use case: background formatting during write */ + /* >>> use case: background formatting during write !(flag&4) + de-icing as explicit formatting action (flag&4) + */ /* mmc5r03c.pdf , 6.5.4.2.14, DVD+RW Basic Format */ format_type = 0x26; - if ((size <= 0 && !(flag & 2)) || (flag & (4 | 8))) + if ((size <= 0 && !(flag & 2)) || (flag & (4 | 8))) { /* maximum capacity */ memset(c.page->data + 4, 0xff, 4); + num_of_blocks = 0xffffffff; + } - if(d->bg_format_status == 2) { /* format in progress */ - strcpy(msg,"FORMAT UNIT ignored. Already in progress"); + if(d->bg_format_status == 2 || + (d->bg_format_status == 3 && !(flag & 16))) { + sprintf(msg,"FORMAT UNIT ignored. Already %s.", + (d->bg_format_status == 2 ? "in progress" : + "completed")); libdax_msgs_submit(libdax_messenger, d->global_index, 0x00020120, LIBDAX_MSGS_SEV_NOTE, LIBDAX_MSGS_PRIO_HIGH, @@ -1324,7 +1331,10 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag) if (!(flag & 16)) /* if not re-format is desired */ if (d->bg_format_status == 1) /* is partly formatted */ c.page->data[11] = 1; /* Restart bit */ - sprintf(descr, "DVD+RW, BGFS %d", d->bg_format_status); + sprintf(descr, "DVD+RW (fs=%d,rs=%d)", + d->bg_format_status, (c.page->data[11] == 1)); + if (flag & 4) + return_immediately = 1;/* caller must do the waiting */ } else if (d->current_profile == 0x13 && !(flag & 16)) { /*DVD-RW restricted overwrite*/ @@ -1363,7 +1373,7 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag) /* 6.5.4.2.8 , DVD-RW Quick Grow Last Border */ format_type = 0x13; c.page->data[11] = 16; /* block size * 2k */ - sprintf(descr, "DVD-RW, quick grow"); + sprintf(descr, "DVD-RW quick grow"); } else if (d->current_profile == 0x14 || (d->current_profile == 0x13 && (flag & 16))) { @@ -1398,7 +1408,8 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag) } format_type = d->best_format_type; c.page->data[11] = 16; /* block size * 2k */ - sprintf(descr, "DVD-RW, quick"); + sprintf(descr, "DVD-RW %s", + format_type == 0x15 ? "quick" : "full"); return_immediately = 1; /* caller must do the waiting */ } else { @@ -1415,8 +1426,8 @@ int mmc_format_unit(struct burn_drive *d, off_t size, int flag) } c.page->data[8] = format_type << 2; - sprintf(msg, "Format type %2.2Xh , blocks = %d\n", - format_type, (int) num_of_blocks); + sprintf(msg, "Format type %2.2Xh \"%s\", blocks = %.f\n", + format_type, descr, (double) num_of_blocks); libdax_msgs_submit(libdax_messenger, d->global_index, 0x00000002, LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, msg, 0, 0);