From 0571f4dc2e74bf3a9de93295e5cbedc559c65192 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 23 Aug 2009 13:08:19 +0000 Subject: [PATCH] Adapted to pitfalls of U3 memory sticks which appear as CD-ROM drives --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/drive.c | 9 +++++++-- libburn/mmc.c | 12 +++++++++++- libburn/spc.c | 22 +++++++++++++++++----- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 3e9bad9..5f22650 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.08.15.133744" +#define Cdrskin_timestamP "2009.08.23.130326" diff --git a/libburn/drive.c b/libburn/drive.c index 7a805d6..2a345ae 100644 --- a/libburn/drive.c +++ b/libburn/drive.c @@ -1892,11 +1892,16 @@ int burn_disc_read_atip(struct burn_drive *d) } if(d->drive_role != 1) return 0; - if (d->current_profile == -1 || d->current_is_cd_profile) { + if ((d->current_profile == -1 || d->current_is_cd_profile) + && (d->mdata->cdrw_write || d->current_profile != 0x08)) { d->read_atip(d); /* >>> some control of success would be nice :) */ } else { - /* mmc5r03c.pdf 6.26.3.6.3 : ATIP is undefined for non-CD */; + /* mmc5r03c.pdf 6.26.3.6.3 : ATIP is undefined for non-CD + (and it seems meaningless for non-burners). + ts A90823: Pseudo-CD U3 memory stick stalls with ATIP. + It is !cdrw_write and profile is 0x08. + */ return 0; } return 1; diff --git a/libburn/mmc.c b/libburn/mmc.c index a86341c..0b031a2 100644 --- a/libburn/mmc.c +++ b/libburn/mmc.c @@ -1159,7 +1159,7 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len) struct buffer buf; struct command c; int dlen; - int i, bpl= 12, old_alloc_len, t_idx; + int i, bpl= 12, old_alloc_len, t_idx, ret; unsigned char *tdata; char msg[321]; @@ -1185,6 +1185,16 @@ static int mmc_read_toc_al(struct burn_drive *d, int *alloc_len) d->status = BURN_DISC_FULL; return 1; } + + /* ts A90823: + SanDisk Cruzer U3 memory stick stalls on format 2. + Format 0 seems to be more conservative with read-only drives. + */ + if (!(d->mdata->cdrw_write || d->current_profile != 0x08)) { + ret = mmc_read_toc_fmt0(d); + return ret; + } + scsi_init_command(&c, MMC_GET_TOC, sizeof(MMC_GET_TOC)); /* memcpy(c.opcode, MMC_GET_TOC, sizeof(MMC_GET_TOC)); diff --git a/libburn/spc.c b/libburn/spc.c index eb55093..3eb9fac 100644 --- a/libburn/spc.c +++ b/libburn/spc.c @@ -463,12 +463,24 @@ static int spc_sense_caps_al(struct burn_drive *d, int *alloc_len, int flag) m->min_write_speed, m->max_write_speed); try_mmc_get_performance:; - ret = mmc_get_write_performance(d); - - if (ret > 0 && speed_debug) - fprintf(stderr, + if (m->cdrw_write || page_length >= 32) { + /* ts A90823: + One has to avoid U3 enhanced memory sticks here. On my + SuSE 10.2 a SanDisk Cruzer 4GB stalls at the second occasion + of ACh GET PERFORMANCE. (The first one is obviously called + by the OS at plug time.) + This pseudo drive returns no write capabilities and a page + length of 28. MMC-3 describes page length 32. Regrettably + MMC-2 prescribes a page length of 26. Here i have to trust + m->cdrw_write to reliably indicate any MMC-2 burner. + */ + ret = mmc_get_write_performance(d); + if (ret > 0 && speed_debug) + fprintf(stderr, "LIBBURN_DEBUG: ACh min_write_speed = %d , max_write_speed = %d\n", - m->min_write_speed, m->max_write_speed); + m->min_write_speed, m->max_write_speed); + } + return !was_error; }