No dongle -- no exception

Post here to get support
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: No dongle -- no exception

Post by whoenig »

One more idea: If you run 64-bit Windows7 and 32-bit python, you would like to have your libusb0.dll in C:\Windows\SysWOW64 instead.
hdmathias
Member
Posts: 47
Joined: Sat Nov 01, 2014 3:24 pm
Location: Florida, USA

Re: No dongle -- no exception

Post by hdmathias »

I have libusb0.dll in both Windows/System32 and Windows/SysWOW64. However, libusb0.sys lives only in Windows/System32/drivers, not in Windows/SysWOW64/drivers. Based on the README file in the libusb distribution, this seems right to me but I could me mistaken. Also, is there supposed to be a .inf file for Crazyradio? if so, where should it live?

What's curious is that despite the fact that libusb0.dll lives in Windows/SysWOW64, it isn't found when I run ramp.py. The one found is in System32. I fact, I can't see that it checks for libusb0.dll in SysWOW64.

Related to your previous post, on the line in crazyradio.py: import usb.backend.libusb0 as libusb0
I get an exception: No module named libusb0

Does this indicate a problem with my installation?
hdmathias
Member
Posts: 47
Joined: Sat Nov 01, 2014 3:24 pm
Location: Florida, USA

Re: No dongle -- no exception

Post by hdmathias »

Following up on this from earlier:

>>>Related to your previous post, on the line in crazyradio.py: import usb.backend.libusb0 as libusb0
>>>I get an exception: No module named libusb0

In the c:\Python27\Lib\site-packages\usb\backend directory, I have libusb01.py, libusb10.py and openusb.py but not libusb0.py

So, in the crazyradio.py line quoted above, I changed usb.backend.libusb0 to usb.backend.libusb10. Doing this allowed the system to see the Crazyflie but it failed to connect:
Updating dongle settings
Connecting to radio://0/10/250K
Connection to radio://0/10/250K failed: Dongle communication error (ackStatus==None)

While Updating dongle settings, there were MANY exceptions in this code from util.py
def desc_iter(k, v):
for d in desc:
if (custom_match is None or custom_match(d)) and \
_interop._reduce(
lambda a, b: a and b,
map(
operator.eq,
v,
map(lambda i: getattr(d, i), k)
),
True
):
yield d

So many that I finally disabled exceptions. After doing that, I got the connection failure above.

Do I need a file called libusb0.py in usb\backend or should the program find one of the other files that is already there when it does that import? At least this is progress. Or I hope it is.
hdmathias
Member
Posts: 47
Joined: Sat Nov 01, 2014 3:24 pm
Location: Florida, USA

Re: No dongle -- no exception

Post by hdmathias »

Another update. I found a distribution of pyusb 1.0 that includes libusb0.py in usb\backend. I installed it. Now when I run ramp.py, the dongle isn't found. Doesn't seem like progress. :(

The version of pyusb I just installed is at: https://github.com/walac/pyusb

Back to the drawing board.

Edited with good news!: I reverted to the previous version of pyusb, did a reinstall of the Crazyflie distribution and changed the import of usb.backend.libusb0 to usb.backend.libusb10 and it works!! I guess the key was reinstalling Crazyflie.

I'm still interested in figuring out why changing the line in crazyradio.py is necessary -- in other words, what's wrong with my installation? But I'm thrilled that it works.

BIG thanks to whoenig for all of his help. You went above and beyond.
whoenig
Expert
Posts: 395
Joined: Mon Oct 27, 2014 2:55 am

Re: No dongle -- no exception

Post by whoenig »

Yeah! Congratulations! I don't really understand why the Crazyflie distribution works and ramp.py only with this change. It sounds like your PYTHONPATH (that is where python looks to find modules like libusb) is for some reason different in the two scenarios. Not sure how that can happen though...
Post Reply