using kIOMMCDeviceUserClientTypeID on CD-ROM
using kIOMMCDeviceUserClientTypeID on CD-ROM
- Subject: using kIOMMCDeviceUserClientTypeID on CD-ROM
- From: Wei Mingzhi <email@hidden>
- Date: Thu, 22 Jul 2010 15:57:34 +0900 (KST)
Hi,
I need to issue raw MMC commands to CD-ROM device, and I am trying to use something like this:
int OpenCdHandle(const char *dev) {
char buf[4096];
int err;
SInt32 score;
if (dev != NULL && dev[0] != '\0') strcpy(buf, dev);
else FindCDDevice(buf);
if (buf[0] == '\0') return -1;
dev = buf + strlen("/dev/");
if (dev[0] == 'r') dev++;
PRINTF("Trying to open device '%s'\n", dev);
object = IOServiceGetMatchingService(kIOMasterPortDefault,
IOBSDNameMatching(kIOMasterPortDefault, 0, dev));
if (object == 0) { PRINTF("init: no object\n"); return -1; }
IORegistryEntryGetPath(object, kIOServicePlane, buf);
PRINTF("Registry Entry: %s\n", buf);
// Get intermediate (IOCFPlugIn) plug-in for MMC device
err = IOCreatePlugInInterfaceForService(object,
kIOMMCDeviceUserClientTypeID, kIOCFPlugInInterfaceID,
&plugin, &score);
...
the "dev" parameter should take a CD-ROM device, such as /dev/rdisk2.
however the IOCreatePlugInInterfaceForService() always fails here, not sure what the problem is. I read some code samples from the Internet and most seems to be doing the same thing.
Thanks in advance
_______________________________________________
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