Re: Killing process causing USB bulk transfer transaction loss?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 13, 2017 at 11:32:39AM +1300, Charles Manning wrote:
> Hello
> 
> I have an issue where the first 512-byte high speed bulk transfer
> between a custom peripheral and a Linux host is sometimes lost.
> 
> I have the bus attached to a Beagle 480 and I can see the transaction
> happening over the bus (IN, DATA, ACK) at the right time but the data
> does not show up into userspace buffers. ie. it would seem the data is
> getting lost somewhere between the host hardware and user space.
> 
> I've seen on both Ubuntu with 4.4.0 x64 as well as on various Android
> ARM platforms (ie commercial Android phones/tablets).
> 
> There are two independently written user space programs that both
> exhibit this behaviour:
> * Linux PC based application written using libusb.
> * Android application written in NDK using ioctls.
> 
> In both cases everything works fine (eg. long term streaming for
> hours, orderly start/stopping) except when the process is killed
> (swipe app right in Android) or Control C in Ubuntu.
> 
> If the application is killed then the first 512-byte transfer in the
> next invocation of the application **might** be lost.
> 
> In our application we're stuffing approx 8 or 9 MBytes of data a
> second through the high speed USB link (ie. around 1/7) of the full
> bandwidth. The problem occurs approximately 1/7th of the time.
> 
> This leads me to suspect that around 1/7th of the time the process is
> being killed during the middle of a transfer and this results in the
> host controller being left in a weird state causing the first packet
> to be lost.
> 
> Any hints on where to look for this or how to debug further would be
> much appreciated.

Sounds like you need to reset the endpoint when you start transmitting
data, so you "know" which state it is in (i.e. the toggle bit is known
to be in a specific state.)

You can do that through usbfs by sending a reset endpoint command, odds
are there is a libusb command somewhere to do that.  Try it out and see
if that solves your issue or not.

hope this helps,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux