void Device::ReadBulk(const EndpointPtr & ep, const IObjectOutputStreamPtr &outputStream, int timeout) { IOUSBInterfaceInterface ** interface = ep->GetInterfaceHandle(); size_t transferSize = ep->GetMaxPacketSize(); ByteArray buffer(transferSize); size_t r; do { UInt32 readBytes = buffer.size(); USB_CALL((*interface)->ReadPipe(interface, ep->GetRefIndex(), buffer.data(), &readBytes)); r = outputStream->Write(buffer.data(), readBytes); } while(r == transferSize); }
size_t Recv(const IObjectOutputStreamPtr &outputStream) { //HexDump("read", ByteArray(Buffer.data(), Buffer.data() + KernelUrb.actual_length)); return outputStream->Write(Buffer.data(), KernelUrb.actual_length); }