Upgrading osx driver for 10.11 (Changes in USB stack)

对着背影说爱祢 提交于 2019-12-11 12:19:17

问题


I am upgrading existing custom mouse driver devices to OSX 10.11. It is seen that apple has updated its usb stack.

Please refer - https://developer.apple.com/library/mac/releasenotes/General/APIDiffsMacOSX10_11/Objective-C/Kernel.html

My existing code uses many of the removed classes (IOUSBHIDDriver, IOUSBInterface, IOUSBPipe etc). Can someone help me in finding replacements or any useful information for upgrading to 10.11?

Many classes and header files are renamed, and I can figure out the replacements from the above link. But code also uses deprecated class IOUSBPipe and its methods. I have not fully understood what it is used for. Can someone explain purpose of IOUSBPipe as well as suggest me the alternative class for OSX 10.11?

Please find below this line a code snippet that deals with IOUSBpipe

IOMemoryDescriptor *report;
setReport(report, kIOHIDReportTypeOutput);
IOReturn ret;
IOUSBDevRequest request;

IOUSBFindEndpointRequest findRequest = {
    kUSBAnyType,
    kUSBAnyDirn,
    0,
    0
};

IOUSBPipe *pipe = NULL;

while(pipe=usbInterface->FindNextPipe(pipe, &findRequest))
{
if (!pipe)
{
    IOLog("NO PIPE!\n");
    return 0;
}
IOLog("control request on pipe!\n");

request.bmRequestType = (UInt8)req->bmRequestType;
request.bRequest = (UInt8)req->bRequest;
request.wIndex = (UInt16)req->wIndex;
request.wLength = req->wLength;
request.wValue = (UInt16)req->wValue;
request.pData = (void*)data;

pipe->ControlRequest(&request);
    IOLog("result: %d", data[0]);
}

回答1:


A pipe basically represents one direction of a USB endpoint. You can send or receive data from it. I don't know much about kernel-level development in Mac OS X, but by looking at the document you posted, I suspect you are supposed to use IOUSBHostPipe now instead of IOUSBPipe.



来源:https://stackoverflow.com/questions/36478569/upgrading-osx-driver-for-10-11-changes-in-usb-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!