Skip to content
Snippets Groups Projects
Unverified Commit 1e00627a authored by Dean Camera's avatar Dean Camera Committed by GitHub
Browse files

Merge pull request #132 from erikarvstedt/update-pyusb

Update Python USB host examples, to be compatible with PyUSB >= 1.0.0.
parents 106f0eee 5bf9d47b
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
pattern on the target board. Send and received report data is printed to pattern on the target board. Send and received report data is printed to
the terminal. the terminal.
Requires the PyUSB library (http://sourceforge.net/apps/trac/pyusb/). Requires PyUSB >= 1.0.0 (https://github.com/pyusb/pyusb).
""" """
import sys import sys
...@@ -71,8 +71,8 @@ def main(): ...@@ -71,8 +71,8 @@ def main():
print("Connected to device 0x%04X/0x%04X - %s [%s]" % print("Connected to device 0x%04X/0x%04X - %s [%s]" %
(hid_device.idVendor, hid_device.idProduct, (hid_device.idVendor, hid_device.idProduct,
usb.util.get_string(hid_device, 256, hid_device.iProduct), usb.util.get_string(hid_device, hid_device.iProduct),
usb.util.get_string(hid_device, 256, hid_device.iManufacturer))) usb.util.get_string(hid_device, hid_device.iManufacturer)))
p = 0 p = 0
while (True): while (True):
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
receive a continuous stream of packets to/from to the device, to show receive a continuous stream of packets to/from to the device, to show
bidirectional communications. bidirectional communications.
Requires the pyUSB library (http://sourceforge.net/projects/pyusb/). Requires PyUSB >= 1.0.0 (https://github.com/pyusb/pyusb).
""" """
import sys import sys
...@@ -53,8 +53,8 @@ def main(): ...@@ -53,8 +53,8 @@ def main():
print("Connected to device 0x%04X/0x%04X - %s [%s]" % print("Connected to device 0x%04X/0x%04X - %s [%s]" %
(vendor_device.idVendor, vendor_device.idProduct, (vendor_device.idVendor, vendor_device.idProduct,
usb.util.get_string(vendor_device, 255, vendor_device.iProduct), usb.util.get_string(vendor_device, vendor_device.iProduct),
usb.util.get_string(vendor_device, 255, vendor_device.iManufacturer))) usb.util.get_string(vendor_device, vendor_device.iManufacturer)))
x = 0 x = 0
while 1: while 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment