Hi David,
You can use opendev() to open the character device, that is, "/dev/rdisk2". The difference between the block device and the character device is documented in most books about BSD. The short of it is that the block device is buffered and the character device is unbuffered. You generally want the character device.
It seems unusual to us that the open on the block device was permitted since an open from a file system is exclusive, so for an Audio CD, "/dev/disk2" is opened by cddafs and hence cannot be opened by someone else. We are somewhat at a loss to explain how someone else can open it, at the moment. BSD enforces it.
We are looking into it. The character device is the correct device to use though, especially that I do not believe your intent was to have the system cache all the data your application reads from the Audio CD, which could be up to 700 MB of data to have to remember.
Dan On 3 May 2005, at 7:13 PM, David M. Cotter wrote: anyone gotn'y clue here? can a darwinnian point me to doc on these device name things? I'm trying to only use "sanctioned" mac OS calls, but if I can twiddle with the results and get it to work, so be it. but i'd like to see how, and understand why it doesn't work in the first place.
-dave
On May 3, 2005, at 11:40 AM, David M. Cotter wrote:
Okay, just to be clear, i am reading a CD. whether it's in a DVD/CD combo drive or not seems to be irrelevant. it's a normal, CDDA audio CD, and yes I'm reading the TOC and manually extracting tracks (ripping). So, i don't think it's about the DVD drive.
I *can* open the CD device at "/dev/disk2", without specifying a session, without specifying "r", using my combo drive, or using my plextor, and with many other drives. It's just with the "MATSHITA CD-RW CW-7121" that it says it's busy.
Where can I get this "r" node name? when I query via "PBHGetVolParmsSync", it returns what it returns, I don't want to "make up" that I should add an "r" to the beginning or a "s1" to the end, I want the OS to tell me what I can do here.
Now, I've specified I want to open it read only, so shouldn't that be enough to get it even if "other readers" are also making queries? and I have most certainly quit all user apps, so nothing else SHOULD be accessing the drive.
Why would this work fine sometimes and NOT work other times?
|