c - Mac application hangs on ReadPipe from USB device -
I took the / developer / example / IOKit / usb / USBSimple example
and modified it so that it In fact, the device transfers some data (and hopefully soon).
Here is my transfer data function (commented):
zero transfer data (IOUSBInterfaceInterface245 ** intf, UInt8 inPipeRef, UInt8 pipe out) {Ioreturn error; CFRunLoopSourceRef cfSource; Err = (* intf) - & gt; CreateInterfaceAsyncEventSource (intf, and cfSource); If (error) {printf ("Transfer data: unable to create event source, err =% 08x \ n", mistake); Return; } // I need to send the tool out to Buf [0] = 0; Output [1] = 0; Output [2] = 0x18; [... kikot ...] // works the following, although I have no confirmation that the data actually comes to the device but after error 0 is err = (* intf) -> gt; ; Rickshaw pipes (intf, outPipeRef, outbuff, 64); If (mistake) {printf ("Transfer Data: TypePipFell, Error =% 08x \ n", mistake); Return; } UInt32 numBytesRead; NumBytesRead = Size (inBuf); // Until I have the device disk = (* intf) - & gt; Reed pipe (intf, inPipeRef, inBuf, and numbytesRead) is hanging to disconnect; If (error) {printf ("Transfer data: readpip file, error =% 08x \ n", mistake); Return; }}
So long as I'm transferData: readPipeFailed, err = e00002ed
- which confirms that I am actually talking / listening to the device.
I went to this synchronous method, unlike Apple's example, which uses an asynchronous approach to simplify things but to no avail. Do not answer the device? But if it should not be left out of the law then leave zero and return to 0?
Any hint? I believe that I am a newbie for Mac OS X programming, but today I have put it out all day without any luck.
I thought it.
The problem was that I was getting wrong pipe numbers from those tasks which was telling them and then calling this function - which was not an example code for the apple.
Something like this, I was writing pipes 1 and was waiting for a response on the pipe. 2. Through a ton test and error and a Windows utility which was allowing me to send and view data on various pipes, I realized that I need to write pipes 3 and read from pipe 4. Pipe numbers can be exchanged (I am not very good with numbers), but the group is fine - 3 and 4 were used instead of 1 and 2.
Comments
Post a Comment