diff --git a/README.md b/README.md index 6c1aece..57613ad 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Supported devices: * [ANTUSB2 Stick](http://www.thisisant.com/developer/components/antusb2/) (0fcf:1008: Dynastream Innovations, Inc.) * [ANTUSB-m Stick](http://www.thisisant.com/developer/components/antusb-m/) (0fcf:1009: Dynastream Innovations, Inc.) +Warning: the [Cycplus ANT Stick](https://www.cycplus.com/products/ant-usb-stick-u1) is not compatible, even though it uses the same VID/PID as the ANTUSB2 Stick. + ## Running on Windows * Download the [standalone executable](https://github.com/oldnapalm/vpower/releases/latest) @@ -55,12 +57,4 @@ Supported devices: * Open Command Prompt, CD to the python-ant repo directory and run ``python setup.py install`` * Run ``pip install configparser pywin32`` * Clone or download this repo -* CD to the repo directory and run ``python vpower.py`` - -## Troubleshooting - -* USBError: could not claim interface - * Make sure the device is not in use by other app - * Unplug and replug the ANT+ stick -* Stuck on "Starting ANT node" - * Unplug and replug the ANT+ stick +* CD to the repo directory and run ``python vpower.py`` (or double click `vpower.py` if you installed the Python Launcher) diff --git a/bot.py b/bot.py index b8de5ab..a464843 100644 --- a/bot.py +++ b/bot.py @@ -30,17 +30,23 @@ def disable_event(): pass try: - devs = find(find_all=True) + devs = find(find_all=True, idVendor=0x0fcf) for dev in devs: - if dev.idVendor == 0x0fcf and dev.idProduct in [0x1008, 0x1009]: + if dev.idProduct in [0x1008, 0x1009]: + stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct, address=dev.address) + try: + stick.open() + except: + print("ANT device %s not available" % dev.address) + continue + stick.close() break else: - print("No ANT device found") + print("No ANT devices available") if getattr(sys, 'frozen', False): input() sys.exit() - stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct) antnode = node.Node(stick) print("Starting ANT node") antnode.start() diff --git a/cadence.py b/cadence.py index eb94a5e..6a3cabb 100644 --- a/cadence.py +++ b/cadence.py @@ -97,17 +97,23 @@ def on_exit(sig, func=None): win32api.SetConsoleCtrlHandler(on_exit, True) try: - devs = find(find_all=True) + devs = find(find_all=True, idVendor=0x0fcf) for dev in devs: - if dev.idVendor == 0x0fcf and dev.idProduct in [0x1008, 0x1009]: + if dev.idProduct in [0x1008, 0x1009]: + stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct, address=dev.address) + try: + stick.open() + except: + print("ANT device %s not available" % dev.address) + continue + stick.close() break else: - print("No ANT device found") + print("No ANT devices available") if getattr(sys, 'frozen', False): input() sys.exit() - stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct) antnode = node.Node(stick) print("Starting ANT node") antnode.start() diff --git a/heartrate.py b/heartrate.py index 2da110f..f3d4997 100644 --- a/heartrate.py +++ b/heartrate.py @@ -70,17 +70,23 @@ def heart_rate_data(computed_heartrate, event_time_ms, rr_interval_ms): last = t try: - devs = find(find_all=True) + devs = find(find_all=True, idVendor=0x0fcf) for dev in devs: - if dev.idVendor == 0x0fcf and dev.idProduct in [0x1008, 0x1009]: + if dev.idProduct in [0x1008, 0x1009]: + stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct, address=dev.address) + try: + stick.open() + except: + print("ANT device %s not available" % dev.address) + continue + stick.close() break else: - print("No ANT device found") + print("No ANT devices available") if getattr(sys, 'frozen', False): input() sys.exit() - stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct) antnode = node.Node(stick) print("Starting ANT node") antnode.start() diff --git a/row.py b/row.py index 34bcdf2..9049b31 100644 --- a/row.py +++ b/row.py @@ -43,17 +43,23 @@ def on_exit(sig, func=None): print("Connected to erg") # Starting ANT node - devs = find(find_all=True) + devs = find(find_all=True, idVendor=0x0fcf) for dev in devs: - if dev.idVendor == 0x0fcf and dev.idProduct in [0x1008, 0x1009]: + if dev.idProduct in [0x1008, 0x1009]: + stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct, address=dev.address) + try: + stick.open() + except: + print("ANT device %s not available" % dev.address) + continue + stick.close() break else: - print("No ANT device found") + print("No ANT devices available") if getattr(sys, 'frozen', False): input() sys.exit() - stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct) antnode = node.Node(stick) print("Starting ANT node") antnode.start() diff --git a/vpower.py b/vpower.py index 5867520..f8d5ad0 100644 --- a/vpower.py +++ b/vpower.py @@ -38,17 +38,23 @@ def on_exit(sig, func=None): try: print("Using " + POWER_CALCULATOR.__class__.__name__) - devs = find(find_all=True) + devs = find(find_all=True, idVendor=0x0fcf) for dev in devs: - if dev.idVendor == 0x0fcf and dev.idProduct in [0x1008, 0x1009]: + if dev.idProduct in [0x1008, 0x1009]: + stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct, address=dev.address) + try: + stick.open() + except: + print("ANT device %s not available" % dev.address) + continue + stick.close() break else: - print("No ANT device found") + print("No ANT devices available") if getattr(sys, 'frozen', False): input() sys.exit() - stick = driver.USB2Driver(log=LOG, debug=DEBUG, idProduct=dev.idProduct) antnode = node.Node(stick) print("Starting ANT node") antnode.start()