Ticket 21: media type via 46h GET CONFIGURATION , Current Profile

This commit is contained in:
Thomas Schmitt 2006-12-01 21:38:34 +00:00
parent 6869e12e4d
commit ad2c080145
4 changed files with 84 additions and 13 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2006.11.29.205136"
#define Cdrskin_timestamP "2006.12.01.213845"

View File

@ -335,6 +335,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x0002011b (FATAL,HIGH) = Attempt to read track info from ungrabbed drive
0x0002011c (FATAL,HIGH) = Attempt to read track info from busy drive
0x0002011d (FATAL,HIGH) = SCSI error condition on write
0x0002011e (SORRY, HIGH) = Unsuitable media detected
libdax_audioxtr:
0x00020200 (SORRY,HIGH) = Cannot open audio source file

View File

@ -47,8 +47,11 @@ static unsigned char MMC_SET_SPEED[] =
static unsigned char MMC_WRITE_12[] =
{ 0xAA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static unsigned char MMC_WRITE_10[] = { 0x2A, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
/* ts A61201 : inserted 0, before 16, */
static unsigned char MMC_GET_CONFIGURATION[] =
{ 0x46, 0, 0, 0, 0, 0, 16, 0, 0 };
{ 0x46, 0, 0, 0, 0, 0, 0, 16, 0, 0 };
static unsigned char MMC_SYNC_CACHE[] = { 0x35, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static unsigned char MMC_GET_EVENT[] = { 0x4A, 1, 0, 0, 16, 0, 0, 0, 8, 0 };
static unsigned char MMC_CLOSE[] = { 0x5B, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@ -461,6 +464,23 @@ void mmc_read_disc_info(struct burn_drive *d)
struct buffer buf;
unsigned char *data;
struct command c;
char msg[160];
/* ts A61020 */
d->start_lba = d->end_lba = -2000000000;
d->erasable = 0;
mmc_get_configuration(d);
if (! d->current_is_cd_profile) {
sprintf(msg, "Unsuitable media detected. Profile 0x%2.2X %s",
d->current_profile, d->current_profile_text);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002011e,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
d->status = BURN_DISC_UNSUITABLE;
return;
}
mmc_function_spy("mmc_read_disc_info");
memcpy(c.opcode, MMC_GET_DISC_INFO, sizeof(MMC_GET_DISC_INFO));
@ -480,9 +500,6 @@ void mmc_read_disc_info(struct burn_drive *d)
data = c.page->data;
d->erasable = !!(data[2] & 16);
/* ts A61020 */
d->start_lba = d->end_lba = -2000000000;
/*
fprintf(stderr, "libburn_experimental: data[2]= %d 0x%x\n",
(unsigned) data[2], (unsigned) data[2]);
@ -804,11 +821,46 @@ void mmc_set_speed(struct burn_drive *d, int r, int w)
d->issue_command(d, &c);
}
/* A61201 : found in unfunctional state */
void mmc_get_configuration(struct burn_drive *d)
{
struct buffer buf;
int len;
int len, i, cp;
struct command c;
char msg[160];
static char *texts[256] = {NULL};
if (texts[0] == NULL) {
for (i = 0; i<256; i++)
texts[i] = "";
/* mmc5r03c.pdf , Table 89 */
texts[0x08] = "CD-ROM";
texts[0x09] = "CD-R";
texts[0x0a] = "CD-RW";
texts[0x10] = "DVD-ROM";
texts[0x11] = "DVD-R Sequential";
texts[0x12] = "DVD-RAM";
texts[0x13] = "DVD-RW Restricted Overwrite";
texts[0x14] = "DVD-RW Sequential";
texts[0x15] = "DVD-R DL Sequential";
texts[0x16] = "DVD-R DL Jump";
texts[0x1a] = "DVD+RW";
texts[0x1b] = "DVD+R";
texts[0x2a] = "DVD+RW DL";
texts[0x2b] = "DVD+R DL";
texts[0x40] = "BD-ROM";
texts[0x41] = "BD-R SRM Sequential";
texts[0x42] = "BD-R RRM Random";
texts[0x43] = "BD-RE";
texts[0x50] = "HD DVD-ROM";
texts[0x51] = "HD DVD-R";
texts[0x52] = "HD DVD-RAM";
}
d->current_profile = 0;
d->current_profile_text[0] = 0;
d->current_is_cd_profile = 0;
mmc_function_spy("mmc_get_configuration");
memcpy(c.opcode, MMC_GET_CONFIGURATION, sizeof(MMC_GET_CONFIGURATION));
@ -820,15 +872,21 @@ void mmc_get_configuration(struct burn_drive *d)
c.dir = FROM_DRIVE;
d->issue_command(d, &c);
burn_print(1, "got it back\n");
if (c.error)
return;
len = (c.page->data[0] << 24)
+ (c.page->data[1] << 16)
+ (c.page->data[2] << 8)
+ c.page->data[3];
burn_print(1, "all %d bytes of it\n", len);
burn_print(1, "%d, %d, %d, %d\n",
c.page->data[0],
c.page->data[1], c.page->data[2], c.page->data[3]);
if (len<8)
return;
cp = (c.page->data[6]<<8) | c.page->data[7];
d->current_profile = cp;
if (cp < 256)
strcpy(d->current_profile_text, texts[cp]);
if (cp == 0x08 || cp == 0x09 || cp == 0x0a)
d->current_is_cd_profile = 1;
}
void mmc_sync_cache(struct burn_drive *d)
@ -906,8 +964,14 @@ int mmc_setup_drive(struct burn_drive *d)
d->read_buffer_capacity = mmc_read_buffer_capacity;
/* ts A61020 */
d->start_lba= -2000000000;
d->end_lba= -2000000000;
d->start_lba = -2000000000;
d->end_lba = -2000000000;
/* ts A61201 */
d->erasable = 0;
d->current_profile = 0;
d->current_profile_text[0] = 0;
d->current_is_cd_profile = 0;
return 1;
}

View File

@ -119,6 +119,12 @@ struct burn_drive
enum burn_disc_status status;
int erasable;
/* ts A61201 from 46h GET CONFIGURATION */
int current_profile;
char current_profile_text[80];
int current_is_cd_profile;
volatile int released;
/* ts A61106 */