diff --git a/cdrskin/cdrskin.c b/cdrskin/cdrskin.c index 6222e3c..9abe478 100644 --- a/cdrskin/cdrskin.c +++ b/cdrskin/cdrskin.c @@ -171,6 +171,7 @@ or #define Cdrskin_libburn_has_burn_aborT 1 #define Cdrskin_libburn_has_audioxtR 1 #define Cdrskin_libburn_has_get_start_end_lbA 1 +#define Cdrskin_libburn_has_burn_disc_unsuitablE 1 #endif #ifndef Cdrskin_libburn_versioN @@ -3156,6 +3157,18 @@ int Cdrskin_report_disc_status(struct CdrskiN *skin, enum burn_disc_status s, "BURN_DISC_APPENDABLE \"There is an incomplete disc in the drive\"\n"); } else if(s==BURN_DISC_EMPTY) { printf("BURN_DISC_EMPTY \"There is no disc at all in the drive\"\n"); + } else if(s==BURN_DISC_UNREADY) { + printf("BURN_DISC_UNREADY \"The current status is not yet known\"\n"); + +#ifdef Cdrskin_libburn_has_burn_disc_unsuitablE + + } else if(s==BURN_DISC_UNGRABBED) { + printf("BURN_DISC_UNGRABBED \"API usage error: drive not grabbed\"\n"); + } else if(s==BURN_DISC_UNSUITABLE) { + printf("BURN_DISC_UNSUITABLE \"Media is not suitable\"\n"); + +#endif /* Cdrskin_libburn_has_burn_disc_unsuitablE */ + } else printf("-unknown status code-\n"); return(1); diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 2f7462b..d9f61e8 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2006.10.20.113421" +#define Cdrskin_timestamP "2006.10.20.151602" diff --git a/libburn/drive.c b/libburn/drive.c index 544b2dd..e9aae94 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -45,7 +45,8 @@ void burn_drive_free(struct burn_drive *d) sg_close_drive(d); free((void *) d->idata); free((void *) d->mdata); - free((void *) d->toc_entry); + if(d->toc_entry != NULL) + free((void *) d->toc_entry); free(d->devname); d->global_index = -1; } @@ -162,7 +163,10 @@ int burn_drive_grab(struct burn_drive *d, int le) d->load(d); d->lock(d); - d->status = BURN_DISC_BLANK; + + /* ts A61020 : this was BURN_DISC_BLANK as pure guess */ + d->status = BURN_DISC_UNREADY; + if (d->mdata->cdr_write || d->mdata->cdrw_write || d->mdata->dvdr_write || d->mdata->dvdram_write) { @@ -186,6 +190,8 @@ int burn_drive_grab(struct burn_drive *d, int le) old_erasable = new_erasable; d->read_disc_info(d); + if(d->status == BURN_DISC_UNSUITABLE) + break; new_speed = burn_drive_get_write_speed(d); new_erasable = burn_disc_erasable(d); @@ -309,7 +315,7 @@ void burn_drive_release(struct burn_drive *d, int le) d->status = BURN_DISC_UNREADY; d->released = 1; - if (d->toc_entry) + if (d->toc_entry != NULL) free(d->toc_entry); d->toc_entry = NULL; d->toc_entries = 0; @@ -1118,3 +1124,15 @@ int burn_drive_get_start_end_lba(struct burn_drive *d, *end_lba= d->end_lba; return 1; } + + +/* ts A61020 API function */ +int burn_disc_pretend_blank(struct burn_drive *d) +{ + if (d->status != BURN_DISC_UNREADY && + d->status != BURN_DISC_UNSUITABLE) + return 0; + d->status = BURN_DISC_BLANK; + return 1; +} + diff --git a/libburn/libburn.h b/libburn/libburn.h index 2a5e3a9..4a4ec1f 100644 --- a/libburn/libburn.h +++ b/libburn/libburn.h @@ -176,7 +176,11 @@ enum burn_disc_status /* ts A61007 */ /** The drive was not grabbed when the status was inquired */ - BURN_DISC_UNGRABBED + BURN_DISC_UNGRABBED, + + /* ts A61020 */ + /** The media seems not to be suitable for burning */ + BURN_DISC_UNSUITABLE }; @@ -628,6 +632,16 @@ void burn_drive_release(struct burn_drive *drive, int eject); enum burn_disc_status burn_disc_get_status(struct burn_drive *drive); +/* ts A61020 */ +/** WARNING: This revives an old bug-like behavior that might be dangerous. + Sets the drive status to BURN_DISC_BLANK if it is BURN_DISC_UNREADY + or BURN_DISC_UNSUITABLE. Thus marking media as writable which actually + failed to declare themselves either blank or (partially) filled. + @return 1 drive status has been set , 0 = unsuitable drive status +*/ +int burn_disc_pretend_blank(struct burn_drive *d); + + /* ts A61020 */ /** Returns start and end lba of the media which is currently inserted in the given drive. The drive has to be grabbed to have hope for reply. diff --git a/libburn/libdax_msgs.h b/libburn/libdax_msgs.h index 6052848..3a4da4e 100644 --- a/libburn/libdax_msgs.h +++ b/libburn/libdax_msgs.h @@ -318,7 +318,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff 0x0002010a (FATAL,HIGH) = Unsuitable track mode 0x0002010b (FATAL,HIGH) = Burn run failed 0x0002010c (FATAL,HIGH) = Failed to transfer command to drive - 0x0002010d + 0x0002010d (DEBUG,HIGH) = Could not inquire TOC 0x0002010e 0x0002010f 0x00020110 (FATAL,HIGH) = Persistent drive address too long diff --git a/libburn/mmc.c b/libburn/mmc.c index a229699..b7dec26 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -286,7 +286,23 @@ void mmc_read_toc(struct burn_drive *d) d->issue_command(d, &c); if (c.error) { + + /* ts A61020 : this snaps on non-blank DVD media */ + /* Very unsure wether this old measure is ok. + Obviously higher levels do not care about this. + DVD+RW burns go on after passing through here. + d->busy = BURN_DRIVE_IDLE; + */ + libdax_msgs_submit(libdax_messenger, d->global_index, + 0x0002010d, + LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_HIGH, + "Could not inquire TOC (non-blank DVD media ?)", 0,0); + d->status = BURN_DISC_UNSUITABLE; + d->toc_entries = 0; + /* Prefering memory leaks over fandangos */ + d->toc_entry = malloc(sizeof(struct burn_toc_entry)); + return; }