Implemented a generic verification whether a SPC device is a MMC device
This commit is contained in:
parent
5676a1953d
commit
dd0ceb6720
@ -1 +1 @@
|
||||
#define Cdrskin_timestamP "2014.01.15.174907"
|
||||
#define Cdrskin_timestamP "2014.02.04.112944"
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user