From baedbd53795b3b685fabca57d6c6663f59185bb7 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 28 Oct 2013 15:10:35 +0000 Subject: [PATCH] Automatic re-try with -close "as_needed" and unannounced fast-blanked DVD-RW --- libisoburn/trunk/xorriso/opts_a_c.c | 11 ++- libisoburn/trunk/xorriso/parse_exec.c | 26 ++++-- libisoburn/trunk/xorriso/write_run.c | 85 +++++++++++++++++++- libisoburn/trunk/xorriso/xorriso.1 | 9 ++- libisoburn/trunk/xorriso/xorriso.info | 85 ++++++++++---------- libisoburn/trunk/xorriso/xorriso.texi | 9 ++- libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.h | 6 ++ 8 files changed, 177 insertions(+), 56 deletions(-) diff --git a/libisoburn/trunk/xorriso/opts_a_c.c b/libisoburn/trunk/xorriso/opts_a_c.c index 5374cc18..88d30109 100644 --- a/libisoburn/trunk/xorriso/opts_a_c.c +++ b/libisoburn/trunk/xorriso/opts_a_c.c @@ -1974,7 +1974,8 @@ int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag) */ int Xorriso_option_commit(struct XorrisO *xorriso, int flag) { - int ret; + int ret, eternal_problem_status_mem; + char eternal_problem_status_text_mem[80]; if(!Xorriso_change_is_pending(xorriso, 0)) { sprintf(xorriso->info_text, "-commit: No image modifications pending"); @@ -1988,7 +1989,15 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag) {ret= 2; goto ex;} } Xorriso_process_errfile(xorriso, 0, "burn session start", 0, 1); + eternal_problem_status_mem= Xorriso_get_problem_status(xorriso, + eternal_problem_status_text_mem, 1); ret= Xorriso_write_session(xorriso, 0); + if(ret == 2) { + if(Xorriso__severity_cmp("WARNING", eternal_problem_status_text_mem) > 0) + strcpy(eternal_problem_status_text_mem, "WARNING"); + Xorriso_set_problem_status(xorriso, eternal_problem_status_text_mem, 1); + ret= Xorriso_retry_write_session(xorriso, 0); + } Xorriso_process_errfile(xorriso, 0, "burn session end", 0, 1); if(ret<=0) goto ex; diff --git a/libisoburn/trunk/xorriso/parse_exec.c b/libisoburn/trunk/xorriso/parse_exec.c index 2f96c92a..a1bdad6a 100644 --- a/libisoburn/trunk/xorriso/parse_exec.c +++ b/libisoburn/trunk/xorriso/parse_exec.c @@ -197,14 +197,24 @@ ex:; } +/* @param flag bit0= get eternal problem status +*/ int Xorriso_get_problem_status(struct XorrisO *xorriso, char severity[80], int flag) { - strcpy(severity, xorriso->problem_status_text); - return(xorriso->problem_status); + if(flag & 1) { + strcpy(severity, xorriso->eternal_problem_status_text); + return(xorriso->eternal_problem_status); + } else { + strcpy(severity, xorriso->problem_status_text); + return(xorriso->problem_status); + } } +/* @param flag bit0= set eternal problem status to severity, + and set problem status to ALL +*/ int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, int flag) { @@ -237,9 +247,15 @@ int Xorriso_set_problem_status(struct XorrisO *xorriso, char *severity, #endif /* Xorriso_fetch_with_msg_queueS */ - xorriso->problem_status= sev; - strcpy(xorriso->problem_status_text, sev_text); - if(sev > xorriso->eternal_problem_status) { + if(flag & 1) { + strcpy(xorriso->problem_status_text, "ALL"); + Xorriso__text_to_sev(xorriso->problem_status_text, + &(xorriso->problem_status), 0); + } else { + xorriso->problem_status= sev; + strcpy(xorriso->problem_status_text, sev_text); + } + if(sev > xorriso->eternal_problem_status || (flag & 1)) { xorriso->eternal_problem_status= sev; strcpy(xorriso->eternal_problem_status_text, sev_text); } diff --git a/libisoburn/trunk/xorriso/write_run.c b/libisoburn/trunk/xorriso/write_run.c index 78029d0c..d61b3ebe 100644 --- a/libisoburn/trunk/xorriso/write_run.c +++ b/libisoburn/trunk/xorriso/write_run.c @@ -132,8 +132,10 @@ int Xorriso_make_write_options( struct XorrisO *xorriso, struct burn_drive *drive, struct burn_write_opts **burn_options, int flag) { - int drive_role, stream_mode= 0; - + int drive_role, stream_mode= 0, ret, profile; + char profile_name[80]; + enum burn_disc_status s; + *burn_options= burn_write_opts_new(drive); if(*burn_options==NULL) { Xorriso_process_msg_queues(xorriso,0); @@ -145,6 +147,16 @@ int Xorriso_make_write_options( drive_role= burn_drive_get_drive_role(drive); burn_write_opts_set_multi(*burn_options, !(xorriso->do_close || drive_role==0 || drive_role==3)); + + ret= burn_disc_get_profile(drive, &profile, profile_name); + if(ret > 0) { + s= isoburn_disc_get_status(drive); + if(xorriso->auto_close && xorriso->do_close == 0 && + profile == 0x14 && s == BURN_DISC_BLANK) + /* Prepare for missing feature 21h despite drive's announcement */ + burn_write_opts_set_fail21h_sev(*burn_options, "NOTE"); + } + if(xorriso->write_speed != -2) burn_drive_set_speed(drive, 0, xorriso->write_speed); if(xorriso->do_stream_recording == 1) @@ -707,7 +719,31 @@ ex: } +int Xorriso_retry_write_session(struct XorrisO *xorriso, int flag) +{ + int ret, auto_close_mem, do_close_mem; + + if(xorriso->do_tao == 1) { + Xorriso_msgs_submit(xorriso, 0, + "There is no hope for a re-try with -close \"on\" as long as -write_type is \"tao\"", + 0, "FAILURE", 0); + return(0); + } + Xorriso_msgs_submit(xorriso, 0, "Re-trying with -close \"on\"", 0, "NOTE", 0); + do_close_mem= xorriso->do_close; + auto_close_mem= xorriso->auto_close; + xorriso->do_close= 1; + xorriso->auto_close= 0; + ret= Xorriso_write_session(xorriso, 0); + xorriso->do_close= do_close_mem; + xorriso->auto_close= auto_close_mem; + return(ret); +} + + /* @param flag bit0= do not write but only prepare and return size in sectors + @return <=0 error , 1= success + 2= failure with DVD-RW, please call Xorriso_retry_write_session() */ int Xorriso_write_session(struct XorrisO *xorriso, int flag) { @@ -1163,6 +1199,15 @@ fprintf(stderr, "XORRISO_DEBUG: isoburn_igopt_set_tail_blocks(%d)\n", if(!isoburn_drive_wrote_well(drive)) { isoburn_cancel_prepared_write(source_drive, drive, 0); Xorriso_process_msg_queues(xorriso,0); + if(xorriso->auto_close && xorriso->do_close == 0) { + if(burn_drive_was_feat21_failure(drive)) { + sprintf(xorriso->info_text, + "libburn indicates failure with writing DVD-RW to appendable state."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + /* Urge caller to call Xorriso_retry_write_session() */ + ret= 2; goto ex; + } + } sprintf(xorriso->info_text, "libburn indicates failure with writing."); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); @@ -1855,11 +1900,38 @@ int Xorriso_blank_as_needed(struct XorrisO *xorriso, int flag) } +int Xorriso_retry_burn_track(struct XorrisO *xorriso, + off_t write_start_address, + char *track_source, off_t tsize, int flag) +{ + int ret, auto_close_mem, do_close_mem; + + if(xorriso->do_tao == 1) { + Xorriso_msgs_submit(xorriso, 0, + "There is no hope for a re-try with -close \"on\" as long as -write_type is \"tao\"", + 0, "FAILURE", 0); + return(0); + } + Xorriso_msgs_submit(xorriso, 0, "Re-trying with -close \"on\"", 0, "NOTE", 0); + do_close_mem= xorriso->do_close; + auto_close_mem= xorriso->auto_close; + xorriso->do_close= 1; + xorriso->auto_close= 0; + ret= Xorriso_burn_track(xorriso, write_start_address, track_source, tsize, + flag); + xorriso->do_close= do_close_mem; + xorriso->auto_close= auto_close_mem; + return(ret); +} + + /* @param write_start_address is valid if >=0 @param tsize is valid if >0 @param flag bit0= grow_overwriteable_iso bit1= do_isosize bit2= do_xa1 conversion + @return <=0 error , 1= success + 2= failure with DVD-RW, please call Xorriso_retry_burn_track() */ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, char *track_source, off_t tsize, int flag) @@ -2113,6 +2185,15 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, goto ex; if(!burn_drive_wrote_well(drive)) { Xorriso_process_msg_queues(xorriso,0); + if(xorriso->auto_close && xorriso->do_close == 0) { + if(burn_drive_was_feat21_failure(drive)) { + sprintf(xorriso->info_text, + "libburn indicates failure with writing DVD-RW to appendable state."); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); + /* Urge caller to call Xorriso_retry_burn_rack() */ + ret= 2; goto ex; + } + } sprintf(xorriso->info_text, "libburn indicates failure with writing."); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index 69a94847..2d4c45b3 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -9,7 +9,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 XORRISO 1 "Version 1.3.3, Oct 14, 2013" +.TH XORRISO 1 "Version 1.3.3, Oct 27, 2013" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -2778,8 +2778,11 @@ and is one aspect of growisofs option \-dvd\-compat. If set to "off" then keep the medium writable for an appended session. .br If set to "as_needed" then use "on" only if "off" is predicted to -fail with the given medium and its state. But not all drives correctly -recognize fast\-blanked DVD\-RW which need "on". +fail with the given medium and its state. +.br +Not all drives correctly recognize fast\-blanked DVD\-RW which need "on". +If there is well founded suspicion that a burn run failed due to +\-close "off", then \-close "as_needed" causes a re\-try with "on". .br Note that emulation command \-as "cdrecord" temporarily overrides the current setting of \-close by its own default \-close "on" if diff --git a/libisoburn/trunk/xorriso/xorriso.info b/libisoburn/trunk/xorriso/xorriso.info index 5bab4d52..7375517b 100644 --- a/libisoburn/trunk/xorriso/xorriso.info +++ b/libisoburn/trunk/xorriso/xorriso.info @@ -2454,8 +2454,11 @@ according to the setting of command -acl. If set to "off" then keep the medium writable for an appended session. If set to "as_needed" then use "on" only if "off" is predicted to - fail with the given medium and its state. But not all drives - correctly recognize fast-blanked DVD-RW which need "on". + fail with the given medium and its state. + Not all drives correctly recognize fast-blanked DVD-RW which need + "on". If there is well founded suspicion that a burn run failed + due to -close "off", then -close "as_needed" causes a re-try with + "on". Note that emulation command -as "cdrecord" temporarily overrides the current setting of -close by its own default -close "on" if its option -multi is missing. @@ -4976,7 +4979,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -outdev acquires a drive for output: AqDrive. (line 31) * -overwrite enables overwriting in ISO: SetInsert. (line 127) * -pacifier controls pacifier text form: Emulation. (line 163) -* -padding sets amount or mode of image padding: SetWrite. (line 375) +* -padding sets amount or mode of image padding: SetWrite. (line 378) * -page set terminal geometry: DialogCtl. (line 19) * -paste_in copies file into disk file: Restore. (line 124) * -path_list inserts paths from disk file: Insert. (line 79) @@ -5051,7 +5054,7 @@ File: xorriso.info, Node: CommandIdx, Next: ConceptIdx, Prev: Legal, Up: Top * -volid sets volume id: SetWrite. (line 160) * -volset_id sets volume set id: SetWrite. (line 181) * -volume_date sets volume timestamp: SetWrite. (line 208) -* -write_type chooses TAO or SAO/DAO: SetWrite. (line 367) +* -write_type chooses TAO or SAO/DAO: SetWrite. (line 370) * -x enables automatic execution order of arguments: ArgSort. (line 16) * -xattr controls handling of xattr (EA): Loading. (line 176) @@ -5335,12 +5338,12 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Write, free space, -tell_media_space: Inquiry. (line 104) * Write, log problematic disk files, -errfile_log: Scripting. (line 129) * Write, log written sessions, -session_log: Scripting. (line 149) -* Write, padding image, -padding: SetWrite. (line 375) +* Write, padding image, -padding: SetWrite. (line 378) * Write, pending ISO image, -commit: Writing. (line 29) * Write, predict image size, -print_size: Inquiry. (line 91) * Write, set speed, -speed: SetWrite. (line 298) * Write, simulation, -dummy: SetWrite. (line 342) -* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 367) +* Write, TAO or SAO/DAO, -write_type: SetWrite. (line 370) * xattr, _definition: Extras. (line 65) * xattr, control handling, -xattr: Loading. (line 176) * xattr, set in ISO image, -setfattr: Manip. (line 118) @@ -5372,40 +5375,40 @@ Node: CmdFind75955 Node: Filter90997 Node: Writing95553 Node: SetWrite105545 -Node: Bootable125728 -Node: Jigdo142118 -Node: Charset146365 -Node: Exception149127 -Node: DialogCtl155247 -Node: Inquiry157845 -Node: Navigate164162 -Node: Verify172460 -Node: Restore181492 -Node: Emulation188579 -Node: Scripting198881 -Node: Frontend206652 -Node: Examples216259 -Node: ExDevices217437 -Node: ExCreate218096 -Node: ExDialog219381 -Node: ExGrowing220646 -Node: ExModifying221451 -Node: ExBootable221955 -Node: ExCharset222507 -Node: ExPseudo223328 -Node: ExCdrecord224226 -Node: ExMkisofs224543 -Node: ExGrowisofs225883 -Node: ExException227018 -Node: ExTime227472 -Node: ExIncBackup227931 -Node: ExRestore231911 -Node: ExRecovery232844 -Node: Files233414 -Node: Seealso234713 -Node: Bugreport235436 -Node: Legal236017 -Node: CommandIdx237028 -Node: ConceptIdx253690 +Node: Bootable125870 +Node: Jigdo142260 +Node: Charset146507 +Node: Exception149269 +Node: DialogCtl155389 +Node: Inquiry157987 +Node: Navigate164304 +Node: Verify172602 +Node: Restore181634 +Node: Emulation188721 +Node: Scripting199023 +Node: Frontend206794 +Node: Examples216401 +Node: ExDevices217579 +Node: ExCreate218238 +Node: ExDialog219523 +Node: ExGrowing220788 +Node: ExModifying221593 +Node: ExBootable222097 +Node: ExCharset222649 +Node: ExPseudo223470 +Node: ExCdrecord224368 +Node: ExMkisofs224685 +Node: ExGrowisofs226025 +Node: ExException227160 +Node: ExTime227614 +Node: ExIncBackup228073 +Node: ExRestore232053 +Node: ExRecovery232986 +Node: Files233556 +Node: Seealso234855 +Node: Bugreport235578 +Node: Legal236159 +Node: CommandIdx237170 +Node: ConceptIdx253832  End Tag Table diff --git a/libisoburn/trunk/xorriso/xorriso.texi b/libisoburn/trunk/xorriso/xorriso.texi index 77a2e5a6..6e0cf90a 100644 --- a/libisoburn/trunk/xorriso/xorriso.texi +++ b/libisoburn/trunk/xorriso/xorriso.texi @@ -50,7 +50,7 @@ @c man .\" First parameter, NAME, should be all caps @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" other parameters are allowed: see man(7), man(1) -@c man .TH XORRISO 1 "Version 1.3.3, Oct 14, 2013" +@c man .TH XORRISO 1 "Version 1.3.3, Oct 27, 2013" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -3282,8 +3282,11 @@ and is one aspect of growisofs option -dvd-compat. If set to "off" then keep the medium writable for an appended session. @* If set to "as_needed" then use "on" only if "off" is predicted to -fail with the given medium and its state. But not all drives correctly -recognize fast-blanked DVD-RW which need "on". +fail with the given medium and its state. +@* +Not all drives correctly recognize fast-blanked DVD-RW which need "on". +If there is well founded suspicion that a burn run failed due to +-close "off", then -close "as_needed" causes a re-try with "on". @* Note that emulation command -as "cdrecord" temporarily overrides the current setting of -close by its own default -close "on" if diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index e09b9a01..d63911eb 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2013.10.27.115427" +#define Xorriso_timestamP "2013.10.28.150924" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.h b/libisoburn/trunk/xorriso/xorrisoburn.h index a95620ee..388375d1 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.h +++ b/libisoburn/trunk/xorriso/xorrisoburn.h @@ -45,6 +45,8 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag); int Xorriso_write_session(struct XorrisO *xorriso, int flag); +int Xorriso_retry_write_session(struct XorrisO *xorriso, int flag); + /* @param boss_iter Opaque handle to be forwarded to actions in ISO image Set to NULL if calling this function from outside ISO world @param flag bit0= mkdir: graft in as empty directory, not as copy from disk @@ -233,6 +235,10 @@ int Xorriso_atip(struct XorrisO *xorriso, int flag); int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address, char *track_source, off_t tsize, int flag); +int Xorriso_retry_burn_track(struct XorrisO *xorriso, + off_t write_start_address, + char *track_source, off_t tsize, int flag); + /* @param flag bit1= outdev rather than indev @return <=0 = failure , 1= ok , 2= ok, is CD profile */