richrd / nxt-python

Automatically exported from code.google.com/p/nxt-python
GNU General Public License v3.0
1 stars 0 forks source link

usb reset() breaks libusb-win32 (tiny patch included) #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install libusb-win32 (on 32-bit or 64-bit Windows)
2. try to connect to NXT
3. connection fails because usb device is unconfigured

What version of nxt-python are you using? On what operating system?
nxt-python 2.2.0 on Win7 x64

Please provide any additional information below.

patch for usbsock.py:
>import os
...
def connect(self):
  ...
  >if os.name != 'nt':
    self.handle.reset()

see http://sourceforge.net/apps/trac/libusb-win32/wiki/libusbwin32_documentation
usb_reset() ... "Causes re-enumeration: After calling usb_reset, the device 
will need to re-enumerate and thus requires you to find the new device and open 
a new handle. The handle used to call usb_reset() will no longer work."

Original issue reported on code.google.com by paulholl...@gmail.com on 7 Oct 2011 at 7:55

GoogleCodeExporter commented 9 years ago
While I hate to add OS-specific hacks, it looks like this one is needed. The 
trunk has been patched in r372 and this change will be included in the next 
bugfix version. Thanks!

Original comment by marcus@wanners.net on 9 Oct 2011 at 6:40

GoogleCodeExporter commented 9 years ago
Thank you!  Trying to get my lab to move from matlab to python ...
Maybe one day I'll get them to join me in the land of linux :)

Original comment by paulholl...@gmail.com on 9 Oct 2011 at 11:34