Daniel Miller | 1 Nov 2004 17:49

Re: Antwort: Re: problems compiling libusb-win32 (mingw 3.4.0)

Stephan Meyer <Stephan.Meyer <at> iav.de> wrote in
news:OF3ED3F42C.AC1D5DDC-ONC1256F3B.0023C600-C1256F3B.0023D80E <at> retarus.de
: 

> I searched the internet regarding this compiler error and it seems
> that gcc reports errors in its own header files if source files 
> contain illegal code/characters before the #include statements.
> So is it possible that you accidentally modified the file registry.c? 
> Please try to remove everything from registry.c before the #include
> statements or just try to compile a fresh download of libusb.
> 
> For instance if I insert an 'a' character in the first line of
> registry.c (before the comments) then I get the following errors:
> 
>    [ snip ]

Well, that is entirely too wierd... There indeed was an extra letter 
inserted at the beginning of registry.c... only *that* particular file can 
cause this problem??  Now I'm frightened!!!  Anyway, that fixed the 
problem, and this file now compiles.  I'm still having some other problems, 
but it looks like they're caused by problems with my winddk installation, 
and I likely can solve those myself.

Thanks for you help!!

    	Dan Miller

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
(Continue reading)

Daniel Miller | 2 Nov 2004 02:11

device-identity problems

I'm working on a USB tester here.  The tester has 12 slots (three USB host 
controllers with 12 slots per controller).  One of the problems that I've 
had under both Linux and Windows is determining which front-panel slot is 
associated with each of the data structures that I obtain when I enumerate 
USB devices.  Under Windows, I have a further complication because once I 
*do* figure out these relationships they are with respect to Windows data 
structs rather than libusb data structs.  So, when I proceed to do the 
standard libusb enumeration (loop over busses, loop over devices on each 
bus), I don't see any information which permits me to do either of these 
tasks (correlate libusb with Windows structs, or correlate libusb with 
physical slot position).  

I made a first pass at trying to do this by using USB device serial number 
as the common data point (this won't be sufficient for final product, but I 
thought it would be a start), but this causes a problem... I'm ending up 
duplicate-opening devices because I have to open the device to read its 
serial number, to see if its a device I've already opened... I need a 
better solution to this situation.

Is there some way that I can get a physical device address via the libusb 
interface??  Or is there some other way that I can derive the physical 
(front-panel) slot position from the libusb data??  If not, I may not be 
able to use the libusb package at all, which would be a shame because I 
really *did* want my Linux and Windows code to be common code (I'm using 
mingw for this reason).

    	Dan Miller

-------------------------------------------------------
This SF.Net email is sponsored by:
(Continue reading)

Ron Jackson | 2 Nov 2004 23:58

usb_interrupt_read failures further information

I've done some further testing of the interrupt read failures I reported
on October 11, using a low speed device on Windows XP.

I moved usb_interrupt_read() into a separate thread, and used a 0
(unlimited) timeout. This should get around the small timeout problem I
reported. I set up a loop in my code that uses a control transfer to
trigger my USB device to produce an interrupt report.

I am seeing usb_interrupt_read() freezing up (not returning) after an
average of 3,000 transfers (standard deviation 2480 on 23 runs). Before
freezing up, data is being transferred approximately every 10 mS,
occasionally longer. After usb_interrupt_read() freezes up my test
program process cannot be terminated by task manager and requires a
system reboot to clear the process. While running, the csrss.exe process
requires about 50% of the CPU time and my test program process requires
approximately 40%.

I have also tested my device using only control transfers. Data is
transferred approximately every 1 mS. After several million cycles there
have been no cases where the control transfer has failed to return data.
Processes for my test program and for csrss.exe consume only a few % of
the CPU time.

Below is the code for my interrupt read thread. I check the variable
readCount in my main loop to see if the thread has gotten control back
from usb_interrupt_read(). When it freezes, readCount shows that
usb_interrupt_read() hasn't returned control. My main loop always
empties the buffer before usb_interrupt_read() returns new data.

  -- Ron
(Continue reading)

Ron Bessems | 3 Nov 2004 00:46

Re: usb_interrupt_read failures further information

Yeah that sounds about the same as the problem that I am seeing. Are
there any diagnostics that we can run to start to pin down this little
bug?

- Ron

> I moved usb_interrupt_read() into a separate thread, and used a 0
> (unlimited) timeout. This should get around the small timeout problem I
> reported. I set up a loop in my code that uses a control transfer to
> trigger my USB device to produce an interrupt report.

> I am seeing usb_interrupt_read() freezing up (not returning) after an
> average of 3,000 transfers (standard deviation 2480 on 23 runs). Before
> freezing up, data is being transferred approximately every 10 mS,
> occasionally longer. After usb_interrupt_read() freezes up my test
> program process cannot be terminated by task manager and requires a
> system reboot to clear the process. While running, the csrss.exe process
> requires about 50% of the CPU time and my test program process requires
> approximately 40%.

> I have also tested my device using only control transfers. Data is
> transferred approximately every 1 mS. After several million cycles there
> have been no cases where the control transfer has failed to return data.
> Processes for my test program and for csrss.exe consume only a few % of
> the CPU time.

