From f530b6782b8b70163fe4629d0741dfc319f66f8b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Aug 2022 10:34:54 +0200 Subject: [PATCH 1/8] Upgrade go version to 1.18.5 --- .github/workflows/check-go-dependencies-task.yml | 2 +- .github/workflows/check-go-task.yml | 2 +- DistTasks.yml | 2 +- go.mod | 2 +- go.sum | 7 ------- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check-go-dependencies-task.yml b/.github/workflows/check-go-dependencies-task.yml index 502bc41..592f0b0 100644 --- a/.github/workflows/check-go-dependencies-task.yml +++ b/.github/workflows/check-go-dependencies-task.yml @@ -3,7 +3,7 @@ name: Check Go Dependencies env: # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax - GO_VERSION: "1.17" + GO_VERSION: "1.18.5" # See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows on: diff --git a/.github/workflows/check-go-task.yml b/.github/workflows/check-go-task.yml index 9008eae..cd75a33 100644 --- a/.github/workflows/check-go-task.yml +++ b/.github/workflows/check-go-task.yml @@ -3,7 +3,7 @@ name: Check Go env: # See: https://github.com/actions/setup-go/tree/main#supported-version-syntax - GO_VERSION: "1.17" + GO_VERSION: "1.18.5" # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: diff --git a/DistTasks.yml b/DistTasks.yml index 3f326b3..f75d1d1 100644 --- a/DistTasks.yml +++ b/DistTasks.yml @@ -19,7 +19,7 @@ version: "3" vars: CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild" - GO_VERSION: "1.17.5" + GO_VERSION: "1.18.5" CHECKSUM_FILE: "{{.VERSION}}-checksums.txt" tasks: diff --git a/go.mod b/go.mod index 1d111f8..4669b57 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/arduino/serial-monitor -go 1.17 +go 1.18 require ( github.com/arduino/pluggable-monitor-protocol-handler v0.9.2 diff --git a/go.sum b/go.sum index 630602b..e513104 100644 --- a/go.sum +++ b/go.sum @@ -2,7 +2,6 @@ github.com/arduino/pluggable-monitor-protocol-handler v0.9.2 h1:vb5AmE3bT9we5Ej4 github.com/arduino/pluggable-monitor-protocol-handler v0.9.2/go.mod h1:vMG8tgHyE+hli26oT0JB/M7NxUMzzWoU5wd6cgJQRK4= github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0= github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -11,15 +10,9 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.bug.st/serial v1.3.5 h1:k50SqGZCnHZ2MiBQgzccXWG+kd/XpOs1jUljpDDKzaE= go.bug.st/serial v1.3.5/go.mod h1:z8CesKorE90Qr/oRSJiEuvzYRKol9r/anJZEb5kt304= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 4c90c9f090dba0b38cf89eca628126a2da5c6813 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Aug 2022 10:50:25 +0200 Subject: [PATCH 2/8] Simplified access to config parameter --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 8416e39..56542c2 100644 --- a/main.go +++ b/main.go @@ -99,18 +99,18 @@ func (d *SerialMonitor) Describe() (*monitor.PortDescriptor, error) { // Configure is the handler for the pluggable-monitor CONFIGURE command func (d *SerialMonitor) Configure(parameterName string, value string) error { - if d.serialSettings.ConfigurationParameter[parameterName] == nil { + parameter, ok := d.serialSettings.ConfigurationParameter[parameterName] + if !ok { return fmt.Errorf("could not find parameter named %s", parameterName) } - values := d.serialSettings.ConfigurationParameter[parameterName].Values - for _, i := range values { + for _, i := range parameter.Values { if i == value { - oldValue := d.serialSettings.ConfigurationParameter[parameterName].Selected - d.serialSettings.ConfigurationParameter[parameterName].Selected = value + oldValue := parameter.Selected + parameter.Selected = value if d.openedPort { err := d.serialPort.SetMode(d.getMode()) if err != nil { - d.serialSettings.ConfigurationParameter[parameterName].Selected = oldValue + parameter.Selected = oldValue return errors.New(err.Error()) } } From 08628559e1c518003a1ea0adae58ae09a1f9aa84 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Aug 2022 10:52:59 +0200 Subject: [PATCH 3/8] Removed loop, simplified function --- go.mod | 1 + go.sum | 2 ++ main.go | 25 ++++++++++++------------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 4669b57..50e2738 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.18 require ( github.com/arduino/pluggable-monitor-protocol-handler v0.9.2 go.bug.st/serial v1.3.5 + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e ) require ( diff --git a/go.sum b/go.sum index e513104..dd2ad82 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= go.bug.st/serial v1.3.5 h1:k50SqGZCnHZ2MiBQgzccXWG+kd/XpOs1jUljpDDKzaE= go.bug.st/serial v1.3.5/go.mod h1:z8CesKorE90Qr/oRSJiEuvzYRKol9r/anJZEb5kt304= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= diff --git a/main.go b/main.go index 56542c2..ea99288 100644 --- a/main.go +++ b/main.go @@ -28,6 +28,7 @@ import ( "github.com/arduino/serial-monitor/args" "github.com/arduino/serial-monitor/version" "go.bug.st/serial" + "golang.org/x/exp/slices" ) func main() { @@ -103,21 +104,19 @@ func (d *SerialMonitor) Configure(parameterName string, value string) error { if !ok { return fmt.Errorf("could not find parameter named %s", parameterName) } - for _, i := range parameter.Values { - if i == value { - oldValue := parameter.Selected - parameter.Selected = value - if d.openedPort { - err := d.serialPort.SetMode(d.getMode()) - if err != nil { - parameter.Selected = oldValue - return errors.New(err.Error()) - } - } - return nil + if !slices.Contains(parameter.Values, value) { + return fmt.Errorf("invalid value for parameter %s: %s", parameterName, value) + } + oldValue := parameter.Selected + parameter.Selected = value + if d.openedPort { + err := d.serialPort.SetMode(d.getMode()) + if err != nil { + parameter.Selected = oldValue + return errors.New(err.Error()) } } - return fmt.Errorf("invalid value for parameter %s: %s", parameterName, value) + return nil } // Open is the handler for the pluggable-monitor OPEN command From e9210faee0767a6394f2936aee59ca621ba49802 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Aug 2022 10:55:53 +0200 Subject: [PATCH 4/8] Prepare Configure method to accept more configurations parameters --- main.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index ea99288..059996f 100644 --- a/main.go +++ b/main.go @@ -107,14 +107,20 @@ func (d *SerialMonitor) Configure(parameterName string, value string) error { if !slices.Contains(parameter.Values, value) { return fmt.Errorf("invalid value for parameter %s: %s", parameterName, value) } + // Set configuration oldValue := parameter.Selected parameter.Selected = value + + // Apply configuration to port + var configErr error if d.openedPort { - err := d.serialPort.SetMode(d.getMode()) - if err != nil { - parameter.Selected = oldValue - return errors.New(err.Error()) - } + configErr = d.serialPort.SetMode(d.getMode()) + } + + // If configuration failed, rollback settings + if configErr != nil { + parameter.Selected = oldValue + return configErr } return nil } From 9d956956c414c186bdd04c68b06e76bd0a1258e6 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Aug 2022 11:02:57 +0200 Subject: [PATCH 5/8] Added RTS/DTR configuration values --- go.mod | 2 +- go.sum | 4 ++-- main.go | 37 +++++++++++++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 50e2738..586f5e6 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/arduino/pluggable-monitor-protocol-handler v0.9.2 - go.bug.st/serial v1.3.5 + go.bug.st/serial v1.4.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e ) diff --git a/go.sum b/go.sum index dd2ad82..f1806ec 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -go.bug.st/serial v1.3.5 h1:k50SqGZCnHZ2MiBQgzccXWG+kd/XpOs1jUljpDDKzaE= -go.bug.st/serial v1.3.5/go.mod h1:z8CesKorE90Qr/oRSJiEuvzYRKol9r/anJZEb5kt304= +go.bug.st/serial v1.4.0 h1:IXHzPVbUBbql66lQZ1iV9LWzGXT5lh6S9gZxHK/KyQE= +go.bug.st/serial v1.4.0/go.mod h1:z8CesKorE90Qr/oRSJiEuvzYRKol9r/anJZEb5kt304= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= diff --git a/main.go b/main.go index 059996f..f65c073 100644 --- a/main.go +++ b/main.go @@ -82,6 +82,18 @@ func NewSerialMonitor() *SerialMonitor { Values: []string{"1", "1.5", "2"}, Selected: "1", }, + "rts": { + Label: "RTS", + Type: "enum", + Values: []string{"On", "Off"}, + Selected: "On", + }, + "dtr": { + Label: "DTR", + Type: "enum", + Values: []string{"On", "Off"}, + Selected: "On", + }, }, }, openedPort: false, @@ -114,7 +126,17 @@ func (d *SerialMonitor) Configure(parameterName string, value string) error { // Apply configuration to port var configErr error if d.openedPort { - configErr = d.serialPort.SetMode(d.getMode()) + switch parameterName { + case "baudrate", "parity", "bits", "stop_bits": + configErr = d.serialPort.SetMode(d.getMode()) + case "dtr": + configErr = d.serialPort.SetDTR(d.getDTR()) + case "rts": + configErr = d.serialPort.SetRTS(d.getRTS()) + default: + // Should never happen + panic("Invalid parameter: " + parameterName) + } } // If configuration failed, rollback settings @@ -133,7 +155,6 @@ func (d *SerialMonitor) Open(boardPort string) (io.ReadWriter, error) { serialPort, err := serial.Open(boardPort, d.getMode()) if err != nil { return nil, err - } d.openedPort = true d.serialPort = serialPort @@ -184,6 +205,18 @@ func (d *SerialMonitor) getMode() *serial.Mode { Parity: parity, DataBits: dataBits, StopBits: stopBits, + InitialStatusBits: &serial.ModemOutputBits{ + DTR: d.getDTR(), + RTS: d.getRTS(), + }, } return mode } + +func (d *SerialMonitor) getDTR() bool { + return d.serialSettings.ConfigurationParameter["dtr"].Selected == "On" +} + +func (d *SerialMonitor) getRTS() bool { + return d.serialSettings.ConfigurationParameter["rts"].Selected == "On" +} From 9ba0558ae377f47b0ac10746ca6f46d1906349dd Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 11 Aug 2022 11:11:00 +0200 Subject: [PATCH 6/8] Updated license cache --- .../go/go.bug.st/serial.dep.yml | 2 +- .../go/go.bug.st/serial/unixutils.dep.yml | 6 +- .../go/golang.org/x/exp/constraints.dep.yml | 63 +++++++++++++++++++ .../go/golang.org/x/exp/slices.dep.yml | 62 ++++++++++++++++++ 4 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 .licenses/serial-monitor/go/golang.org/x/exp/constraints.dep.yml create mode 100644 .licenses/serial-monitor/go/golang.org/x/exp/slices.dep.yml diff --git a/.licenses/serial-monitor/go/go.bug.st/serial.dep.yml b/.licenses/serial-monitor/go/go.bug.st/serial.dep.yml index 3d11c35..071365f 100644 --- a/.licenses/serial-monitor/go/go.bug.st/serial.dep.yml +++ b/.licenses/serial-monitor/go/go.bug.st/serial.dep.yml @@ -1,6 +1,6 @@ --- name: go.bug.st/serial -version: v1.3.5 +version: v1.4.0 type: go summary: Package serial is a cross-platform serial library for the go language. homepage: https://pkg.go.dev/go.bug.st/serial diff --git a/.licenses/serial-monitor/go/go.bug.st/serial/unixutils.dep.yml b/.licenses/serial-monitor/go/go.bug.st/serial/unixutils.dep.yml index ec4b51a..d3859ba 100644 --- a/.licenses/serial-monitor/go/go.bug.st/serial/unixutils.dep.yml +++ b/.licenses/serial-monitor/go/go.bug.st/serial/unixutils.dep.yml @@ -1,12 +1,12 @@ --- name: go.bug.st/serial/unixutils -version: v1.3.5 +version: v1.4.0 type: go summary: homepage: https://pkg.go.dev/go.bug.st/serial/unixutils license: bsd-3-clause licenses: -- sources: serial@v1.3.5/LICENSE +- sources: serial@v1.4.0/LICENSE text: |2+ Copyright (c) 2014-2021, Cristian Maglie. @@ -41,7 +41,7 @@ licenses: ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: serial@v1.3.5/README.md +- sources: serial@v1.4.0/README.md text: |- The software is release under a [BSD 3-clause license] diff --git a/.licenses/serial-monitor/go/golang.org/x/exp/constraints.dep.yml b/.licenses/serial-monitor/go/golang.org/x/exp/constraints.dep.yml new file mode 100644 index 0000000..4d3211c --- /dev/null +++ b/.licenses/serial-monitor/go/golang.org/x/exp/constraints.dep.yml @@ -0,0 +1,63 @@ +--- +name: golang.org/x/exp/constraints +version: v0.0.0-20220722155223-a9213eeb770e +type: go +summary: Package constraints defines a set of useful constraints to be used with type + parameters. +homepage: https://pkg.go.dev/golang.org/x/exp/constraints +license: bsd-3-clause +licenses: +- sources: exp@v0.0.0-20220722155223-a9213eeb770e/LICENSE + text: | + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: exp@v0.0.0-20220722155223-a9213eeb770e/PATENTS + text: | + Additional IP Rights Grant (Patents) + + "This implementation" means the copyrightable works distributed by + Google as part of the Go project. + + Google hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as stated in this section) + patent license to make, have made, use, offer to sell, sell, import, + transfer and otherwise run, modify and propagate the contents of this + implementation of Go, where such license applies only to those patent + claims, both currently owned or controlled by Google and acquired in + the future, licensable by Google that are necessarily infringed by this + implementation of Go. This grant does not include claims that would be + infringed only as a consequence of further modification of this + implementation. If you or your agent or exclusive licensee institute or + order or agree to the institution of patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging + that this implementation of Go or any code incorporated within this + implementation of Go constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any patent + rights granted to you under this License for this implementation of Go + shall terminate as of the date such litigation is filed. +notices: [] diff --git a/.licenses/serial-monitor/go/golang.org/x/exp/slices.dep.yml b/.licenses/serial-monitor/go/golang.org/x/exp/slices.dep.yml new file mode 100644 index 0000000..d064d8d --- /dev/null +++ b/.licenses/serial-monitor/go/golang.org/x/exp/slices.dep.yml @@ -0,0 +1,62 @@ +--- +name: golang.org/x/exp/slices +version: v0.0.0-20220722155223-a9213eeb770e +type: go +summary: Package slices defines various functions useful with slices of any type. +homepage: https://pkg.go.dev/golang.org/x/exp/slices +license: bsd-3-clause +licenses: +- sources: exp@v0.0.0-20220722155223-a9213eeb770e/LICENSE + text: | + Copyright (c) 2009 The Go Authors. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- sources: exp@v0.0.0-20220722155223-a9213eeb770e/PATENTS + text: | + Additional IP Rights Grant (Patents) + + "This implementation" means the copyrightable works distributed by + Google as part of the Go project. + + Google hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable (except as stated in this section) + patent license to make, have made, use, offer to sell, sell, import, + transfer and otherwise run, modify and propagate the contents of this + implementation of Go, where such license applies only to those patent + claims, both currently owned or controlled by Google and acquired in + the future, licensable by Google that are necessarily infringed by this + implementation of Go. This grant does not include claims that would be + infringed only as a consequence of further modification of this + implementation. If you or your agent or exclusive licensee institute or + order or agree to the institution of patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging + that this implementation of Go or any code incorporated within this + implementation of Go constitutes direct or contributory patent + infringement, or inducement of patent infringement, then any patent + rights granted to you under this License for this implementation of Go + shall terminate as of the date such litigation is filed. +notices: [] From 34679e5b64b2d16df43dfd51cc865a5623f0f6fc Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 30 Aug 2022 18:05:47 +0200 Subject: [PATCH 7/8] Make all the setting values lowercase --- main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index f65c073..67a990c 100644 --- a/main.go +++ b/main.go @@ -67,8 +67,8 @@ func NewSerialMonitor() *SerialMonitor { "parity": { Label: "Parity", Type: "enum", - Values: []string{"None", "Even", "Odd", "Mark", "Space"}, - Selected: "None", + Values: []string{"none", "even", "odd", "mark", "space"}, + Selected: "none", }, "bits": { Label: "Data bits", @@ -85,14 +85,14 @@ func NewSerialMonitor() *SerialMonitor { "rts": { Label: "RTS", Type: "enum", - Values: []string{"On", "Off"}, - Selected: "On", + Values: []string{"on", "off"}, + Selected: "on", }, "dtr": { Label: "DTR", Type: "enum", - Values: []string{"On", "Off"}, - Selected: "On", + Values: []string{"on", "off"}, + Selected: "on", }, }, }, @@ -214,9 +214,9 @@ func (d *SerialMonitor) getMode() *serial.Mode { } func (d *SerialMonitor) getDTR() bool { - return d.serialSettings.ConfigurationParameter["dtr"].Selected == "On" + return d.serialSettings.ConfigurationParameter["dtr"].Selected == "on" } func (d *SerialMonitor) getRTS() bool { - return d.serialSettings.ConfigurationParameter["rts"].Selected == "On" + return d.serialSettings.ConfigurationParameter["rts"].Selected == "on" } From 5e36edb78808718f7e87bb898e5995affe755e2a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 1 Sep 2022 16:49:18 +0200 Subject: [PATCH 8/8] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5e0be9..1d6d6b5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The `serial-monitor` tool is a command line program that interacts via stdio. It ## How to build -Install a recent go environment (>=13.0) and run `go build`. The executable `serial-monitor` will be produced in your working directory. +Install a recent go environment and run `go build`. The executable `serial-monitor` will be produced in your working directory. ## Usage