Prepared for possible demise of mode page 2A
This commit is contained in:
parent
cdbbcbb923
commit
6e4d1cc53e
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2014.02.05.185801"
|
||||
#define Cdrskin_timestamP "2014.02.05.191839"
|
||||
|
@ -643,7 +643,6 @@ void burn_disc_write(struct burn_write_opts *opts, struct burn_disc *disc)
|
||||
if (d->drive_role == 1) {
|
||||
mvalid = 0;
|
||||
if (d->mdata != NULL)
|
||||
if (d->mdata->valid > 0)
|
||||
mvalid = 1;
|
||||
if (!mvalid) {
|
||||
libdax_msgs_submit(libdax_messenger,
|
||||
|
@ -263,8 +263,9 @@ int burn_drive_inquire_media(struct burn_drive *d)
|
||||
|
||||
/* ts A71128 : run read_disc_info() for any recognizeable profile */
|
||||
if (d->current_profile > 0 || d->current_is_guessed_profile ||
|
||||
d->mdata->cdr_write || d->mdata->cdrw_write ||
|
||||
d->mdata->dvdr_write || d->mdata->dvdram_write) {
|
||||
(d->mdata->p2a_valid > 0 &&
|
||||
(d->mdata->cdr_write || d->mdata->cdrw_write ||
|
||||
d->mdata->dvdr_write || d->mdata->dvdram_write)) ) {
|
||||
|
||||
#define Libburn_knows_correct_state_after_loaD 1
|
||||
#ifdef Libburn_knows_correct_state_after_loaD
|
||||
@ -647,7 +648,7 @@ struct burn_drive *burn_drive_finish_enum(struct burn_drive *d)
|
||||
t->released = 1;
|
||||
} else {
|
||||
/* ts A90602 */
|
||||
d->mdata->valid = -1;
|
||||
d->mdata->p2a_valid = -1;
|
||||
sprintf(msg, "Unable to grab scanned drive %s", d->devname);
|
||||
libdax_msgs_submit(libdax_messenger, d->global_index,
|
||||
0x0002016f, LIBDAX_MSGS_SEV_DEBUG,
|
||||
@ -1227,7 +1228,7 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
|
||||
a ssert(d->mdata);
|
||||
#endif
|
||||
|
||||
if(d->idata->valid <= 0 || d->mdata->valid <= 0)
|
||||
if(d->idata->valid <= 0)
|
||||
return 0;
|
||||
|
||||
id = (struct burn_scsi_inquiry_data *)d->idata;
|
||||
@ -1240,6 +1241,8 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
|
||||
strip_spaces(out->revision);
|
||||
strncpy(out->location, d->devname, 16);
|
||||
out->location[16] = '\0';
|
||||
|
||||
if (d->mdata->p2a_valid > 0) {
|
||||
out->buffer_size = d->mdata->buffer_size;
|
||||
out->read_dvdram = !!d->mdata->dvdram_read;
|
||||
out->read_dvdr = !!d->mdata->dvdr_read;
|
||||
@ -1252,6 +1255,13 @@ static int drive_getcaps(struct burn_drive *d, struct burn_drive_info *out)
|
||||
out->write_cdrw = !!d->mdata->cdrw_write;
|
||||
out->write_simulate = !!d->mdata->simulate;
|
||||
out->c2_errors = !!d->mdata->c2_pointers;
|
||||
} else {
|
||||
out->buffer_size = out->read_dvdram = out->read_dvdr = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
out->drive = d;
|
||||
|
||||
#ifdef Libburn_dummy_probe_write_modeS
|
||||
@ -1570,23 +1580,17 @@ void burn_sectors_to_msf(int sectors, int *m, int *s, int *f)
|
||||
|
||||
int burn_drive_get_read_speed(struct burn_drive *d)
|
||||
{
|
||||
if(d->mdata->valid <= 0)
|
||||
return 0;
|
||||
return d->mdata->max_read_speed;
|
||||
}
|
||||
|
||||
int burn_drive_get_write_speed(struct burn_drive *d)
|
||||
{
|
||||
if(d->mdata->valid <= 0)
|
||||
return 0;
|
||||
return d->mdata->max_write_speed;
|
||||
}
|
||||
|
||||
/* ts A61021 : New API function */
|
||||
int burn_drive_get_min_write_speed(struct burn_drive *d)
|
||||
{
|
||||
if(d->mdata->valid <= 0)
|
||||
return 0;
|
||||
return d->mdata->min_write_speed;
|
||||
}
|
||||
|
||||
@ -2525,7 +2529,8 @@ int burn_disc_read_atip(struct burn_drive *d)
|
||||
if(d->drive_role != 1)
|
||||
return 0;
|
||||
if ((d->current_profile == -1 || d->current_is_cd_profile)
|
||||
&& (d->mdata->cdrw_write || d->current_profile != 0x08)) {
|
||||
&& ((d->mdata->p2a_valid > 0 && d->mdata->cdrw_write) ||
|
||||
d->current_profile != 0x08)) {
|
||||
d->read_atip(d);
|
||||
/* >>> some control of success would be nice :) */
|
||||
} else {
|
||||
@ -2754,8 +2759,6 @@ int burn_speed_descriptor_copy(struct burn_speed_descriptor *from,
|
||||
/* ts A61226 : free dynamically allocated sub data of struct scsi_mode_data */
|
||||
int burn_mdata_free_subs(struct scsi_mode_data *m)
|
||||
{
|
||||
if(!m->valid)
|
||||
return 0;
|
||||
burn_speed_descriptor_destroy(&(m->speed_descriptors), 1);
|
||||
return 1;
|
||||
}
|
||||
@ -2769,8 +2772,6 @@ int burn_drive_get_speedlist(struct burn_drive *d,
|
||||
struct burn_speed_descriptor *sd, *csd = NULL;
|
||||
|
||||
(*speed_list) = NULL;
|
||||
if(d->mdata->valid <= 0)
|
||||
return 0;
|
||||
for (sd = d->mdata->speed_descriptors; sd != NULL; sd = sd->next) {
|
||||
ret = burn_speed_descriptor_new(&csd, NULL, csd, 0);
|
||||
if (ret <= 0)
|
||||
@ -2794,8 +2795,6 @@ int burn_drive_get_best_speed(struct burn_drive *d, int speed_goal,
|
||||
if (speed_goal < 0)
|
||||
best_speed = 2000000000;
|
||||
*best_descr = NULL;
|
||||
if(d->mdata->valid <= 0)
|
||||
return 0;
|
||||
for (sd = d->mdata->speed_descriptors; sd != NULL; sd = sd->next) {
|
||||
if (flag & 1)
|
||||
speed = sd->read_speed;
|
||||
@ -2939,7 +2938,8 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
|
||||
o->multi_session = o->multi_track = 0;
|
||||
else if(wt == BURN_WRITE_NONE || wt == BURN_WRITE_SAO ||
|
||||
wt == BURN_WRITE_TAO)
|
||||
o->might_simulate = !!d->mdata->simulate;
|
||||
o->might_simulate = !!(d->mdata->p2a_valid > 0 &&
|
||||
d->mdata->simulate);
|
||||
} else if (d->current_profile == 0x11 || d->current_profile == 0x14 ||
|
||||
d->current_profile == 0x15) {
|
||||
/* DVD-R , sequential DVD-RW , DVD-R/DL Sequential */
|
||||
|
@ -594,6 +594,11 @@ struct burn_drive_info
|
||||
to inquire a device file address. ^^^^^ ALWAYS ^^^^^^^*/
|
||||
char location[17];
|
||||
|
||||
/* DEPRECATION:
|
||||
Start of information from mode page 2Ah which is declared
|
||||
obsolete by MMC-5. Do not rely on this, if you can get a
|
||||
meaningful reply from burn_drive_get_all_profiles()
|
||||
*/
|
||||
/** Can the drive read DVD-RAM discs */
|
||||
unsigned int read_dvdram:1;
|
||||
/** Can the drive read DVD-R discs */
|
||||
@ -622,6 +627,9 @@ struct burn_drive_info
|
||||
|
||||
/** The size of the drive's buffer (in kilobytes) */
|
||||
int buffer_size;
|
||||
|
||||
/* End of DEPRECATION */
|
||||
|
||||
/**
|
||||
* The supported block types in tao mode.
|
||||
* They should be tested with the desired block type.
|
||||
|
@ -1523,7 +1523,8 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len)
|
||||
SanDisk Cruzer U3 memory stick stalls on format 2.
|
||||
Format 0 seems to be more conservative with read-only drives.
|
||||
*/
|
||||
if (!(d->mdata->cdrw_write || d->current_profile != 0x08)) {
|
||||
if (!((d->mdata->p2a_valid > 0 && d->mdata->cdrw_write) ||
|
||||
d->current_profile != 0x08)) {
|
||||
ret = mmc_read_toc_fmt0(d);
|
||||
goto ex;
|
||||
}
|
||||
@ -4636,6 +4637,13 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,8 @@ struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive)
|
||||
opts->toc_entry = NULL;
|
||||
opts->toc_entries = 0;
|
||||
opts->simulate = 0;
|
||||
opts->underrun_proof = drive->mdata->underrun_proof;
|
||||
opts->underrun_proof = drive->mdata->p2a_valid > 0 &&
|
||||
drive->mdata->underrun_proof;
|
||||
opts->perform_opc = 1;
|
||||
opts->obs = -1;
|
||||
|
||||
@ -172,17 +173,6 @@ void burn_write_opts_set_format(struct burn_write_opts *opts, int format)
|
||||
|
||||
int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim)
|
||||
{
|
||||
/* <<< ts A70529 :
|
||||
One cannot predict the ability to simulate from page 05h
|
||||
information alone. This check is now done later in
|
||||
function burn_write_opts_auto_write_type().
|
||||
|
||||
if (opts->drive->mdata->simulate) {
|
||||
opts->simulate = sim;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
*/
|
||||
opts->simulate = !!sim;
|
||||
return 1;
|
||||
}
|
||||
@ -190,9 +180,8 @@ int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim)
|
||||
int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts,
|
||||
int underrun_proof)
|
||||
{
|
||||
if (opts->drive->mdata->valid <= 0)
|
||||
return 0;
|
||||
if (opts->drive->mdata->underrun_proof) {
|
||||
if (opts->drive->mdata->p2a_valid <= 0 ||
|
||||
opts->drive->mdata->underrun_proof) {
|
||||
opts->underrun_proof = underrun_proof;
|
||||
return 1;
|
||||
}
|
||||
|
@ -492,13 +492,13 @@ static void enumerate_common(char *fname, int bus_no, int host_no,
|
||||
out.idata = calloc(1, sizeof(struct burn_scsi_inquiry_data));
|
||||
out.idata->valid = 0;
|
||||
out.mdata = calloc(1, sizeof(struct scsi_mode_data));
|
||||
out.mdata->valid = 0;
|
||||
if (out.idata == NULL || out.mdata == NULL) {
|
||||
libdax_msgs_submit(libdax_messenger, -1, 0x00020108,
|
||||
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
|
||||
"Could not allocate new drive object", 0, 0);
|
||||
return;
|
||||
}
|
||||
out.mdata->p2a_valid = 0;
|
||||
memset(&out.params, 0, sizeof(struct params));
|
||||
t = burn_drive_register(&out);
|
||||
|
||||
|
@ -440,7 +440,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
|
||||
|
||||
/* ts A90602 : Clearing mdata before command execution */
|
||||
m = d->mdata;
|
||||
m->valid = 0;
|
||||
m->p2a_valid = 0;
|
||||
burn_mdata_free_subs(m);
|
||||
|
||||
memset(buf, 0, sizeof(struct buffer));
|
||||
@ -457,7 +457,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
|
||||
d->issue_command(d, c);
|
||||
if (c->error) {
|
||||
memset(buf, 0, sizeof(struct buffer));
|
||||
m->valid = -1;
|
||||
m->p2a_valid = -1;
|
||||
was_error = 1;
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
|
||||
|
||||
if (block_descr_len + 8 + 2 > *alloc_len) {
|
||||
if (block_descr_len + 8 + 2 > BUFFER_SIZE || !(flag & 1)) {
|
||||
m->valid = -1;
|
||||
m->p2a_valid = -1;
|
||||
sprintf(msg,
|
||||
"MODE SENSE page 2A with oversized Block Descriptors: %s : %d",
|
||||
d->devname, block_descr_len);
|
||||
@ -476,6 +476,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
|
||||
0x0002016e, LIBDAX_MSGS_SEV_DEBUG,
|
||||
LIBDAX_MSGS_PRIO_LOW, msg, 0, 0);
|
||||
{ret = 0; goto ex;}
|
||||
|
||||
}
|
||||
*alloc_len = block_descr_len + 10;
|
||||
{ret = 2; goto ex;}
|
||||
@ -508,7 +509,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
|
||||
/* ts A90602 : page_length N asserts page[N+1]. (see SPC-1 8.3.3) */
|
||||
/* ts B11031 : qemu drive has a page_length of 18 */
|
||||
if (page_length < 18) {
|
||||
m->valid = -1;
|
||||
m->p2a_valid = -1;
|
||||
sprintf(msg, "MODE SENSE page 2A too short: %s : %d",
|
||||
d->devname, page_length);
|
||||
libdax_msgs_submit(libdax_messenger, d->global_index,
|
||||
@ -550,7 +551,7 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag)
|
||||
m->max_end_lba = 0;
|
||||
|
||||
if (!was_error)
|
||||
m->valid = 1;
|
||||
m->p2a_valid = 1;
|
||||
|
||||
/* ts A61225 : end of MMC-1 , begin of MMC-3 */
|
||||
if (page_length < 30) /* no write speed descriptors ? */
|
||||
@ -719,6 +720,8 @@ void spc_select_error_params(struct burn_drive *d,
|
||||
|
||||
scsi_init_command(c, SPC_MODE_SELECT, sizeof(SPC_MODE_SELECT));
|
||||
c->retry = 1;
|
||||
if (d->mdata->retry_page_valid <= 0)
|
||||
d->mdata->retry_page_length = 0;
|
||||
c->opcode[8] = 8 + 2 + d->mdata->retry_page_length;
|
||||
c->page = buf;
|
||||
c->page->bytes = 0;
|
||||
@ -834,6 +837,8 @@ 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);
|
||||
|
||||
@ -1083,7 +1088,11 @@ int burn_scsi_setup_drive(struct burn_drive *d, int bus_no, int host_no,
|
||||
return -1;
|
||||
}
|
||||
d->idata->valid = 0;
|
||||
d->mdata->valid = 0;
|
||||
d->mdata->p2a_valid = 0;
|
||||
d->mdata->max_read_speed = 0;
|
||||
d->mdata->cur_read_speed = 0;
|
||||
d->mdata->max_write_speed = 0;
|
||||
d->mdata->cur_write_speed = 0;
|
||||
d->mdata->speed_descriptors = NULL;
|
||||
if (!(flag & 1)) {
|
||||
ret = spc_setup_drive(d);
|
||||
|
@ -89,6 +89,7 @@ struct burn_scsi_inquiry_data
|
||||
|
||||
struct scsi_mode_data
|
||||
{
|
||||
int p2a_valid;
|
||||
int buffer_size;
|
||||
int dvdram_read;
|
||||
int dvdram_write;
|
||||
@ -100,8 +101,13 @@ struct scsi_mode_data
|
||||
int cdr_read;
|
||||
int cdr_write;
|
||||
int simulate;
|
||||
int c2_pointers;
|
||||
int underrun_proof;
|
||||
|
||||
int max_read_speed;
|
||||
int cur_read_speed;
|
||||
int max_write_speed;
|
||||
int cur_write_speed;
|
||||
|
||||
/* ts A61021 */
|
||||
int min_write_speed;
|
||||
@ -112,15 +118,10 @@ struct scsi_mode_data
|
||||
int max_end_lba;
|
||||
struct burn_speed_descriptor *speed_descriptors;
|
||||
|
||||
int cur_read_speed;
|
||||
int cur_write_speed;
|
||||
int retry_page_length;
|
||||
int retry_page_valid;
|
||||
int write_page_length;
|
||||
int write_page_valid;
|
||||
int c2_pointers;
|
||||
int valid;
|
||||
int underrun_proof;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user