1

当我尝试为驱动程序打开服务(根据SimpleUserClient 示例使用用户客户端)时,IOServiceOpen 返回 0x10000003(MACH_SEND_INVALID_REQUEST):

mach_port_t machPort = mach_task_self();
kern_return_t kernResult;
io_service_t service;

classesToMatch = IOServiceNameMatching(DRIVER_NAME);

kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, &iterator); 

while ((service = IOIteratorNext(iterator)) != IO_OBJECT_NULL){
    kernResult = IOServiceOpen(service, machPort, 0, &connect);

    if (kernResult != KERN_SUCCESS){
        //0x10000003 = MACH_SEND_INVALID_DEST causes a return false here
        fprintf(stderr, "IOServiceOpen returned 0x%08x - machPort is %lu\n"), kernResult, machPort);
        return false;
    }
}

因此,该服务永远不会打开。

4

1 回答 1

1

您需要在驱动程序个性中添加一个字典条目,以说明代码中调用的用户客户端类:

IOUserClientClass:     com_MyCompany_driver_MyDriverUserClient
于 2012-09-13T12:54:20.487 回答