• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: DKIOCCDREADTOC returning BCD numbers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DKIOCCDREADTOC returning BCD numbers?


  • Subject: Re: DKIOCCDREADTOC returning BCD numbers?
  • From: "David M. Cotter" <email@hidden>
  • Date: Fri, 4 Jan 2008 16:31:29 -0800

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:
http://kjams.com/

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.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: DKIOCCDREADTOC returning BCD numbers?
      • From: "Stephen F. Booth" <email@hidden>
    • Re: DKIOCCDREADTOC returning BCD numbers?
      • From: Chris Sarcone <email@hidden>
References: 
 >DKIOCCDREADTOC returning BCD numbers? (From: "Stephen F. Booth" <email@hidden>)
 >Re: DKIOCCDREADTOC returning BCD numbers? (From: Chris Sarcone <email@hidden>)

  • Prev by Date: Re: Building kext for Leopard and Tiger
  • Next by Date: Re: DKIOCCDREADTOC returning BCD numbers?
  • Previous by thread: Re: DKIOCCDREADTOC returning BCD numbers?
  • Next by thread: Re: DKIOCCDREADTOC returning BCD numbers?
  • Index(es):
    • Date
    • Thread