From d40ab3236025c6c3ff0b399513fbd4776c5cdfd9 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 10 Feb 2014 21:33:50 +0000 Subject: [PATCH] Being more rugged towards missing MODE SENSE info --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 15 ++++++++++++++- libburn/mmc.c | 7 ------- libburn/spc.c | 20 ++++++++++---------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index be6f862..c6c3f38 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2014.02.07.180650" +#define Cdrskin_timestamP "2014.02.10.213159" diff --git a/libburn/drive.c b/libburn/drive.c index 529ef6b..7a91c82 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */ /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens - Copyright (c) 2006 - 2013 Thomas Schmitt + Copyright (c) 2006 - 2014 Thomas Schmitt Provided under GPL version 2 or later. */ @@ -1221,6 +1221,12 @@ static void strip_spaces(char *str) static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out) { struct burn_scsi_inquiry_data *id; + int i; + /* For faking CD recording capability of unavailable mode page 0x2A */ + static int writer_profiles[] = { + 0x09, 0x0a, 0x11, 0x12, 0x13, 0x14, 0x15, 0x1a, 0x1b, 0x2b, + 0x41, 0x42, 0x43, 0x00 + }; /* ts A61007 : now prevented in enumerate_common() */ #if 0 @@ -1260,6 +1266,13 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out) out->read_dvdrom = out->read_cdr = out->read_cdrw = 0; out->write_dvdram = out->write_dvdr = out->write_cdr = 0; out->write_cdrw = out->write_simulate = out->c2_errors = 0; + /* If the drive reported a writer profile, attribute CD-R */ + for (i = 0; writer_profiles[i] != 0; i++) + if (writer_profiles[i] == d->current_profile) { + out->write_cdr = 1; + break; + } + } out->drive = d; diff --git a/libburn/mmc.c b/libburn/mmc.c index 473e346..39e9e94 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -4637,13 +4637,6 @@ fprintf(stderr, "libburn_EXPERIMENTAL: block_type = %d, pd[4]= %u\n", memcpy(pd + 33, isrc_text, 12); } } - if (d->mdata->write_page_valid <= 0) { - libdax_msgs_submit(libdax_messenger, -1, 0x00000002, - LIBDAX_MSGS_SEV_DEBUG, LIBDAX_MSGS_PRIO_ZERO, - "mmc_compose_mode_page_5: No mode page 05 was read", - 0, 0); - return 0; - } return 1; } diff --git a/libburn/spc.c b/libburn/spc.c index 02c2fbe..1fc78f7 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -431,9 +431,6 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag) if (*alloc_len < 10) {ret = 0; goto ex;} - if (!(flag & 1)) - mmc_get_configuration(d); - BURN_ALLOC_MEM(msg, char, BURN_DRIVE_ADR_LEN + 160); BURN_ALLOC_MEM(buf, struct buffer, 1); BURN_ALLOC_MEM(c, struct command, 1); @@ -646,6 +643,8 @@ void spc_sense_caps(struct burn_drive *d) if (mmc_function_spy(d, "sense_caps") <= 0) return; + mmc_get_configuration(d); + /* first command execution to learn Allocation Length */ alloc_len = start_len; ret = spc_sense_caps_al(d, &alloc_len, 1); @@ -694,7 +693,6 @@ void spc_sense_error_params(struct burn_drive *d) c->page->sectors = 0; c->dir = FROM_DRIVE; d->issue_command(d, c); - m = d->mdata; page = c->page->data + 8; d->params.retries = page[3]; @@ -781,9 +779,11 @@ void spc_sense_write_params(struct burn_drive *d) if (!c->error) { page = c->page->data + 8; m->write_page_length = page[1]; - m->write_page_valid = 1; - } else - m->write_page_valid = 0; + if (m->write_page_length > 0) + m->write_page_valid = 1; + else + m->write_page_length = 0x32; + } mmc_read_disc_info(d); /* ts A70212 : try to setup d->media_capacity_remaining */ @@ -837,8 +837,6 @@ void spc_select_write_params(struct burn_drive *d, struct burn_session *s, o->block_type,spc_block_type(o->block_type)); */ - if (d->mdata->write_page_valid <= 0) - d->mdata->write_page_length = 0; alloc_len = 8 + 2 + d->mdata->write_page_length; memset(&(buf->data), 0, alloc_len); @@ -1094,6 +1092,8 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no, d->mdata->max_write_speed = 0; d->mdata->cur_write_speed = 0; d->mdata->speed_descriptors = NULL; + d->mdata->write_page_length = 0x32; + d->mdata->write_page_valid = 0; if (!(flag & 1)) { ret = spc_setup_drive(d); if (ret<=0) @@ -1733,7 +1733,7 @@ int scsi_log_reply(unsigned char *opcode, int data_dir, unsigned char *data, l = 18; if ((sense[0] & 0x7f) == 0x72 || (sense[0] & 0x7f) == 0x73) - l = sense[7] + 7 + 1; /* SPC-5 4.5.2. */ + l = sense[7] + 7 + 1; /* SPC-3 4.5.2. */ if (l > sense_len) l = sense_len; fprintf(fp, "+++ sense data =");