Python Libraries

We've released python libraries to make it lighting fast to start automating test and development tasks with a Binho Multi-Protocol USB Host Adapter. The packaged releases contains two libraries:

binhoHostAdapter

This library is essentially a wrapper for all of the commands presented in the ASCII Command Set documentation. The library is written in such a way to support multiple devices as well as properly handling INTERRUPTS by making use of threads.

binhoUtilities

This library provides a handful of functions which aid in device management, as in identifying COM ports and Binho devices attached to the host computer.

Here's where the releases live:

And here's the source code repository:

Installation

The officially-supported Python library can easily be installed using pip:

pip install binho-host-adapter

This library is cross-platform and is intended for use with Python 3.x.

Example Usage

from binhoHostAdapter import binhoHostAdapter
from binhoHostAdapter import binhoUtilities
print("Demo Script with Binho Host Adapter Python Libraries")
print
utilities = binhoUtilities.binhoUtilities()
devices = utilities.listAvailableDevices()
if len(devices) == 0:
print("No Devices Found!")
exit()
elif len(devices) == 1:
COMPORT = devices[0]
print("Found 1 attached adapter @ " + devices[0])
print
else:
COMPORT = devices[0]
print("Found more than 1 attached adapter, using first device found on " + COMPORT)
print
print("Opening " + COMPORT + "...")
print
# create the binhoHostAdapter object
binho = binhoHostAdapter.binhoHostAdapter(COMPORT)
print("Connecting to host adapter...")
print(binho.getDeviceID())
print

There are also many examples of the python libraries in action in the examples section of the support portal:

API Reference

The library contains two classes, each with a distinct purpose. Please see the following pages for the documentation on each of these classes:

Functions to connect to a host adapter and interact with it

Utility functions for device discovery and management: