On Mon, 23 Jan 2006 [EMAIL PROTECTED] wrote:
> > > Now, what I get is, that the completion handler is called 960 times in
> 120
> > > ms, which means
> > > that the driver uses a single microframe to transfer 320 Bytes.
>
> > I don't understand. The code above calls usb_submit_urb only once, so
> the
> > completion handler should be called only once. Not 960 times.
>
> The urb is submitted again in the completion handler. If I understood
> correctly, the completion
> handler should be called once, when the transfer is completed.
The completion handler is called once for each time the URB is submitted.
If the URB is submitted 960 times (because the completion handler
resubmits it) then the completion handler will be called 960 times.
> static void wcam_usb_api_blocking_completion( struct urb *urb, struct
> pt_regs *regs )
> {
> int nLength = urb->actual_length;
> int nBufferSize = urb->transfer_buffer_length;
> struct wcam_sbuf* sbuf = ( struct wcam_sbuf* ) urb->context;
>
> PDEBUG (1,"Transferred %d Bytes of %d Bytes",nLength,nBufferSize);
> if ( urb->status &&
> !( urb->status == -ENOENT || urb->status == -ECONNRESET ||
> urb->status == -ESHUTDOWN ) )
> {
> err( "ERROR: nRetVal=%d: %s", urb->status,
> symbolic( m_stUrbErrorTextList, urb->status ) );
> complete( &sbuf->done );
> return ;
> }
>
> nBufferSize -= nLength;
> urb->transfer_buffer_length = nBufferSize;
>
> // Transferred all the data
> if ( nBufferSize <= 0 )
> {
> complete( &sbuf->done );
> return ;
> }
>
> urb->transfer_buffer += nLength;
>
> /* Resubmit urb for new data */
> urb->status = 0;
> if ( usb_submit_urb(urb, GFP_ATOMIC) )
> PDEBUG ( 0, "urb burned down in video irq" );
> return ;
> }
>
> In my case I did it this way, because the completion handler was called
> after 125 us and filled only 320 of 307200Bytes.
> So I had no other choice, than to resubmit the urb.
> I don't know why, the device did the transfer this way.
When the completion handler gets called, what are the values of
urb->status and urb->actual_length? And is this a bulk-IN or a bulk-OUT
transfer?
Are you certain that the bulk endpoint's maxpacket size is 320? According
to the USB 2.0 specification, host controllers don't have to support any
bulk maxpacket size other than 512. What does /proc/bus/usb/devices say
about your device?
> > > So my question is: How do I have to configure the bulk transfer to get
> the
> > > maximum speed ?
>
> > In your code above, store all 307200 bytes in data and set len to
> 307200.
>
> That was my very first approach.
And what happened when you tried it?
Is your problem that you're trying to transfer a large amount of data from
the device to the computer, but each time the device sends only 320 bytes?
If that's so then the device is very poorly designed. You can improve
your overall transfer rate by submitting a lot of URBs, one right after
another, without waiting in between for them to complete.
Alan Stern
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users