Switch to IPv4 zeroconf, add test framework with discovery test, fix serial enumeration
This commit is contained in:
@@ -92,3 +92,7 @@ func (c *Client) PICOBOOT() error {
|
||||
func (c *Client) Info() (*ResponseInfo, error) {
|
||||
return roundTrip[ResponseInfo](c, &RequestInfo{})
|
||||
}
|
||||
|
||||
func (c *Client) Test(name string) (*ResponseTest, error) {
|
||||
return roundTrip[ResponseTest](c, &RequestTest{Name: name})
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package client
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.bug.st/serial"
|
||||
@@ -16,7 +17,7 @@ func ListSerial() ([]string, error) {
|
||||
}
|
||||
var result []string
|
||||
for _, p := range ports {
|
||||
if p.IsUSB {
|
||||
if p.IsUSB && p.VID == "2E8A" && strings.HasPrefix(p.Name, "/dev/cu.") {
|
||||
result = append(result, p.Name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,19 @@ type RequestInfo struct{}
|
||||
type ResponseInfo struct {
|
||||
BoardID [8]byte
|
||||
MAC [6]byte
|
||||
LinkLocal [16]byte
|
||||
IP [4]byte
|
||||
FirmwareName string
|
||||
}
|
||||
|
||||
type RequestTest struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
type ResponseTest struct {
|
||||
Pass bool
|
||||
Messages []string
|
||||
}
|
||||
|
||||
type DeviceError struct {
|
||||
Code uint32
|
||||
Message string
|
||||
@@ -35,4 +44,6 @@ func init() {
|
||||
msgpack.RegisterExt(3, (*ResponsePICOBOOT)(nil))
|
||||
msgpack.RegisterExt(4, (*RequestInfo)(nil))
|
||||
msgpack.RegisterExt(5, (*ResponseInfo)(nil))
|
||||
msgpack.RegisterExt(127, (*RequestTest)(nil))
|
||||
msgpack.RegisterExt(126, (*ResponseTest)(nil))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user