Re: calling open() on an older cd device returns EBUSY??
Re: calling open() on an older cd device returns EBUSY??
- Subject: Re: calling open() on an older cd device returns EBUSY??
- From: "David M. Cotter" <email@hidden>
- Date: Wed, 4 May 2005 13:27:59 -0700
Thank you Shantonu so much for your help, your suggestion did indeed work, prepending an "r" to the device name. Apparently I didn't need to append "s1" to indicate session 1, or, rather, it seems to work just fine without that.
Oh, and, list people, apologies for the "got any clue" thing below, I can see how that could be interpreted as, like "you have no clue" and I *very* much didn't intend to imply that, rather, I was feeling utterly clueless myself and am utterly grateful for the help this list is to all those with questions!
Thanks again!
On May 3, 2005, at 4: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 "<x-tad-smaller>MATSHITA</x-tad-smaller> 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?
On May 3, 2005, at 11:29 AM, Shantonu Sen wrote:
DVDs are different than CDs. DVDs don't have a CD table of contents (TOC) and multiple sessions. DVDs only support s single session, and their whole device is just at "/dev/disk2"
Also, you probably want to be using /dev/rdisk2 instead of /dev/disk2. Otherwise, you may not be able to open the device because of other readers.
Shantonu
On May 3, 2005, at 11:10 AM, David M. Cotter wrote:
huh, well that's quite interesting, cuz the same CD works just fine on my other computer (with the DVD-R).
This is how I get the device name, as documented by Apple:
GetVolParmsInfoBuffer volumeParms; structclr(volumeParms);
HParamBlockRec pb;
// Use the volume reference number to retrieve the volume parameters. See the documentation
// on PBHGetVolParmsSync for other possible ways to specify a volume.
pb.ioParam.ioNamePtr = NULL;
pb.ioParam.ioVRefNum = volSpec.vRefNum;
pb.ioParam.ioBuffer = (Ptr) &volumeParms;
pb.ioParam.ioReqCount = sizeof(volumeParms);
ETRL(PBHGetVolParmsSync(&pb), "Error PBHGetVolParmsSync");
// A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field.
// It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h.
const char *bsdNodeNameZ = (char *)volumeParms.vMDeviceID;
// create (return) the device path to the volume
sprintf(pathZ, "/dev/%s", bsdNodeNameZ);
why does this code work fine on my DVD-R, but not on my CD-R/W? It also works fine on my Plextor CD-R/W
On May 3, 2005, at 7:28 AM, Shantonu Sen wrote:
/dev/disk2 is the entire CD. You want a particular session, like the first session. that would be /dev/disk2s1 (which might have further subdivision into /dev/disk2s1s3). For ISO CDs, it might be /dev/disk2s0.
Shantonu
On May 2, 2005, at 11:49 PM, David M.Cotter wrote:
i_fd = open(i_bsd_vol_path, O_RDONLY, 0);
i_bsd_vol_path is "/dev/disk2" which is my cd drive (trust me)
but i_fd == -1 and errno == 16 (EBUSY)
Why is the device busy? Is it really just "not capable"? .
the drive that fails is a "<x-tad-smaller>MATSHITA</x-tad-smaller> CD-RW CW-7121"
this works fine on a modern drive eg: "<x-tad-smaller>MATSHITA DVD-R UJ-815</x-tad-smaller>" or "" _______________________________________________
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
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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