Corrected previous bug fix which caused speed descriptors to appear twice

This commit is contained in:
Thomas Schmitt 2013-03-04 23:25:27 +00:00
parent b8b67164b4
commit bfa73dadec
2 changed files with 10 additions and 6 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2013.03.04.211258" #define Cdrskin_timestamP "2013.03.04.232436"

View File

@ -4091,8 +4091,10 @@ ex:;
/* ts A61225 */ /* ts A61225 */
/* @param flag bit0= register speed descriptors
*/
static int mmc_get_write_performance_al(struct burn_drive *d, static int mmc_get_write_performance_al(struct burn_drive *d,
int *alloc_len, int *max_descr) int *alloc_len, int *max_descr, int flag)
{ {
struct buffer *buf = NULL; struct buffer *buf = NULL;
int len, i, b, num_descr, ret, old_alloc_len; int len, i, b, num_descr, ret, old_alloc_len;
@ -4175,7 +4177,7 @@ static int mmc_get_write_performance_al(struct burn_drive *d,
pd = c->page->data; pd = c->page->data;
if (num_descr > *max_descr) if (num_descr > *max_descr)
num_descr = *max_descr; num_descr = *max_descr;
for (i = 0; i < num_descr; i++) { for (i = 0; i < num_descr && !(flag & 1); i++) {
exact_bit = !!(pd[8 + i*16] & 2); exact_bit = !!(pd[8 + i*16] & 2);
end_lba = read_speed = write_speed = 0; end_lba = read_speed = write_speed = 0;
for (b = 0; b < 4 ; b++) { for (b = 0; b < 4 ; b++) {
@ -4252,12 +4254,13 @@ int mmc_get_write_performance(struct burn_drive *d)
/* first command execution to learn number of descriptors and /* first command execution to learn number of descriptors and
dxfer_len dxfer_len
*/ */
ret = mmc_get_write_performance_al(d, &alloc_len, &max_descr); ret = mmc_get_write_performance_al(d, &alloc_len, &max_descr, 0);
if (max_descr > 0 && ret > 0) { if (max_descr > 0 && ret > 0) {
/* Some drives announce only 1 descriptor if asked for 0. /* Some drives announce only 1 descriptor if asked for 0.
So ask twice for non-0 descriptors. So ask twice for non-0 descriptors.
*/ */
ret = mmc_get_write_performance_al(d, &alloc_len, &max_descr); ret = mmc_get_write_performance_al(d, &alloc_len, &max_descr,
0);
} }
/* /*
fprintf(stderr,"LIBBURN_DEBUG: ACh alloc_len = %d , ret = %d\n", fprintf(stderr,"LIBBURN_DEBUG: ACh alloc_len = %d , ret = %d\n",
@ -4266,7 +4269,8 @@ int mmc_get_write_performance(struct burn_drive *d)
if (max_descr > 0 && ret > 0) if (max_descr > 0 && ret > 0)
/* final execution with announced length */ /* final execution with announced length */
max_descr = (alloc_len - 8) / 16; max_descr = (alloc_len - 8) / 16;
ret = mmc_get_write_performance_al(d, &alloc_len, &max_descr); ret = mmc_get_write_performance_al(d, &alloc_len, &max_descr,
1);
return ret; return ret;
} }