Quantcast

Bulk read (libusb 1.0)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bulk read (libusb 1.0)

rick_l

Hello,

 

I am new to libusb (and to Linux).

I am  trying to read data from my full-speed device using lib_usb_bulktransfer.

I want to read 512 bytes of data using two calls to lib_usb_bulktransfer with 256 bytes each.

Sometimes on the second call, the transferred parameter returns 192 but my buffer contains all 256 bytes of data.

Is this a known issue or is there some condition that could be causing this?

(I am using C# and Mono and using platform invoke to call lib_usb_bulktransfer).

 

Thanks


Rick L

 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bulk read (libusb 1.0)

Tim Roberts
Rick Lamanna wrote:
>
>  
>
> I am new to libusb (and to Linux).
>
> I am  trying to read data from my full-speed device using
> lib_usb_bulktransfer.
>

Do you mean libusb_bulk_transfer?

> I want to read 512 bytes of data using two calls to
> lib_usb_bulktransfer with 256 bytes each.
>
> Sometimes on the second call, the transferred parameter returns 192
> but my buffer contains all 256 bytes of data.
>
> Is this a known issue or is there some condition that could be causing
> this?
>
> (I am using C# and Mono and using platform invoke to call
> lib_usb_bulktransfer).
>

Are you specifying a timeout?  On a full speed device, the bulk packet
size is 64 bytes, so if your timeout was too short, it could have
canceled the transaction just before the final transfer was registered.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bulk read (libusb 1.0)

rick_l
Yes, I meant libusb_bulk_transfer.

I'm not using a timeout because my device can be triggered externally
which can occur at any time.
I did forget to mention that while libusb_bulk_tranfer reported that 192
bytes were transferred on the second call, my USB bus analyzer showed
that 256 bytes were transferred followed by a zero-length packet.
I tried to call libusb_bulk_transfer a third time to see if it could get
more data but it did not.

-Rick

-----Original Message-----
From: Tim Roberts [mailto:[hidden email]]
Sent: Thursday, July 09, 2009 5:33 PM
To: [hidden email]
Subject: Re: [Libusb-devel] Bulk read (libusb 1.0)

Rick Lamanna wrote:
>
>  
>
> I am new to libusb (and to Linux).
>
> I am  trying to read data from my full-speed device using
> lib_usb_bulktransfer.
>

Do you mean libusb_bulk_transfer?

> I want to read 512 bytes of data using two calls to
> lib_usb_bulktransfer with 256 bytes each.
>
> Sometimes on the second call, the transferred parameter returns 192
> but my buffer contains all 256 bytes of data.
>
> Is this a known issue or is there some condition that could be causing
> this?
>
> (I am using C# and Mono and using platform invoke to call
> lib_usb_bulktransfer).
>

Are you specifying a timeout?  On a full speed device, the bulk packet
size is 64 bytes, so if your timeout was too short, it could have
canceled the transaction just before the final transfer was registered.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------
------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,

vendors submitting new applications to BlackBerry App World(TM) will
have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bulk read (libusb 1.0)

Daniel Drake
In reply to this post by rick_l
Rick Lamanna wrote:

> I am new to libusb (and to Linux).
>
> I am  trying to read data from my full-speed device using
> lib_usb_bulktransfer.
>
> I want to read 512 bytes of data using two calls to lib_usb_bulktransfer
> with 256 bytes each.
>
> Sometimes on the second call, the transferred parameter returns 192 but
> my buffer contains all 256 bytes of data.

Try using usbmon to see what's happening at the layer below. If usbmon
says 192 bytes have been transferred then libusb is doing the right thing.

Daniel


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bulk read (libusb 1.0)

Tim Roberts
In reply to this post by rick_l
Rick Lamanna wrote:
> Yes, I meant libusb_bulk_transfer.
>
> I'm not using a timeout because my device can be triggered externally
> which can occur at any time.
> I did forget to mention that while libusb_bulk_tranfer reported that 192
> bytes were transferred on the second call, my USB bus analyzer showed
> that 256 bytes were transferred followed by a zero-length packet.
>  

This means you saw four 64-byte packets followed by a zero-length
packet, right?

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bulk read (libusb 1.0)

rick_l
Yes, that is correct.

-----Original Message-----
From: Tim Roberts [mailto:[hidden email]]
Sent: Friday, July 10, 2009 1:25 PM
To: [hidden email]
Subject: Re: [Libusb-devel] Bulk read (libusb 1.0)

Rick Lamanna wrote:
> Yes, I meant libusb_bulk_transfer.
>
> I'm not using a timeout because my device can be triggered externally
> which can occur at any time.
> I did forget to mention that while libusb_bulk_tranfer reported that
192
> bytes were transferred on the second call, my USB bus analyzer showed
> that 256 bytes were transferred followed by a zero-length packet.
>  

This means you saw four 64-byte packets followed by a zero-length
packet, right?

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.


------------------------------------------------------------------------
------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,

vendors submitting new applications to BlackBerry App World(TM) will
have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Libusb-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Loading...