Scott D. Davilla | 18 May 18:00 2005

usb_reap_async timeout

I have a question about how usb_reap_async handles timeouts.

We have a custom FX2 running in auto-commit slave mode controlled by 
an fpga. Bulk IN, 512 byte packets, quad buffered. For throughput 
info, running as fast as possible in a test mode (fpga is writing at 
the full slave fifo speed of 96MB/s), we see about 39.7MB/s on a 
1.2GHz ITX motherboard using on-board USB 2.0 ports under WinXP 
running headless with remote desktop client. The normal runtime rate 
is about 10MB/s.

We queue up 8 usb_reap_async and start a loop with a timeout of 10000ms.

The issue we have is when any timeout occurs on a usb_reap_async call, we get;

	LIBUSB_DLL error: usb_reap_async: timeout error

which make sense, then seven more of;

	LIBUSB_DLL error: usb_reap_async: error: The I/O operation 
has been aborted because of either a thread exit or an application 
request.

which does not make sense. At this point, we get a stall at the fpga 
level until IN packets get reloaded by usb_submit_async. Is the 
correct behavior, seems like only the usb_reap_async for that context 
should timeout and the others left alone.

Also if one has a usb_reap_async pending, how do you cancel it before 
the timeout expires. Right now I just release the interface, that 
works but does not seem correct. Code is below, watch the line wraps.
(Continue reading)

Karl.Achter | 19 May 10:01 2005

Karl Achter is out of the office.


I will be out of the office starting  13.05.2005 and will not return until
30.05.2005.

I will respond to your message when I return. In urgent matter  please
contact  Markus Kraus
 (markus.kraus <at> pruftechnik.com ) or Johann Loesl
(johann.loesl <at> pruftechnik.com).

Ich bin zur Zeit nicht im Büro und werde Ihre Email nach meiner Rückkehr
als bald als möglich beantworten. In dringenden Fällen wenden Sie sich
bitte an Herrn Kraus (markus.kraus <at> pruftechnik.com) oder Herrn Lösl
(Johann.loesl <at> pruftechnik.com).

Mit freundlichen Grüße
With best regards
Karl Achter

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
Giuseppe Corbelli | 19 May 14:49 2005
Picon

usb_claim_interface error

Hi all 
I'm the developer of yex, an userspace program to control a portable
mp3 player from Samsung (see http://yex.sf.net).
I'm using libusb to access the bus and on Linux 2.4 I have no problems 
(with libusb 1.0.8). On Win2k SP4, both with versions 0.1.8 and 0.1.10.1 
I cannot send commands/data to the player.
I'm attaching some output here:

I:\Programmi\yex-0.0.3\Win32\debug>yex get-devinfo
usb_set_debug: Setting debugging level to 4 (on)
LIBUSB_DLL: usb_os_init: dll version: 0.1.10.1
LIBUSB_DLL: usb_os_init: driver version: 0.1.10.1
found 2 busses
LIBUSB_DLL: usb_os_find_busses: found bus-0
LIBUSB_DLL: usb_os_find_busses: found bus-1
LIBUSB_DLL: usb_os_find_devices: found \\.\libusb0-0000--0x8086-0x0b0b on bus-0

>>>> This is my device
LIBUSB_DLL: usb_os_find_devices: found \\.\libusb0-0002--0x04e8-0x5a00 on bus-0
<<<<

LIBUSB_DLL: usb_os_find_devices: found \\.\libusb0-0001--0x8086-0x0b0b on bus-1

>>>> Here's the error
LIBUSB_DLL error: could not claim interface 0, error: Invalid parameter.

Error in yepp::get_device_info(void). Cannot open device
Error in 
\-->yepp::open (void). usb_claim_interface failed (libusb error: could not claim interface 0, error:
Invalid parameter)
(Continue reading)

Stephan Meyer | 19 May 17:24 2005
Picon

Re: usb_reap_async timeout

This is a Windows issue. After a timeout is detected by the DLL,
Window's CancelIo() functions is called. This function cancels ALL
pending IO requests issued by the calling thread for the device
handle. 
AFAIK, Window's doesn't offer any functions to cancel single IO requests.

There is currently no way to cancel outstanding IO request manually
except by closing the device handle (usb_close()).

Also, the asynchronous API is still preliminary and and its API will change in
the future. The (Linux-) libusb developers plan to add it in the future 
1.0 release.

Stephan

 
> 
> I have a question about how usb_reap_async handles timeouts.
> 
> We have a custom FX2 running in auto-commit slave mode controlled by 
> an fpga. Bulk IN, 512 byte packets, quad buffered. For throughput 
> info, running as fast as possible in a test mode (fpga is writing at 
> the full slave fifo speed of 96MB/s), we see about 39.7MB/s on a 
> 1.2GHz ITX motherboard using on-board USB 2.0 ports under WinXP 
> running headless with remote desktop client. The normal runtime rate 
> is about 10MB/s.
> 
> We queue up 8 usb_reap_async and start a loop with a timeout of 10000ms.
> 
> The issue we have is when any timeout occurs on a usb_reap_async call, we get;
(Continue reading)

Stephan Meyer | 19 May 17:31 2005
Picon

Re: usb_claim_interface error

> I have this code to claim interface and set config; it's really my guess
> since I'm no USB guru and when I got it working on linux I did not bother
> to search some more info. The device has 1 config, 1 interface, 3 EPs (bulk
> read & write, control)
> 
> 	struct usb_dev_handle *dev_handle;
> 	struct usb_config_descriptor *config = dev->config; 
> 	struct usb_interface *interface = config->interface;
> 	struct usb_interface_descriptor *altsetting = interface->altsetting;
> 
> 	usb_claim_interface(dev_handle, altsetting->bInterfaceNumber);
> 	usb_set_configuration(dev_handle, config->iConfiguration);
>  

Select a configuration first, then claim the interface:

usb_set_configuration(dev_handle, config->iConfiguration);
usb_claim_interface(dev_handle, altsetting->bInterfaceNumber);

______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
libusb-win32 | 23 May 18:43 2005

New Bee question

Hello libusb-win32-devel,

I'm  trying  to use the LibUSB-win32, but have come across a couple of
problems.  The first item I should resolve is finding out if one needs
the  DDK for developing with LibUSB-win32 or does one need the DDK for
developing  LibUSB-win32? I'm assuming it is not required for dev with
Lib-USB.  The  problem  I am facing to me appears to be non related to
the DDK.

I'm  currently  attempting  to build a very basic program. My over all
goal is to stream information from a USB device to a wxWidgets GUI for
display. For now I'm attempting to get the basics working.

I've created a file called test.c and it contains the following text

#include "usb.h"

int main()
{
    struct usb_bus *busses;

    usb_init();
    usb_find_busses();
    usb_find_devices();

    busses = usb_get_busses();

    struct usb_bus *bus;
    int c, i, a;

(Continue reading)

Stephan Meyer | 23 May 21:42 2005
Picon

Re: New Bee question

> 
> Hello libusb-win32-devel,
> 
> I'm  trying  to use the LibUSB-win32, but have come across a couple of
> problems.  The first item I should resolve is finding out if one needs
> the  DDK for developing with LibUSB-win32 or does one need the DDK for
> developing  LibUSB-win32? I'm assuming it is not required for dev with
> Lib-USB.  The  problem  I am facing to me appears to be non related to
> the DDK.

The DDK is not needed to develop with libusb-win32 or to compile the library and
the driver.

> 
> I'm  currently  attempting  to build a very basic program. My over all
> goal is to stream information from a USB device to a wxWidgets GUI for
> display. For now I'm attempting to get the basics working.
> 

> In msys I do
> 
> gcc -c -mwindows -o test.exe -I/d/Program\ Files/LibUSB-Win32-0.1.10.1/include/ test.c

This command doesn't create a valid executable. It just creates an object file (*.o file)
with an .exe suffix. Remove the "-c" option to build a real .exe file:

gcc -mwindows -o test.exe -I<path-to-libusb-include> -L<path-to-libusb-lib> -lusb test.c

> 
> I get no messages, good or bad, and I see a program titled test.exe is
(Continue reading)

libusb-win32 | 24 May 00:03 2005

Re[2]: New Bee question

Hello Stephan,

SM> The  DDK  is not needed to develop with libusb-win32 or to compile
SM> the library and the driver.

Glad to hear it.

>> gcc -c -mwindows -o test.exe -I/d/Program\ Files/LibUSB-Win32-0.1.10.1/include/ test.c

SM> This command doesn't create a valid executable. It just
SM> creates an object file (*.o file)
SM> with an .exe suffix. Remove the "-c" option to build a real .exe file:

SM> gcc -mwindows -o test.exe -I<path-to-libusb-include>
SM> -L<path-to-libusb-lib> -lusb test.c

I did this, but now I receive the following error message.

gcc -mwindows -o test.exe -I/d/Program\ Files/LibUSB-Win32-0.1.10.1/include/ -L/d/Program\
Files/LibUSB-Win32-0.1.10.1/lib/gcc/ -lusb test.c

blah:test.c: undefined reference to 'usb_init'
blah:test.c: undefined reference to 'usb_find_busses'
blah:test.c: undefined reference to 'usb_find_devices'
blah:test.c: undefined reference to 'usb_get_busses'

Again the test.c contains the text

#include "usb.h"

(Continue reading)

Jonathan Manning | 24 May 15:49 2005
Picon

Re: New Bee question

libusb-win32 <at> jaredharvey.com wrote:
> 
> I did this, but now I receive the following error message.
> 
> gcc -mwindows -o test.exe -I/d/Program\ Files/LibUSB-Win32-0.1.10.1/include/ -L/d/Program\
Files/LibUSB-Win32-0.1.10.1/lib/gcc/ -lusb test.c
> 
> blah:test.c: undefined reference to 'usb_init'
> blah:test.c: undefined reference to 'usb_find_busses'
> blah:test.c: undefined reference to 'usb_find_devices'
> blah:test.c: undefined reference to 'usb_get_busses'
> 

Jared,

Try moving the -lusb to the end of the line, after test.c. Seems silly,
but its a common gotcha.

~Jon

-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
libusb-win32 | 24 May 19:58 2005

Re[2]: New Bee question

Hello Jonathan,

JM> Try  moving  the -lusb to the end of the line, after test.c. Seems
JM> silly, but its a common gotcha.

I've been gotcha-ed. I now get a standard output of

found 1 busses

I've  never  linked  against  something.  Is there a place where I can
learn  a  bit  more about what actually happens when I do the -lusb. I
looked  at  the info from gcc -v --help, but that only give me a brief
description of the -l switch.

Thanks for the help. Now lets see if I can break something :)

Best regards.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 libusb-win32 <at> jaredharvey.com                        HAM KB1GTT

e-mail mail <at> jaredharvey.com
Web page http://jaredharvey.com

Albert Einstein, when asked to describe radio, replied:
"You see, wire telegraph is a kind of a very, very long 
cat. You pull his tail in New York and his head is 
meowing in Los Angeles. Do you understand this? 
And radio operates exactly the same way: you send signals 
here, they receive them there. The only difference is that 
(Continue reading)


Gmane