libftdi Archives

Subject: Strange observations with USBDEVFS_REAPURBNDELAY = -1 EAGAIN

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 23 Jul 2009 21:44:14 +0200
Hello,

find appended a small test program. Compile like
gcc -g -o test main.c -lftdi -l usb
and run if you have a FT2232(H) connected. 

Even without anything connected to the low nibble of the low byte, the
programm should terminate and perhaps print 0xffffffff or 0. If the pins are
connected in the MPSSE-Jtag way, the IDs of the devices connected in the
JTAG chain should get printed bit reversed.

However on fast repeated runs, the programm soemtimes doesn't terminate. I
verified on two different machines with two differrent USB Chipsets
(Intel/AMD). If you change the #if 0 to #if 1, it always terminates.

Could people perhaps try to reproduce my observation or point me to
errors/flaws in my code. In short I observe in an strace of the program,
that the program stumbles after sequences like

14389 gettimeofday({1248377804, 892023}, NULL) = 0
14389 ioctl(3, USBDEVFS_SUBMITURB, 0xbf8ad934) = 0
14389 ioctl(3, USBDEVFS_REAPURBNDELAY, 0xbf8ad978) = -1 EAGAIN (Resource 
temporarily unavailable)
14389 select(4, NULL, [3], NULL, {0, 1000}) = 1 (out [3], left {0, 1000})
14389 gettimeofday({1248377804, 893493}, NULL) = 0

I also think that libftdi doesn't handle EAGAIN right. It should't return to
the user program, but handle EAGAIN internally.

Thanks
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • Strange observations with USBDEVFS_REAPURBNDELAY = -1 EAGAIN, Uwe Bonnes <=