> Below is the code for my interrupt read thread. I check the variable
> readCount in my main loop to see if the thread has gotten control back
> from usb_interrupt_read(). When it freezes, readCount shows that
> usb_interrupt_read() hasn't returned control. My main loop always
(Continue reading)

Stephan Meyer | 4 Nov 2004 08:06
Picon

Re: usb_interrupt_read failures further information

I uploaded a new development snapshot (version 20041103) that
includes some minor bug fixes. Please give it a try.

Some notes about this update:

- if the filter and the device driver package are installed on your system 
then
both packages have to be updated

- if the device driver package is used then the .inf file from the new 
version
has to be used (and modified to match your device). The old one won't work
any more. This is because the name of the device driver has changed.
libusbfl.sys and libusbst.sys have been merged into a single driver 
(libusb0.sys).
The device(s) will also show up in the Device Manager under a new item 
called
"LibUsb-Win32 Devices". This change removes the annoying warning of WinXP
about "unsigned drivers" .

I also tried to reproduce the problem you described (see my test program 
below)
using this new version, but without any success. Everything seems to work 
as
expected.

Stephan

My interrupt/thread test code:

(Continue reading)

Ron Bessems | 4 Nov 2004 17:55

Re[2]: usb_interrupt_read failures further information

Hi Stephan,

Thanks for your help on this!

I have tried to install the new version however the install displays
an error:

--- Installer ---
Creating Kernel Service:
LIBUSB: error: usb_service_create(): creating service 'libusb0'
failed.
---

The install succeeds anyway but the test program fails.

--- Lib USB tester ---
DLL version:    0.1.8.1
Driver version: not running!
---

The service is running. I am on XP sp 2 and I'm only using the filter.
I did do an uninstall and reboot before I did the install.

- Ron

> I uploaded a new development snapshot (version 20041103) that
> includes some minor bug fixes. Please give it a try.

> Some notes about this update:

(Continue reading)

Brandon Philips | 4 Nov 2004 18:16

Re: usb_interrupt_read failures further information

> --- Installer ---
> Creating Kernel Service:
> LIBUSB: error: usb_service_create(): creating service 'libusb0'
> failed.
> ---

Maybe you need to go in and uninstall the device driver also?  Right
click on the device in the device managment program and click uninstall.

-Brandon

On 08:55 Thu 04 Nov     , Ron Bessems wrote:
> Hi Stephan,
> 
> Thanks for your help on this!
> 
> I have tried to install the new version however the install displays
> an error:
> 
> --- Installer ---
> Creating Kernel Service:
> LIBUSB: error: usb_service_create(): creating service 'libusb0'
> failed.
> ---
> 
> The install succeeds anyway but the test program fails.
> 
> --- Lib USB tester ---
> DLL version:    0.1.8.1
> Driver version: not running!
(Continue reading)

Ron Bessems | 4 Nov 2004 18:42

Re[2]: usb_interrupt_read failures further information

I tried to locate the LibUSB device in the device manager but it was
not there anymore, I guess it uninstalled correctly.

I did get it to install correctly here is what I had to do;

* uninstall the snapshot.
* install 0.1.8.0 (the release not the snapshot)
* During that install the host adapters where restarted!! The
snapshots don't do this.
* Then uninstall 0.1.8.0 and install the latest snapshot. Now it
works...

- Ron

Thursday, November 4, 2004, 9:16:43 AM, you wrote:

>> --- Installer ---
>> Creating Kernel Service:
>> LIBUSB: error: usb_service_create(): creating service 'libusb0'
>> failed.
>> ---

> Maybe you need to go in and uninstall the device driver also?  Right
> click on the device in the device managment program and click uninstall.

> -Brandon

> On 08:55 Thu 04 Nov     , Ron Bessems wrote:
>> Hi Stephan,
>> 
(Continue reading)

Ron Bessems | 4 Nov 2004 18:57

Re[3]: usb_interrupt_read failures further information

Okay, got everything to work except that the library doesn't return any
data during the usb_interrupt_read

code:
DWORD WINAPI event_reader(void *data)
{
        pEndPoint ep=(pEndPoint)data;
        char buffer[81];
        int r;

        while ( WaitForSingleObject(ep->StopEvent, 10 ) == WAIT_TIMEOUT ) 
        {
                r = usb_interrupt_read(ep->h, ep->bEndpointAddress, (char*)buffer, 80,1000) ;

                if ( r> 0 )
                {
                        buffer[r]=0;

                        print_hex(buffer, r);

                        if ( ep->bEndpointAddress == 0x82 )
                                recognize_button(buffer, r);

                        if ( ep->bEndpointAddress == 0x81 ) 
                                recognize_mouse(buffer, r);
                }

        }       

        printd("Thread %02x ending.\n", ep->bEndpointAddress);
(Continue reading)

Stephan Meyer | 4 Nov 2004 20:47
Picon

Re: Re[2]: usb_interrupt_read failures further information


> --- Installer ---
> Creating Kernel Service:
> LIBUSB: error: usb_service_create(): creating service 'libusb0'
> failed.

This was a stupid bug in the installer. I released a new snapshot. Please try it.

Stephan

-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click

Gmane