Implemented a generic verification whether a SPC device is a MMC device

This commit is contained in:
Thomas Schmitt 2014-02-04 11:31:12 +00:00
parent c77a99424e
commit d7806a0b85
4 changed files with 49 additions and 2 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2014.01.15.174907"
#define Cdrskin_timestamP "2014.02.04.112944"

View File

@ -352,6 +352,8 @@ void spc_inquiry(struct burn_drive *d)
c->dir = FROM_DRIVE;
d->issue_command(d, c);
id = (struct burn_scsi_inquiry_data *)d->idata;
id->peripheral = 0x7f; /* SPC-3: incabable undefined peripheral type */
id->version = 0; /* SPC-3: no claim for conformance */
memset(id->vendor, 0, 9);
memset(id->product, 0, 17);
memset(id->revision, 0, 5);
@ -359,6 +361,8 @@ void spc_inquiry(struct burn_drive *d)
id->valid = -1;
goto ex;
}
id->peripheral = ((char *) c->page->data)[0];
id->version = ((char *) c->page->data)[2];
memcpy(id->vendor, c->page->data + 8, 8);
memcpy(id->product, c->page->data + 16, 16);
memcpy(id->revision, c->page->data + 32, 4);
@ -1840,3 +1844,34 @@ ex:;
BURN_FREE_MEM(msg);
return done;
}
int spc_confirm_cd_drive(struct burn_drive *d, int flag)
{
char *msg = NULL;
int ret;
BURN_ALLOC_MEM(msg, char, strlen(d->devname) + 1024);
spc_inquiry(d);
if (d->idata->valid < 0) {
sprintf(msg, "INQUIRY failed with drive '%s'", d->devname);
libdax_msgs_submit(libdax_messenger, -1, 0x0002000a,
LIBDAX_MSGS_SEV_FAILURE,
LIBDAX_MSGS_PRIO_HIGH, msg, 0,0);
ret = 0; goto ex;
}
if (d->idata->peripheral != 0x5) {
sprintf(msg, "Does not identify itself as CD-ROM drive '%s'",
d->devname);
libdax_msgs_submit(libdax_messenger, -1, 0x0002000a,
LIBDAX_MSGS_SEV_FAILURE,
LIBDAX_MSGS_PRIO_HIGH, msg, 0,0);
ret = 0; goto ex;
}
ret = 1;
ex:;
BURN_FREE_MEM(msg);
return ret;
}

View File

@ -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 <scdbackup@gmx.net>
Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
@ -116,6 +116,11 @@ int scsi_eval_cmd_outcome(struct burn_drive *d, struct command *c, void *fp_in,
time_t start_time, int timeout_ms,
int loop_count, int flag);
/* ts B40204 */
/* Verify by INQUIRY that the drive is indeed a MMC device.
*/
int spc_confirm_cd_drive(struct burn_drive *d, int flag);
/* The waiting time before eventually retrying a failed SCSI command.
Before each retry wait Libburn_scsi_retry_incR longer than with

View File

@ -73,9 +73,16 @@ struct command
struct burn_scsi_inquiry_data
{
char peripheral; /* bit0-4: device type should be 5
bit5-7: qualifier must be 0 */
char version; /* should be 3 (SPC-1) to 5 (SPC-3) (or higher ?)
but is often 0. */
char vendor[9];
char product[17];
char revision[5];
int valid;
};