From f77dd3134bed6053f8f7b9258db6c64958277f12 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 12 Jan 2007 16:26:31 +0000 Subject: [PATCH] Enabled writing to DVD-RAM --- cdrskin/cdrskin.1 | 24 ++++++++++++++---------- cdrskin/cdrskin.c | 16 +++++++++++----- cdrskin/cdrskin_timestamp.h | 2 +- libburn/mmc.c | 27 +++++++++++++++++++-------- libburn/spc.c | 4 ++++ libburn/write.c | 22 +++++++++++++++------- 6 files changed, 64 insertions(+), 31 deletions(-) diff --git a/cdrskin/cdrskin.1 b/cdrskin/cdrskin.1 index 93c3bb7..729d97a 100644 --- a/cdrskin/cdrskin.1 +++ b/cdrskin/cdrskin.1 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH CDRSKIN 1 "January 2, 2007" +.TH CDRSKIN 1 "January 12, 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -16,7 +16,8 @@ .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME -cdrskin \- burns preformatted data to CD-R, CD-RW or DVD+/-RW via libburn. +cdrskin \- burns preformatted data to CD-R, CD-RW, DVD+/-RW, DVD-RAM +via libburn. .SH SYNOPSIS .B cdrskin .RI [ options | track_source_addresses ] @@ -45,7 +46,7 @@ Multi session on CD (follow-up sessions in TAO only). .br Bus scan, burnfree, speed options, retrieving media info, padding, fifo. .br -Burning of a single data track to DVD+RW or DVD-RW. +Burning of a single data track to DVD+RW, DVD-RW or DVD-RAM. .br See section EXAMPLES at the end of this text. .PP @@ -107,17 +108,18 @@ Multiple cycles of blanking and overwriting with random numbers might be. .PP .B Recordable DVD Media: .br -Currently only types DVD+RW and DVD-RW can be burned via cdrskin. +Currently only types DVD+RW, DVD-RW and DVD-RAM can be burned via cdrskin. .br -DVD+RW media get treated as blank media regardless wether they hold data -or not. Options -audio and -multi are not allowed. Only one track is allowed. +DVD+RW and DVD-RAM media get treated as blank media regardless wether they +hold data or not. They need no special initial formatting. +Options -audio and -multi are not allowed. Only one track is allowed. -toc does not return information about the media content. Speed is counted in DVD units (i.e. 1x = 1,385,000 bytes/second). Currently there is no difference between -sao and -tao. If ever, then -tao will be the mode which preserves the current behavior. .br -DVD-RW need to be formatted to state "Restricted Overwrite". They then behave -much like CD-RW. This formatting can be done by option +DVD-RW need to be formatted to state "Restricted Overwrite". Then they behave +much like DVD+RW. This formatting can be done by option .B blank=format_overwrite It is necessary for unused media, for media written or blanked by cdrecord, for media which have been written unformatted by growisofs or blanked by @@ -478,8 +480,10 @@ interpretation of eventual startup files. See section FILES below. Accept only the last argument of the command line as track source address. .TP .BI write_start_address= byte_offset -Set the address on media where to start writing the track. With DVD+RW -byte_offset must be aligned to 2 KB blocks. With DVD-RW alignment is 32 kB. +Set the address on media where to start writing the track. With DVD+RW or +DVD-RAM byte_offset must be aligned to 2 KB blocks, but better is 32 kB. +With DVD-RW 32 kB alignment is mandatory. +.br Other media are not suitable for this option yet. .PP Alphabetical list of options which are only intended for very special diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 841717e..005a43a 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -3808,10 +3808,15 @@ int Cdrskin_atip(struct CdrskiN *skin, int flag) printf("Current: CD-R\n"); } if(strstr(profile_name,"DVD")==profile_name) { + /* These are dummy messages for project scdbackup, so its media recognition + gets a hint that the media is suitable and not in need of blanking. + scdbackup will learn to interpret cdrskin's DVD messages but the + current stable version needs to believe it is talking to its own + growisofs_wrapper. So this is an emulation of an emulator. + */ printf("book type: %s (emulated booktype)\n", profile_name); - if(profile_number==0x13) - printf( - "cdrskin: for sdvdbackup: \"(growisofs mode Restricted Overwrite)\"\n"); + if(profile_number==0x13) /* DVD-RW */ + printf("cdrskin: message for sdvdbackup: \"(growisofs mode Restricted Overwrite)\"\n"); } else { printf("ATIP info from disk:\n"); if(burn_disc_erasable(drive)) { @@ -4443,8 +4448,9 @@ int Cdrskin_activate_write_mode(struct CdrskiN *skin, enum burn_disc_status s, if(s == BURN_DISC_APPENDABLE) { strcpy(skin->preskin->write_mode_name,"TAO"); was_still_default= 2; /*<<< prevents trying of SAO if drive dislikes TAO*/ - } else if(strstr(profile_name,"DVD+RW")==profile_name || - profile_number == 0x13) { /* DVD-RW Restricted Overwrite */ + } else if(profile_number==0x1a || profile_number==0x13 || + profile_number==0x12) { + /* DVD+RW , DVD-RW Restricted Overwrite , DVD-RAM */ strcpy(skin->preskin->write_mode_name,"TAO"); } else { strcpy(skin->preskin->write_mode_name,"SAO"); diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 0661e26..d548b6d 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2007.01.11.131716" +#define Cdrskin_timestamP "2007.01.12.162239" diff --git a/libburn/mmc.c b/libburn/mmc.c index bcf67d2..d1077cd 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -38,10 +38,12 @@ extern struct libdax_msgs *libdax_messenger; #define Libburn_support_dvd_plus_rW 1 /* ts A61229 */ -/* -*/ #define Libburn_support_dvd_minusrw_overW 1 +/* ts A70112 */ +#define Libburn_support_dvd_raM 1 + + /* Progress report (with Libburn_support_dvd_plus_rW defined): ts A61219 : It seems to work with a used (i.e. thoroughly formatted) DVD+RW. Error messages of class DEBUG appear because of inability to @@ -62,6 +64,7 @@ extern struct libdax_msgs *libdax_messenger; really seems to work without such a page. ts A70101 : Formatted DVD-RW media. Success is varying with media, but dvd+rw-format does not do better with the same media. + ts A70112 : Support for writing to DVD-RAM. Todo: Determine first free lba for appending data. @@ -167,8 +170,9 @@ int mmc_get_nwa(struct burn_drive *d, int trackno, int *lba, int *nwa) memcpy(c.opcode, MMC_TRACK_INFO, sizeof(MMC_TRACK_INFO)); c.opcode[1] = 1; if(trackno<=0) { - if (d->current_profile == 0x1a || d->current_profile == 0x13) - /* DVD+RW or DVD-RW restricted overwrite*/ + if (d->current_profile == 0x1a || d->current_profile == 0x13 || + d->current_profile == 0x12 ) + /* DVD+RW , DVD-RW restricted overwrite , DVD-RAM */ c.opcode[5] = 1; else /* mmc5r03c.pdf: valid only for CD, DVD+R, DVD+R DL */ c.opcode[5] = 0xFF; @@ -610,10 +614,13 @@ void mmc_read_disc_info(struct burn_drive *d) */ d->bg_format_status = data[7] & 3; - /* ts A61219 : preliminarily declare all DVD+RW blank, - (which is not the same as bg_format_status==0 "blank") */ - /* ts A61229 : same for DVD-RW Restricted overwrite */ - if (d->current_profile == 0x1a || d->current_profile == 0x13) + /* Preliminarily declare blank: + ts A61219 : DVD+RW (is not bg_format_status==0 "blank") + ts A61229 : same for DVD-RW Restricted overwrite + ts A70112 : same for DVD-RAM + */ + if (d->current_profile == 0x1a || d->current_profile == 0x13 || + d->current_profile == 0x12) d->status = BURN_DISC_BLANK; } @@ -1101,6 +1108,10 @@ void mmc_get_configuration(struct burn_drive *d) if (cp == 0x13) d->current_is_supported_profile = 1; #endif +#ifdef Libburn_support_dvd_raM + if (cp == 0x12) + d->current_is_supported_profile = 1; +#endif /* >>> see mmc5r03c.pdf 5.2 Interpret list of profile and feature descriptors. diff --git a/libburn/spc.c b/libburn/spc.c index e1a3018..c33f183 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -434,6 +434,10 @@ void spc_getcaps(struct burn_drive *d) spc_inquiry(d); spc_sense_caps(d); spc_sense_error_params(d); + + /* <<< for debugging. >>> ??? to be fixely included here ? + mmc_read_format_capacities(d, -1); + */ } /* diff --git a/libburn/write.c b/libburn/write.c index 1579274..17454c8 100644 --- a/libburn/write.c +++ b/libburn/write.c @@ -918,7 +918,8 @@ int burn_dvd_write_session(struct burn_write_opts *o, if (ret <= 0) break; } - if (strcmp(d->current_profile_text,"DVD+RW")==0) { + if (d->current_profile == 0x1a) { + /* DVD+RW */ ret = burn_disc_close_session_dvd_plus_rw(o, s); if (ret <= 0) return 0; @@ -927,6 +928,9 @@ int burn_dvd_write_session(struct burn_write_opts *o, ret = burn_disc_close_session_dvd_minus_rw(o, s); if (ret <= 0) return 0; + } else if (d->current_profile == 0x12) { + /* DVD-RAM */ + /* ??? any finalization needed ? */; } return 1; } @@ -1056,13 +1060,14 @@ int burn_dvd_write_sync(struct burn_write_opts *o, goto early_failure; } - if (d->current_profile == 0x1a || d->current_profile == 0x13) { - /* DVD+RW or DVD-RW Restricted Overwrite */ + if (d->current_profile == 0x1a || d->current_profile == 0x13 || + d->current_profile == 0x12) { + /* DVD+RW , DVD-RW Restricted Overwrite , DVD-RAM */ if (disc->sessions!=1 || disc->session[0]->tracks>1 || o->multi ) { sprintf(msg, - "Burning is restricted to a single track and no multi-session" - ); + "Burning is restricted to a single track and no multi-session on %s", + d->current_profile_text); libdax_msgs_submit(libdax_messenger, d->global_index, 0x0002011f, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, @@ -1070,7 +1075,8 @@ int burn_dvd_write_sync(struct burn_write_opts *o, goto early_failure; } } - if (d->current_profile == 0x1a) { /* DVD+RW */ + if (d->current_profile == 0x1a || d->current_profile == 0x12) { + /* DVD+RW , DVD-RAM */ if (o->start_byte >= 0 && (o->start_byte % 2048)) { sprintf(msg, "Write start address not properly aligned to 2048"); @@ -1080,7 +1086,9 @@ int burn_dvd_write_sync(struct burn_write_opts *o, msg, 0,0); goto early_failure; } - ret = burn_disc_setup_dvd_plus_rw(o, disc); + ret = 1; + if (d->current_profile == 0x1a) + ret = burn_disc_setup_dvd_plus_rw(o, disc); if (ret <= 0) { sprintf(msg, "Write preparation setup failed for DVD+RW");