-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explain Windows 0 devices issue #11 to the user. Do not crash on 0 de…
…vices. Improve import errors. Add a test-detection script.
- Loading branch information
Showing
4 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
''' | ||
If 0 devices are listed and you are using Windows, see Windows section | ||
of readme. | ||
''' | ||
# <https://www.orangecoat.com/how-to/use-pyusb-to-find-vendor-and-product- | ||
# ids-for-usb-devices> | ||
|
||
|
||
import sys | ||
import usb.core | ||
# find USB devices | ||
dev = usb.core.find(find_all=True) | ||
# loop through devices, printing vendor and product ids in decimal and hex | ||
count = 0 | ||
for cfg in dev: | ||
count += 1 | ||
sys.stdout.write('Decimal VendorID=' + str(cfg.idVendor) + ' & ProductID=' + str(cfg.idProduct) + '\n') | ||
sys.stdout.write('Hexadecimal VendorID=' + hex(cfg.idVendor) + ' & ProductID=' + hex(cfg.idProduct) + '\n\n') | ||
print("Found {}".format(count)) | ||
if count == 0: | ||
print(__doc__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters