this is radar bug: 3783502
if you set formatAsTime to 1, you get an error 5 (dsChkErr), so that's clearly not an option
i filed this bug back in 2004, and it is still open.
i work around it by doing my darndest to detect BCD and correct it before i return from my call.
if i can't prove i've detected it, then i fall back on reading the ".TOC.plist" file, which sucks IMHO
if you need help or want code let me know
-dave
karaoke for the rest of us:
On Jan 4, 2008, at 10:35 AM, Chris Sarcone wrote: Stephen --
Have you tried setting the MSF bit to 1 by setting cd_read_toc.formatAsTime = 1?
-- Chris
On Jan 3, 2008, at 7:56 PM, Stephen F. Booth wrote: One of my users reported a bug when accessing some of his CDs from an external CD drive. After some debugging, it appears to me that the CDTOC returned from the external drive contains BCD-encoded numbers. My code which reads the TOC looks like:
dk_cd_read_toc_t cd_read_toc; uint8_t buffer [2048];
bzero(&cd_read_toc, sizeof(cd_read_toc)); bzero(buffer, sizeof(buffer)); cd_read_toc.format = kCDTOCFormatTOC; cd_read_toc.buffer = buffer; cd_read_toc.bufferLength = sizeof(buffer); result = ioctl([self fileDescriptor], DKIOCCDREADTOC, &cd_read_toc);
I inserted some debugging statements to print out the result. For the same disc, here is what the user saw in each of his drives:
External Plextor:
2008-01-03 20:40:29.544 Max[3025:10b] TOC parsing complete 2008-01-03 20:40:29.545 Max[3025:10b] ==================== 2008-01-03 20:40:29.546 Max[3025:10b] First session : 1 2008-01-03 20:40:29.547 Max[3025:10b] Last session : 1 2008-01-03 20:40:29.548 Max[3025:10b] Session number : 1 2008-01-03 20:40:29.548 Max[3025:10b] First track : 1 2008-01-03 20:40:29.549 Max[3025:10b] Last track : 38 2008-01-03 20:40:29.550 Max[3025:10b] Lead out : 519112
[snip] 2008-01-03 20:43:03.308 Max[3042:10b] First sector : 297033
So indeed it appears that his external Plextor drive is returning a CDTOC with BCD-encoded numbers, because
Internal last track: 26 (which is correct) External last track: 38, 0010 0110 in binary, when interpreted as BCD equals 26 in decimal
Internal LBA for track 1: 33 (correct) External LBA for track 1: 51, 0011 0011 in binary, when interpreted as BCD equals 33
There is a comment in IOCDTypes.h which says:
/* * Table Of Contents * * All CDTOC fields passed across I/O Kit APIs are guaranteed to be * binary-encoded numbers (no BCD-encoded numbers are ever passed). */
so I assumed I didn't have to convert from BCD. Have I made an error in my code or should this not be happening?
you have made the correct assumtion according to the documentation. however, the documentation is wrong.
|