diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index fd049834..5703f1cb 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2006.12.24.182410" +#define Cdrskin_timestamP "2006.12.25.113534" diff --git a/libburn/trunk/libburn/drive.c b/libburn/trunk/libburn/drive.c index 2ce8a99d..f8c87bac 100644 --- a/libburn/trunk/libburn/drive.c +++ b/libburn/trunk/libburn/drive.c @@ -226,6 +226,9 @@ int burn_drive_grab(struct burn_drive *d, int le) /* ts A61118 */ d->start_unit(d); + /* ts A61225 : after loading the tray, mode page 2Ah can change */ + d->getcaps(d); + /* ts A61202 : gave bit1 of le a meaning */ sose = d->silent_on_scsi_error; if (!le) diff --git a/libburn/trunk/libburn/libburn.h b/libburn/trunk/libburn/libburn.h index 460d20f1..dd8cc34b 100644 --- a/libburn/trunk/libburn/libburn.h +++ b/libburn/trunk/libburn/libburn.h @@ -1152,7 +1152,9 @@ void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts, void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts, unsigned char hardware_error_retries); -/** Gets the maximum write speed for a drive +/** Gets the maximum write speed for a drive and eventually loaded media. + The return value might change by the media type of already loaded media, + again by call burn_drive_grab() and again by call burn_disc_read_atip(). @param d Drive to query @return Maximum write speed in K/s */ @@ -1160,8 +1162,9 @@ int burn_drive_get_write_speed(struct burn_drive *d); /* ts A61021 */ -/** Gets the minimum write speed for a drive. This might differ from - burn_drive_get_write_speed() only after burn_disc_read_atip() +/** Gets the minimum write speed for a drive and eventually loaded media. + The return value might change by the media type of already loaded media, + again by call burn_drive_grab() and again by call burn_disc_read_atip(). @param d Drive to query @return Minimum write speed in K/s */ diff --git a/libburn/trunk/libburn/spc.c b/libburn/trunk/libburn/spc.c index 25ecc8a2..7f369d4a 100644 --- a/libburn/trunk/libburn/spc.c +++ b/libburn/trunk/libburn/spc.c @@ -132,10 +132,13 @@ void spc_sense_caps(struct burn_drive *d) { struct buffer buf; struct scsi_mode_data *m; - int size; + int size, page_length, num_write_speeds = 0, i, speed; unsigned char *page; struct command c; + /* ts A61225 : 1 = report about post-MMC-1 speed descriptors */ + static int speed_debug = 0; + memcpy(c.opcode, SPC_MODE_SENSE, sizeof(SPC_MODE_SENSE)); c.retry = 1; c.oplen = sizeof(SPC_MODE_SENSE); @@ -150,6 +153,14 @@ void spc_sense_caps(struct burn_drive *d) m = d->mdata; page = c.page->data + 8; + /* ts A61225 : + Although MODE SENSE indeed belongs to SPC, the returned code page + 2Ah is part of MMC-1 to MMC-3. In MMC-1 5.2.3.4. it has 22 bytes, + in MMC-3 6.3.11 there are at least 28 bytes plus a variable length + set of speed descriptors. In MMC-5 E.11 it is declared "legacy". + */ + page_length = page[1]; + m->buffer_size = page[12] * 256 + page[13]; m->dvdram_read = page[2] & 32; m->dvdram_write = page[3] & 32; @@ -162,28 +173,55 @@ void spc_sense_caps(struct burn_drive *d) m->cdr_read = page[2] & 1; m->cdr_write = page[3] & 1; + m->c2_pointers = page[5] & 16; + m->valid = 1; + m->underrun_proof = page[4] & 128; + /* ts A61021 : these fields are marked obsolete in MMC 3 */ m->max_read_speed = page[8] * 256 + page[9]; m->cur_read_speed = page[14] * 256 + page[15]; - /* in MMC-3 : see [30-31] and blocks beginning at [32] */ m->max_write_speed = page[18] * 256 + page[19]; - /* New field to be set by atip */ - m->min_write_speed = m->max_write_speed; - - /* in MMC-3 : [28-29] */ m->cur_write_speed = page[20] * 256 + page[21]; - /* >>> ts A61021 : iterate over all speeds : - data[30-31]: number of speed performance descriptor blocks - data[32-35]: block 0 : [+2-3] speed in kbytes/sec - */ + /* ts A61021 : New field to be set by atip (or following MMC-3 info) */ + m->min_write_speed = m->max_write_speed; + + + /* ts A61225 : end of MMC-1 , begin of MMC-3 */ + if (page_length < 32) /* no write speed descriptors ? */ + return; + + m->cur_write_speed = page[28] * 256 + page[29]; + + if (speed_debug) + fprintf(stderr, "LIBBURN_DEBUG: cur_write_speed = %d\n", + m->cur_write_speed); + + num_write_speeds = page[30] * 256 + page[31]; + m->max_write_speed = m->min_write_speed = m->cur_write_speed; + for (i = 0; i < num_write_speeds; i++) { + speed = page[32 + 4*i + 2] * 256 + page[32 + 4*i + 3]; + + if (speed_debug) + fprintf(stderr, + "LIBBURN_DEBUG: write speed #%d = %d kB/s (rc %d)\n", + i, speed, page[32 + 4*i +1] & 7); + + if (speed > m->max_write_speed) + m->max_write_speed = speed; + if (speed < m->min_write_speed) + m->min_write_speed = speed; + } + + if (speed_debug) + fprintf(stderr, + "LIBBURN_DEBUG: min_write_speed = %d , max_write_speed = %d\n", + m->min_write_speed, m->max_write_speed); - m->c2_pointers = page[5] & 16; - m->valid = 1; - m->underrun_proof = page[4] & 128; } + void spc_sense_error_params(struct burn_drive *d) { struct buffer buf;