Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ReadPolling



At 12:31 PM +0530 3/27/02, Prashanth Shenoy wrote:
Hi all

I am developing device driver for my hardware. I have to poll the bulk-in
endpoint for  reading the data from the device. As the data comes to the
bulk-in endpoint I have to read it. According to the device specification,
for continuos bulk-in I have to write to control pipe once and then start
reading the data.

What you descirbe above (one write to the control pipe, and many reads) does not agree with what you say you do below (write to the control pipe, read from bulk-in, write, read, etc). This might be a problem, or perhaps you just described it differently.



After the device is initialized, I start polling the bulk-in endpoint. I first issue a command to control pipe(64 bytes),then start reading from the bulk-in endpoint as the data comes. After reading 64 bytes I again issue a command to control pipe. This is what I am doing inside ReadPolling function. After it enters the completion routine I store the read data and call the ReadPolling function from the completion routine.


How is the buffer that you use for the USBBulkRead allocated? It needs to be "held" in virtual memory terms - it can be in the drivers globals, allocated in the system heap, or explicitly held in the application heap.


My problem is, sometimes system hangs after reading 64 bytes. Sometimes it hangs as soon as the first byte comes. Sometimes after reading some 20 or 30 bytes. If I dump log message to a file, Every time it hangs after the execution of the USBBulkRead function. It does not go to the completion routine.


Make sure you are not accessing the USB ParameterBlock except when no transaction is active, or you are in the completion routine.


I struggled a lot but could not figure it out what is happening. Can anybody please give some suggestions regarding this.


You should look at the USB bus using an analyzer -- do you see the control traffic -- do you see the IN on the bulk-in pipe -- how does the devcie respond. What is the last trafic before the machine freezes?


I've asked quesions that you need to answer in order to understand the problem -- hopefully that will give you some hints so you can find the problem.

Good Luck!

--
David Ferguson
USB Software Team
Apple Computer, Inc.
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.

References: 
 >ReadPolling (From: Prashanth Shenoy <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.