Guy*_*zmo 9 macos usb installer driver iokit
我正在OS X中安装一个安装程序,为USB设备安装一个IOKit驱动程序,我试图让它不需要在最后重启.安装程序正确安装驱动程序并重建kext缓存,运行后,如果我拔下并重新插入USB设备,它会正确加载新驱动程序,一切正常.
但是,我不希望要求用户物理拔出设备以便加载新驱动程序.必须有一种方法让OS X以编程方式加载新驱动程序 - 实际上模拟设备被拔出并重新插入或类似的东西.我该怎么做呢?到目前为止,几个小时的谷歌搜索没有任何结果,所以任何帮助将不胜感激!
IOUSBDeviceInterface187::USBDeviceReEnumerate() 将执行您想要的操作。唯一的问题是找到所有感兴趣的设备并使用 手动调用它们IOServiceGetMatchingServices()。
/*!
@function USBDeviceReEnumerate
@abstract Tells the IOUSBFamily to reenumerate the device.
@discussion This function will send a terminate message to all clients of the IOUSBDevice (such as
IOUSBInterfaces and their drivers, as well as the current User Client), emulating an unplug
of the device. The IOUSBFamily will then enumerate the device as if it had just
been plugged in. This call should be used by clients wishing to take advantage
of the Device Firmware Update Class specification. The device must be open to use this function.
@availability This function is only available with IOUSBDeviceInterface187 and above.
@param self Pointer to the IOUSBDeviceInterface.
@param options A UInt32 reserved for future use. Ignored in current implementation. Set to zero.
@result Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService,
or kIOReturnNotOpen if the device is not open for exclusive access.
*/
IOReturn (*USBDeviceReEnumerate)(void *self, UInt32 options);
Run Code Online (Sandbox Code Playgroud)
查看 IOKit/usb/IOUSBLib.h
| 归档时间: |
|
| 查看次数: |
2950 次 |
| 最近记录: |