gotmc / usbtmc Goto Github PK
View Code? Open in Web Editor NEWGo library to communicate with a USB Test and Measurement Class (USBTMC) interface
License: MIT License
Go library to communicate with a USB Test and Measurement Class (USBTMC) interface
License: MIT License
In device.go
the Read(p []byte)
method uses a fixed length of 1024 to read the USBTMC bulk-in endpoint. Seems like I should refactor this.
Add USBTMC driver (usbtmc/driver/gousb
) for the github.com/google/gousb
Go-based libusb driver.
Add a USBTMC driver (usbtmc/driver/libusb
) for the github.com/gotmc/libusb
Go-based libusb driver.
A MWE:
package main
import (
"log"
"github.com/gotmc/usbtmc"
_ "github.com/gotmc/usbtmc/driver/truveris"
)
func main() {
ctx, err := usbtmc.NewContext()
if err != nil {
log.Fatal(err)
}
ctx.SetDebugLevel(1)
}
Output:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x49c9c0]
goroutine 1 [running]:
<>/vendor/github.com/gotmc/usbtmc.NewContext(0x4c92e0, 0x78a790, 0x0)
/media/psf/Home/go/src/<>/vendor/github.com/gotmc/usbtmc/context.go:20 +0x70
main.main()
/media/psf/Home/go/src/<>/cmd/ldctest/main.go:19 +0x26
This is without any of the other drivers installed. If I uninstall this driver and install another, I get the same segfault with the other two.
Instead of calling log.Fatal()
, return an error, so that the end-user's higher level application can decide how to handle.
It appears the Agilent/Keysight U2751A 4x8 2-wire switch matrix uses usbtmc-usb488 subclass.
I don't want users to have to constantly append "\n" to their queries or string writers.
regString := ^(?P<interfaceType>[A-Za-z]+)(?P<boardIndex>\d*)::
+
(?P<manufacturerID>[^\s:]+)::
+
(?P<modelCode>[^\s:]+)
+
(::(?P<serialNumber>[^\s:]+))?
+
::(?P<resourceClass>[^\s:]+)$
there is some error in this regString, when parse the string USB0::0x0957::0x2007::MY57004760::0::INSTR
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.