IOServiceOpen returns 0x10000003 (MACH_SEND_INVALID_DEST)



当尝试为我正在编写的驱动程序打开服务(根据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 %lun"), kernResult, machPort);
        return false;
    }
}

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

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

IOUserClientClass:     com_MyCompany_driver_MyDriverUserClient

相关内容

  • 没有找到相关文章

最新更新