ReadPipe在Mac OS X 10.11上挂起

时间:2015-10-17 18:57:48

标签: macos cocoa usb iokit

我使用了Apple示例中的代码:

// Send data through out pipe
ret = (*usbInterface)->WritePipe(usbInterface, bulkOutRef, (void *)kTestMessage, 4);
if (ret != kIOReturnSuccess)
{
   NSLog(@"Write failed (error: %x)\n", ret);
}
// Read data through in pipe 
numBytes = 64;
inp = malloc(numBytes);
ret = (*usbInterface)->ReadPipe(usbInterface, bulkInRef, inp, &numBytes);

使用GetPipeProperties检查管道参考(并使用USB Prober检查加倍)。 我也尝试过asynch版本,结果相同:写入工作(似乎),读取挂起。 我还尝试使用usbtrace进行一些调试:启动一次并退出后,它现在总是返回The trace facility is currently in use。 USB设备是Microchip USB入门套件II。 任何的想法? 谢谢,

米歇尔

1 个答案:

答案 0 :(得分:0)

问题是我必须使用OUT管道上的max-width向设备发送请求,然后使用IN管道中的WritePipe读取响应。我没有得到它,这是我的错。

相关问题