Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usb.busses returns generator - needs to be a list #2

Closed
kda opened this issue Jan 30, 2015 · 4 comments
Closed

usb.busses returns generator - needs to be a list #2

kda opened this issue Jan 30, 2015 · 4 comments

Comments

@kda
Copy link

kda commented Jan 30, 2015

I'm using a newer version of PyUSB (http://walac.github.io/pyusb/) and it seems that 'usb.busses' returns a generator rather than a list. This simple patch seems to fix it for me.

diff --git a/powerusb/hidapi.py b/powerusb/hidapi.py
index e8e47322559c..a0d49c2a1c03 100644
--- a/powerusb/hidapi.py
+++ b/powerusb/hidapi.py
@@ -68,7 +68,7 @@ def hid_enumerate(vendor_id, product_id):
     hid_devices = []

-    busses = usb.busses()
+    busses = list(usb.busses())

     # check each bus
     for b_index in range(0, len(busses)):
@dirtbirb
Copy link

dirtbirb commented Dec 8, 2016

Worked for me, thanks! Using latest version of PyUSB as of this post.

@markllama
Copy link
Owner

markllama commented Dec 8, 2016 via email

@dirtbirb
Copy link

dirtbirb commented Dec 8, 2016

I made the change and submitted a pull request. Still learning Git, please let me know if there was a more direct way to attach the pull request to this issue! (Or if a pull request is even necessary for such a simple change)

@markllama
Copy link
Owner

Closed by contributed PR. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants