On Tue, Oct 30, 2012 at 3:20 PM, Tormod Volden wrote:
> On Tue, Oct 30, 2012 at 3:06 PM, Stefano Di Martino wrote:
>> Well it did blow things up. Sorry for bothering you guys. :-(
>> But thanks for your help!!
>
> OK, but it should not blow up because of this. IMO pyusb should either
> guard against this, or give a warning or a better error message. Can
> you please tell what the device returns when you ask it for the 510
> bytes descriptor?

Before you go on to USB sniffing, maybe it will be enough to see what
libusb and libusbx are returning, to determine if there is a bug in
pyusb or libusbx. Can you please apply the below patch to pyusb and
run your test both with libusb and libusbx?

Tormod


diff --git a/usb/backend/libusb1.py b/usb/backend/libusb1.py
index 8bf9515..bedb258 100644
--- a/usb/backend/libusb1.py
+++ b/usb/backend/libusb1.py
@@ -598,6 +598,8 @@ class _LibUSB(usb.backend.IBackend):
         if usb.util.ctrl_direction(bmRequestType) == usb.util.CTRL_OUT:
             return ret.value
         else:
+            if (bRequest == 0x06) and ((wValue >> 8) == 0x03) and
((wValue & 0xff) != 0):
+                print "DEBUG:", data_or_wLength, length, ret.value, buff
             return buff[:ret.value]

     @methodtrace(_logger)

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to