Dan Ellis | 2 Jun 2006 17:24

Fix for coming out of standby

After much exploration I've discovered the cause of the inability for
some laptops to coming out of standby is.

The power irp for changing device state is being issued in the
completion routine for the system power irp, and then the thread is
blocked waiting for the device power irp to complete.

Before the blocking takes place, the power manager attempts to send the
irp all the way, the power dispatcher sees the device power irp, and
tries to send it down the stack, but the usbhub below returns status
pending so the completion handler isn't called at that point.

The libusb thread then blocks waiting for the irp to complete, but it
never does because the thread which would go on to call the completion
routing is being blocked!

Replacing the call to on_power_set_device_state_complete with :

power_state.DeviceState =
dev->device_power_states[power_state.SystemState];

/* set the device power state and don't wait for completion */

(void) PoRequestPowerIrp(dev->physical_device_object, 
                         IRP_MN_SET_POWER, 
                         power_state,
                         NULL,
                         NULL, NULL);

Seems to resolve the problem.
(Continue reading)

Stephan Meyer | 6 Jun 2006 18:28
Picon

Re: Fix for coming out of standby


Thanks for the patch, Dan. I'll apply it by adding a third parameter
to power_set_device_state():

void power_set_device_state(libusb_device_t *dev, 
                            DEVICE_POWER_STATE device_state, bool_t block)
{
  NTSTATUS status;
  KEVENT event;
  POWER_STATE power_state;

  power_state.DeviceState = device_state;

  if(block) /* wait for IRP to complete */
    {
      KeInitializeEvent(&event, NotificationEvent, FALSE);

      /* set the device power state and wait for completion */
      status = PoRequestPowerIrp(dev->physical_device_object, 
                                 IRP_MN_SET_POWER, 
                                 power_state,
                                 on_power_set_device_state_complete, 
                                 &event, NULL);

      if(status == STATUS_PENDING)
        {
          KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
        }
    }
  else
(Continue reading)

Stephan Meyer | 6 Jun 2006 19:04
Picon

FW: SUBJECT: SourceForge.net: CVS service offering changes


FYI.

Greetings,

You are receiving this mail because you are a project admin for
a SourceForge.net-hosted project. One of our primary services,
CVS, suffered a series of interrelated, critical hardware failures
in recent weeks. We understand how frustrating this CVS outage
must be to you and your users; however, our top priority remains
preservation of the integrity of your data.

The series of CVS hardware failures prompted us to expedite the
deployment of planed improvements to our CVS infrastructure,
drawing upon much of the knowledge that we gained from our
Subversion deployment. Our improved CVS service architecture,
which we plan to deploy tomorrow afternoon (2006-05-12), will
offer greater performance and stability and will eliminate several
single points of failure.

The Site Status page (https://www.sf.net/docs/A04) will be
updated as soon as the new infrastructure is rolled out. In the
interim, please read the important information provided below
to learn about how these changes will affect your project.

Summary of changes, effective 2006-05-12:

1. Hostname for CVS service

Old: cvs.sourceforge.net
(Continue reading)

taneem khurshed | 7 Jun 2006 10:49
Picon
Favicon

making USB drive write protected

Hi all,
 I am very new in developing applications for USB. I
am  just trying to give it a start. I am trying this
library to develop a software of mine. What I want is
to make my USB ZIP drive write protected on and off
through this library. Is it  possible? If yes, can
someone pls give me some starting boost with some
example source code? Thank you all in advance. Your
help will be really appreciated.  

Regards
Taneem Khurshed

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Ray Schumacher | 8 Jun 2006 20:05
Favicon

libusb-win32-snapshots on WinXP fails with pyUSB

I just tried installing the 20060518 release (after uninstalling what I could of 0.1.10.1)
the test showed  0.1.10.2; running gives an "ordinal xx not found in libusb0" error

I'm presuming that I need to compile pyUSB with the newest win32-libusb sources, correct?

Any suggestions for upgrade procedure?
I just wanted to be sure that I had the latest bug fixes from libUSB, as I'm debugging this Python app with a TI device. (I'm getting data drops)
Using a new Tyan MB  and Opteron

Thanks,
Ray
<div>
I just tried installing the
<a href="http://sourceforge.net/project/showfiles.php?group_id=78138&amp;package_id=121441&amp;release_id=417945">
20060518</a> release (after uninstalling what I could of 0.1.10.1)<br>
the test showed&nbsp; 0.1.10.2; running gives an "ordinal xx not
found in libusb0" error<br><br>
I'm presuming that I need to compile pyUSB with the newest win32-libusb
sources, correct?<br><br>
Any suggestions for upgrade procedure?<br>
I just wanted to be sure that I had the latest bug fixes from libUSB, as
I'm debugging this Python app with a TI device. (I'm getting data
drops)<br>
Using a new Tyan MB&nbsp; and Opteron<br><br>
Thanks,<br>
Ray</div>
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Dan Ellis | 9 Jun 2006 11:40

Re: libusb-win32-snapshots on WinXP fails withpyUSB

That's correct, you need to rebuild pyusb with the .lib file from the release (you don't need to worry about the actual sources to the library or the driver).
 
To rebuild you just execute setup.py for pyusb.
 
Dan.

From: libusb-win32-devel-bounces <at> lists.sourceforge.net [mailto:libusb-win32-devel-bounces <at> lists.sourceforge.net] On Behalf Of Ray Schumacher
Sent: 08 June 2006 19:05
To: libusb-win32-devel <at> lists.sourceforge.net
Subject: [Libusb-win32-devel] libusb-win32-snapshots on WinXP fails withpyUSB

I just tried installing the 20060518 release (after uninstalling what I could of 0.1.10.1)
the test showed  0.1.10.2; running gives an "ordinal xx not found in libusb0" error

I'm presuming that I need to compile pyUSB with the newest win32-libusb sources, correct?

Any suggestions for upgrade procedure?
I just wanted to be sure that I had the latest bug fixes from libUSB, as I'm debugging this Python app with a TI device. (I'm getting data drops)
Using a new Tyan MB  and Opteron

Thanks,
Ray
<div>
<div dir="ltr" align="left"><span class="299313809-09062006">That's correct, you need to rebuild pyusb with the .lib 
file from the release (you don't need to worry about the actual sources to the 
library or the driver).</span></div>
<div dir="ltr" align="left">
<span class="299313809-09062006"></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="299313809-09062006">To rebuild you just execute setup.py for 
pyusb.</span></div>
<div dir="ltr" align="left">
<span class="299313809-09062006"></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="299313809-09062006">Dan.</span></div>
<br><div class="OutlookMessageHeader" lang="en-us" dir="ltr" align="left">
From: 
libusb-win32-devel-bounces <at> lists.sourceforge.net 
[mailto:libusb-win32-devel-bounces <at> lists.sourceforge.net] On Behalf Of 
Ray Schumacher<br>Sent: 08 June 2006 19:05<br>To: 
libusb-win32-devel <at> lists.sourceforge.net<br>Subject: [Libusb-win32-devel] 
libusb-win32-snapshots on WinXP fails withpyUSB<br><br>
</div>
<div></div>I just tried installing the <a href="http://sourceforge.net/project/showfiles.php?group_id=78138&amp;package_id=121441&amp;release_id=417945">20060518</a> 
release (after uninstalling what I could of 0.1.10.1)<br>the test showed&nbsp; 
0.1.10.2; running gives an "ordinal xx not found in libusb0" error<br><br>I'm 
presuming that I need to compile pyUSB with the newest win32-libusb sources, 
correct?<br><br>Any suggestions for upgrade procedure?<br>I just wanted to be 
sure that I had the latest bug fixes from libUSB, as I'm debugging this Python 
app with a TI device. (I'm getting data drops)<br>Using a new Tyan MB&nbsp; and 
Opteron<br><br>Thanks,<br>Ray </div>
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Gopal Santhanam | 9 Jun 2006 20:49

Limit on Maximum Asynchronous URBs

Hi all,

I did some poking around on the web but have had a hard time finding an answer 
to this question.  Maybe someone here knows.

Is there a maximum number of URBs that can be submitted to an endpoint / 
interface / device at any given time?  For example, can I submit 1024 URBs 
each with 16 KB data to a read endpoint or will I be restricted by the driver 
stack, host controller, or something else?  If there is such a restriction, 
does it apply to the device as a whole, just the interface, or just the 
endpoint?

Any insights would be much appreciated.

Best regards,
Gopal
Stephan Meyer | 13 Jun 2006 19:18
Picon

Re: Limit on Maximum Asynchronous URBs


Libusb's kernel driver doesn't have any built-in limitations because
it doesn't internally queue any data. It just allocates an URB for each
userspace request and passes that URB down the stack.

But it should be obvious that the host controller driver has to queue
these request and that the size of this queue is limited since kernel 
memory is a limited resource.

I wrote a small test program (see attachment) to see how many requests
Windows' USB stack can handle at once. And the limit on WinXP-SP2 
(with 1GB of RAM) seems to be exactly 2500 URBs regardless of the URB's 
data size.

The maximum amount of data I was able to request at once with the test 
program was 2500 URB each with 64kB of data. That's more than 150MB!

This limit may depend on the host controller driver and the Windows version.

Stephan

> Hi all,
> 
> I did some poking around on the web but have had a hard time finding an answer 
> to this question.  Maybe someone here knows.
> 
> Is there a maximum number of URBs that can be submitted to an endpoint / 
> interface / device at any given time?  For example, can I submit 1024 URBs 
> each with 16 KB data to a read endpoint or will I be restricted by the driver 
> stack, host controller, or something else?  If there is such a restriction, 
> does it apply to the device as a whole, just the interface, or just the 
> endpoint?
> 
> Any insights would be much appreciated.
> 
> Best regards,
> Gopal
> 
> 
> _______________________________________________
> Libusb-win32-devel mailing list
> Libusb-win32-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

__________________________________________________________________________
Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!		
Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131


#include <stdio.h>
#include "main.h"

#define NUM_PACKETS 1024
#define PACKET_SIZE (16 * 1024)

int main(int argc, char **argv)
{
  usb_dev_handle *dev;
  int i;
  char tmp[PACKET_SIZE];
  void *packets[NUM_PACKETS];

  usb_init();
  usb_set_debug(4);
  usb_find_busses();
  usb_find_devices();

  dev = usb_open_test_device(0);
  usb_set_configuration(dev, 1);
  usb_claim_interface(dev, 0);
  usb_set_altinterface(dev, 2);

  for(i = 0; i < NUM_PACKETS; i++)
    {
      if(usb_bulk_setup_async(dev, &packets[i], 0x82) < 0)
        {
          printf("allocating packet %d failed\n", i);
          return 0;
        }
    }

  for(i = 0; i < NUM_PACKETS; i++)
    {
      if(usb_submit_async(packets[i], tmp, sizeof(tmp)) < 0)
        {
          printf("submitting packet %d failed\n", i);
          return 0;
        }
    }

  for(i = 0; i < NUM_PACKETS; i++)
    {
      if(usb_reap_async(packets[i], 5000) != sizeof(tmp))
        {
          printf("reaping packet %d failed\n", i);
          return 0;
        }
    }

  for(i = 0; i < NUM_PACKETS; i++)
    {
      usb_free_async(&packets[i]);
    }

  usb_release_interface(dev, 0);

  usb_close(dev);
  return 0;
}


#include <stdio.h>
#include "main.h"

#define NUM_PACKETS 1024
#define PACKET_SIZE (16 * 1024)

int main(int argc, char **argv)
{
  usb_dev_handle *dev;
  int i;
  char tmp[PACKET_SIZE];
  void *packets[NUM_PACKETS];

  usb_init();
  usb_set_debug(4);
  usb_find_busses();
  usb_find_devices();

  dev = usb_open_test_device(0);
  usb_set_configuration(dev, 1);
  usb_claim_interface(dev, 0);
  usb_set_altinterface(dev, 2);

  for(i = 0; i < NUM_PACKETS; i++)
    {
      if(usb_bulk_setup_async(dev, &packets[i], 0x82) < 0)
        {
          printf("allocating packet %d failed\n", i);
          return 0;
        }
    }

  for(i = 0; i < NUM_PACKETS; i++)
    {
      if(usb_submit_async(packets[i], tmp, sizeof(tmp)) < 0)
        {
          printf("submitting packet %d failed\n", i);
          return 0;
        }
    }

  for(i = 0; i < NUM_PACKETS; i++)
    {
      if(usb_reap_async(packets[i], 5000) != sizeof(tmp))
        {
          printf("reaping packet %d failed\n", i);
          return 0;
        }
    }

  for(i = 0; i < NUM_PACKETS; i++)
    {
      usb_free_async(&packets[i]);
    }

  usb_release_interface(dev, 0);

  usb_close(dev);
  return 0;
}

_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Andrew Xiang | 14 Jun 2006 21:54

who does the set_address?

I am not getting the set_address command on my SAM7S device by running the
libusb kernel mode driver.
If the address is not set, the device does not get setup properly.

I did get the set_address command if I used the driver from the atmel, but
that driver only comes with binary and functions limited.

Who is responsible for sending out the set_address?

thanks
Andrew
Gopal Santhanam | 14 Jun 2006 23:47

Re: Limit on Maximum Asynchronous URBs

Thank you Stephan.  That information is useful.

One question though.  I wasn't aware that the maximum URB size was 64 kB in 
Windows.  Is this true?  In Linux I believe the maximum is 16384 (and only 
with Kernel versions 2.6 and up).

Gopal

On Tuesday 13 June 2006 10:18, Stephan Meyer wrote:
> Libusb's kernel driver doesn't have any built-in limitations because
> it doesn't internally queue any data. It just allocates an URB for each
> userspace request and passes that URB down the stack.
>
> But it should be obvious that the host controller driver has to queue
> these request and that the size of this queue is limited since kernel
> memory is a limited resource.
>
> I wrote a small test program (see attachment) to see how many requests
> Windows' USB stack can handle at once. And the limit on WinXP-SP2
> (with 1GB of RAM) seems to be exactly 2500 URBs regardless of the URB's
> data size.
>
> The maximum amount of data I was able to request at once with the test
> program was 2500 URB each with 64kB of data. That's more than 150MB!
>
> This limit may depend on the host controller driver and the Windows
> version.
>
>
> Stephan
>
> > Hi all,
> >
> > I did some poking around on the web but have had a hard time finding an
> > answer to this question.  Maybe someone here knows.
> >
> > Is there a maximum number of URBs that can be submitted to an endpoint /
> > interface / device at any given time?  For example, can I submit 1024
> > URBs each with 16 KB data to a read endpoint or will I be restricted by
> > the driver stack, host controller, or something else?  If there is such a
> > restriction, does it apply to the device as a whole, just the interface,
> > or just the endpoint?
> >
> > Any insights would be much appreciated.
> >
> > Best regards,
> > Gopal
> >
> >
> > _______________________________________________
> > Libusb-win32-devel mailing list
> > Libusb-win32-devel <at> lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
>
> __________________________________________________________________________
> Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach!
> Mehr Infos unter http://freemail.web.de/home/landingpad/?mc=021131

Gmane