Go library to communicate with a USB Test and Measurement Class (USBTMC) enabled USB device.
USBTMC is a USB device class specification for test equiment and instrumentation devices, such as oscilloscopes, digital multimeters, and function generators. USBTMC requires three endpoints:
- Control endpoint
- Bulk-OUT endpoint
- Bulk-IN endpoint
Additionally, the USBTMC subclass USB488 has an Interrupt-IN endpoint.
- Interface class = 0xFE (application-specific)
- Interface subclass = 0x03 (indicates USBTMC)
$ go get github.com/gotmc/usbtmc
To use the usbtmc package, you must register which Go-based libusb interface library should be used. libusb is "a C library that provides generic access to USB devices." There are two Go-based libusb hardware interface libraries available:
- github.com/google/gousb
- github.com/gotmc/libusb — Not working currently
You'll need to install one of the above libraries using:
$ go get -v github.com/google/gousb
$ go get -v github.com/gotmc/gotmc
To indicate which libusb interface library should be used, include one of the following blank imports:
import _ "github.com/gotmc/usbtmc/driver/google"
import _ "github.com/gotmc/usbtmc/driver/gotmc"
Documentation can be found at either:
- https://godoc.org/github.com/gotmc/usbtmc
- http://localhost:6060/pkg/github.com/gotmc/usbtmc/ after running
$ godoc -http=:6060
To contribute, please fork the repository, create a feature branch, and then submit a pull request.
Prior to submitting a pull request, please run:
$ make check
To update and view the test coverage report:
$ make cover
While this package works, it does not fully implement the USBTMC specification. Please submit pull requests as needed to increase functionality, maintainability, or reliability.
usbtmc is released under the MIT license. Please see the LICENSE.txt file for more information.