From 18438856c801719eeb1a77fbf3905292831114a8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 6 Sep 2009 11:27:47 +0000 Subject: [PATCH] Reporting "Media product:" with xorriso option -toc --- xorriso/xorriso_timestamp.h | 2 +- xorriso/xorrisoburn.c | 57 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index f63a0936..e9d73781 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.09.06.094209" +#define Xorriso_timestamP "2009.09.06.112851" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index 8d938096..cdcad2bb 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -5150,12 +5150,63 @@ no_boot:; } +/* @param flag + bit1=report about output drive + bit3=report to info channel (else to result channel) + bit4=do no report failure if no drive aquired +*/ +int Xorriso_media_product(struct XorrisO *xorriso, int flag) +{ + int ret, profile_no; + struct burn_drive_info *dinfo; + struct burn_drive *drive; + char *product_id= NULL, *media_code1= NULL, *media_code2= NULL; + char *book_type= NULL, *manuf= NULL, profile_name[80], *respt; + + respt= xorriso->result_line; + + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print media product info", + flag & (2 | 16)); + if(ret <= 0) + return(ret); + ret= burn_disc_get_media_id(drive, &product_id, &media_code1, &media_code2, + &book_type, 0); + if(ret > 0) { + ret= burn_disc_get_profile(drive, &profile_no, profile_name); + if(ret <= 0) + return(ret); + sprintf(respt, "Media product: %s , ", product_id); + manuf= burn_guess_manufacturer(profile_no, media_code1, media_code2, 0); + if(manuf != NULL) { + if(strncmp(manuf, "Unknown ", 8) == 0) + sprintf(respt + strlen(respt), "(not found in manufacturer list)\n"); + else + sprintf(respt + strlen(respt), "%s\n", manuf); + } else + sprintf(respt + strlen(respt), "(error during manufacturer lookup)\n"); + free(product_id); + free(media_code1); + free(media_code2); + if(book_type != NULL) + free(book_type); + if(manuf != NULL) + free(manuf); + Xorriso_toc_line(xorriso, flag & 8); + } + Xorriso_process_msg_queues(xorriso,0); + + return(1); +} + + /* @param flag bit0=short report form bit1=report about output drive bit2=do not try to read ISO heads bit3=report to info channel (else to result channel) bit4=do no report failure if no drive aquired bit5=only report "Drive current" and "Drive type" + bit6=report "Media product" with bit0 */ int Xorriso_toc(struct XorrisO *xorriso, int flag) { @@ -5224,6 +5275,12 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag) sprintf(respt+strlen(respt), "is not recognizable\n"); Xorriso_toc_line(xorriso, flag & 8); + if((flag & 64) || !(flag & 1)) { + Xorriso_media_product(xorriso, flag & (2 | 8 | 16)); + if(xorriso->request_to_abort) + return(1); + } + sprintf(respt, "Media status : "); if (s == BURN_DISC_FULL) { sprintf(respt+strlen(respt), "is written , is closed\n");