Issue with IOServiceOpen

I have an app that is used to control features of a device with a driverkit driver. I am having trouble creating a connection a certain device.

The Sample code from "Communicating between a DriverKit extension and a client app.

The sample code shows:

ret = IOServiceGetMatchingServices(kIOMainPortDefault, IOServiceNameMatching(kDextIdentifier), &iterator);

I cannot use kDextIdentifier but need to find a service with a certain BSD Name. So in this case I try:

ret = IOServiceGetMatchingServices(kIOMainPortDefault, IOBSDNameMatching(kIOMasterPortDefault, NULL, interface), &iterator);

In each case the call completes correctly, and we get an iterator. I can also use IOServiceGetMatchingService with IOBSDNameMatching, and that completes correctly as well.

However when I attempt IOServiceOpen with the first case, the connection is created correctly. However, I have four of these in the machine, and I need to select the service and subsequently connection for a certain BSD name.

When I attempt the IOServiceOpen with the second/third calls, the IOServiceOpen call fails with error 0x2c7 which is unsupported.

Is there an entitlement I need to make this work?

Anyone have any idea on how to make this work? What am I missing?

Thanks

Issue with IOServiceOpen
 
 
Q