OSX / Kernel extensions: problem locating a driver (that extends IOSCSIPeripheralDeviceType00)
Posted
by LG
on Stack Overflow
See other posts from Stack Overflow
or by LG
Published on 2010-03-25T00:56:54Z
Indexed on
2010/03/25
1:03 UTC
Read the original article
Hit count: 415
Hi,
I'm implementing a driver that extends IOSCSIPeripheralDeviceType00 as I need to send custom SCSI commands to a device.
I'm following the VendorSpecificType00 and SimpleUserClient examples and http://wagerlabs.com/writing-a-mac-osx-usb-device-driver-that-impl as an example.
I built my kernel extension and it loads fine with kextload and it shows up in kextstat.
The problem is that I can't locate it in my user space code.
Here's the important (I think) part of:
my driver code:
#define super IOSCSIPeripheralDeviceType00 OSDefineMetaClassAndStructors(com_mycompany_driver_Foo, IOSCSIPeripheralDeviceType00)
my user client code:
#define super IOUserClient OSDefineMetaClassAndStructors(com_mycompany_driver_FooUserClient, IOUserClient)
the plist:
CFBundleIdentifier -> com.mycompany.driver.Foo
IOCLass -> com_mycompany_driver_Foo
IOUserClientClass -> com_mycompany_driver_FooUserClient
IOProviderClass -> IOSCSIPeripheralDeviceNub
Here's how I try to locate the driver in my user space code (similar to SimpleUserClient):
dictRef = IOServiceMatching("com_mycompany_driver_Foo");
kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, dictRef, &iterator);
When I execute the code, iterator is 0.
I noticed that in the VendorSpecificType00 code, the localization of the driver is done differently:
dictRef = IOServiceMatching("IOBlockStorageServices");
kr = IOServiceGetMatchingServices(kIOMasterPortDefault, dictRef, &iter);
while ((service = IOIteratorNext(iter))) {
io_registry_entry_t parent;
kr = IORegistryEntryGetParentEntry(service, kIOServicePlane, &parent);
...
// We're only interested in the parent object if it's our driver class.
if (IOObjectConformsTo(parent, "com_apple_dts_driver_VendorSpecificType00")) {
I tried doing that but it didn't work either.
Thanks for reading and your help,
-L
© Stack Overflow or respective owner