pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
arduino-serial-discovery: Fix Command START_SYNC not supported
Module Name: pkgsrc-wip
Committed By: Rui-Xiang Guo <rxg%lavabit.com@localhost>
Pushed By: rxg
Date: Sun Feb 18 11:03:56 2024 +0800
Changeset: 4a72662a592234a8c95eb38a64649845ef5ea3ed
Modified Files:
arduino-serial-discovery/distinfo
arduino-serial-discovery/go-modules.mk
arduino-serial-discovery/patches/patch-go.mod
arduino-serial-discovery/patches/patch-go.sum
Added Files:
arduino-serial-discovery/patches/patch-sync_sync__default.go
arduino-serial-discovery/patches/patch-sync_sync__netbsd.go
Removed Files:
arduino-serial-discovery/patches/patch-main.go
Log Message:
arduino-serial-discovery: Fix Command START_SYNC not supported
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4a72662a592234a8c95eb38a64649845ef5ea3ed
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
arduino-serial-discovery/distinfo | 19 ++--
arduino-serial-discovery/go-modules.mk | 4 +-
arduino-serial-discovery/patches/patch-go.mod | 4 +-
arduino-serial-discovery/patches/patch-go.sum | 6 +-
arduino-serial-discovery/patches/patch-main.go | 13 ---
.../patches/patch-sync_sync__default.go | 13 +++
.../patches/patch-sync_sync__netbsd.go | 119 +++++++++++++++++++++
7 files changed, 150 insertions(+), 28 deletions(-)
diffs:
diff --git a/arduino-serial-discovery/distinfo b/arduino-serial-discovery/distinfo
index bbce07cfc0..5c2f38d879 100644
--- a/arduino-serial-discovery/distinfo
+++ b/arduino-serial-discovery/distinfo
@@ -735,12 +735,12 @@ Size (github.com_pelletier_go-buffruneio_@v_v0.2.0.mod) = 42 bytes
BLAKE2s (github.com_pelletier_go-toml_@v_v1.9.3.mod) = f0cbf2e7b6fadd4c6429b5e4871e9178df578b2fbd7262995c4a13524d11a86b
SHA512 (github.com_pelletier_go-toml_@v_v1.9.3.mod) = fdeaa2c0dbeb52934d9b48cf468c923f89058e3a454cfa153c9392ab908e3868d501d7bc2b923f33ad5949df6fd9ef07e1336b2dd98f9efa70b1ca4a23918ce0
Size (github.com_pelletier_go-toml_@v_v1.9.3.mod) = 45 bytes
-BLAKE2s (github.com_picohive_go-serial_@v_v1.6.1.mod) = c430c3b6be4d3fe5478c960ed9e0bb6dbf8af29f401d0f75241e0a334f385fb3
-SHA512 (github.com_picohive_go-serial_@v_v1.6.1.mod) = aa9e3245e4401a32061f12b2c34d07d59829977d1f7cdc2a089ad2a1cc3b35168730d61a8560ffba7610f3b5d912acd54857333c2847474eaa6384e4427cab1e
-Size (github.com_picohive_go-serial_@v_v1.6.1.mod) = 345 bytes
-BLAKE2s (github.com_picohive_go-serial_@v_v1.6.1.zip) = e36ad72fe728dc6506951e345b90baf118b46755d3c8a3f2996ae2cbca9a1303
-SHA512 (github.com_picohive_go-serial_@v_v1.6.1.zip) = 347eedd0251b0452be96cbe31e8e3fd0961cfa90b7a05179a2748187287e4c07b9e188075dd41bebae4f34b2c4b0882683b34238c753375b6d8fceb56ce10ff0
-Size (github.com_picohive_go-serial_@v_v1.6.1.zip) = 46672 bytes
+BLAKE2s (github.com_picohive_go-serial_@v_v1.6.2.mod) = c430c3b6be4d3fe5478c960ed9e0bb6dbf8af29f401d0f75241e0a334f385fb3
+SHA512 (github.com_picohive_go-serial_@v_v1.6.2.mod) = aa9e3245e4401a32061f12b2c34d07d59829977d1f7cdc2a089ad2a1cc3b35168730d61a8560ffba7610f3b5d912acd54857333c2847474eaa6384e4427cab1e
+Size (github.com_picohive_go-serial_@v_v1.6.2.mod) = 345 bytes
+BLAKE2s (github.com_picohive_go-serial_@v_v1.6.2.zip) = 34708e1f5961204e9d7e9ff95ed3693e59c0aaf1d34c04a57d16f1d29584a156
+SHA512 (github.com_picohive_go-serial_@v_v1.6.2.zip) = 61bc2acf22e0619f15d32e1d09d5762c429aebb79a6cdc112896eb29d392de8ea2b8114c1bf131f369c01f9313fdbee5637b7db6baaa1d2c9196246854467072
+Size (github.com_picohive_go-serial_@v_v1.6.2.zip) = 46768 bytes
BLAKE2s (github.com_pkg_errors_@v_v0.8.1.mod) = ae26654fdfcb36fe7ce35e2a348782cf1a3b5c44a514b60a870dc4972267b34a
SHA512 (github.com_pkg_errors_@v_v0.8.1.mod) = 0c156e21d35c45a89c1a1b69ff1976b4f7511b3870bf96126121f5a5effa3723eb45bf080e840d5c8b96898c65207dba83eb3e1a23668dd8a5e20ee6be775cc0
Size (github.com_pkg_errors_@v_v0.8.1.mod) = 29 bytes
@@ -2046,6 +2046,7 @@ Size (rsc.io_quote_v3_@v_v3.1.0.mod) = 55 bytes
BLAKE2s (rsc.io_sampler_@v_v1.3.0.mod) = 6d4d3ba7c381b9a923679a73562a7cf3d6b7d49f94f585f274c8955bb1b932b4
SHA512 (rsc.io_sampler_@v_v1.3.0.mod) = 2137507eb25fbae419605e0cd6bca4cfa584110eebc276cd759a4dcb6f97e52928e5b2d9b276e76bcabcec3bbfc2c42f97fa29f54695d27fb00f9423e1638863
Size (rsc.io_sampler_@v_v1.3.0.mod) = 88 bytes
-SHA1 (patch-go.mod) = c531ab8db67739dea55abe21adaa2c89e6bd11c1
-SHA1 (patch-go.sum) = 69c815c3a8a48d89c52252b8c03938e8d80b85f7
-SHA1 (patch-main.go) = 8385f88c0750dc57a6309880403d41de0d99e7d4
+SHA1 (patch-go.mod) = c883ab26af5bfd5d6e94c621e2cd1b158259ecc6
+SHA1 (patch-go.sum) = d08bb1da2c0612e58ac7f6e9bf08746ca35e2a44
+SHA1 (patch-sync_sync__default.go) = cb9b25ae7d82c154eae0229dfc245983f789f142
+SHA1 (patch-sync_sync__netbsd.go) = 48d3553a5fcfd2e72c55a61189a0d75b7caf772b
diff --git a/arduino-serial-discovery/go-modules.mk b/arduino-serial-discovery/go-modules.mk
index c91433c170..d63e78afa7 100644
--- a/arduino-serial-discovery/go-modules.mk
+++ b/arduino-serial-discovery/go-modules.mk
@@ -244,8 +244,8 @@ GO_MODULE_FILES+= github.com/niemeyer/pretty/@v/v0.0.0-20200227124842-a10e7caefd
GO_MODULE_FILES+= github.com/pascaldekloe/goe/@v/v0.0.0-20180627143212-57f6aae5913c.mod
GO_MODULE_FILES+= github.com/pelletier/go-buffruneio/@v/v0.2.0.mod
GO_MODULE_FILES+= github.com/pelletier/go-toml/@v/v1.9.3.mod
-GO_MODULE_FILES+= github.com/picohive/go-serial/@v/v1.6.1.mod
-GO_MODULE_FILES+= github.com/picohive/go-serial/@v/v1.6.1.zip
+GO_MODULE_FILES+= github.com/picohive/go-serial/@v/v1.6.2.mod
+GO_MODULE_FILES+= github.com/picohive/go-serial/@v/v1.6.2.zip
GO_MODULE_FILES+= github.com/pkg/errors/@v/v0.8.1.mod
GO_MODULE_FILES+= github.com/pkg/errors/@v/v0.9.1.mod
GO_MODULE_FILES+= github.com/pkg/errors/@v/v0.9.1.zip
diff --git a/arduino-serial-discovery/patches/patch-go.mod b/arduino-serial-discovery/patches/patch-go.mod
index da730aae01..680c234ccb 100644
--- a/arduino-serial-discovery/patches/patch-go.mod
+++ b/arduino-serial-discovery/patches/patch-go.mod
@@ -1,12 +1,12 @@
$NetBSD$
---- go.mod.orig 2024-02-12 08:35:57.331049680 +0000
+--- go.mod.orig 2023-02-09 15:30:05.000000000 +0000
+++ go.mod
@@ -1,6 +1,7 @@
module github.com/arduino/serial-discovery
go 1.19
-+replace go.bug.st/serial v1.5.0 => github.com/picohive/go-serial v1.6.1
++replace go.bug.st/serial v1.5.0 => github.com/picohive/go-serial v1.6.2
require (
github.com/arduino/go-properties-orderedmap v1.7.1
diff --git a/arduino-serial-discovery/patches/patch-go.sum b/arduino-serial-discovery/patches/patch-go.sum
index 04f62f54ba..f1e6f8ed9b 100644
--- a/arduino-serial-discovery/patches/patch-go.sum
+++ b/arduino-serial-discovery/patches/patch-go.sum
@@ -1,13 +1,15 @@
$NetBSD$
---- go.sum.orig 2024-02-12 13:30:53.458973201 +0000
+--- go.sum.orig 2023-02-09 15:30:05.000000000 +0000
+++ go.sum
-@@ -245,6 +245,8 @@ github.com/niemeyer/pretty v0.0.0-202002
+@@ -245,6 +245,10 @@ github.com/niemeyer/pretty v0.0.0-202002
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
+github.com/picohive/go-serial v1.6.1 h1:xS0kGjdOSHt+MVzU37fFGCnrcVrhVdjtN7twhCjrTuA=
+github.com/picohive/go-serial v1.6.1/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
++github.com/picohive/go-serial v1.6.2 h1:NVVZMe7dIAOR84eVkmMXsDbfuNbVooaq7oeQaP7Dgd0=
++github.com/picohive/go-serial v1.6.2/go.mod h1:UABfsluHAiaNI+La2iESysd9Vetq7VRdpxvjx7CmmOE=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
diff --git a/arduino-serial-discovery/patches/patch-main.go b/arduino-serial-discovery/patches/patch-main.go
deleted file mode 100644
index 8fad8b07c8..0000000000
--- a/arduino-serial-discovery/patches/patch-main.go
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD$
-
---- main.go.orig 2024-02-12 13:41:17.183451591 +0000
-+++ main.go
-@@ -68,7 +68,7 @@ func (d *SerialDiscovery) Stop() error {
-
- // StartSync is the handler for the pluggable-discovery START_SYNC command
- func (d *SerialDiscovery) StartSync(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) error {
-- close, err := sync.Start(eventCB, errorCB)
-+ close, err := sync.Start()
- if err != nil {
- return err
- }
diff --git a/arduino-serial-discovery/patches/patch-sync_sync__default.go b/arduino-serial-discovery/patches/patch-sync_sync__default.go
new file mode 100644
index 0000000000..aae23a67d0
--- /dev/null
+++ b/arduino-serial-discovery/patches/patch-sync_sync__default.go
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- sync/sync_default.go.orig 2024-02-18 02:17:41.780191456 +0000
++++ sync/sync_default.go
+@@ -15,7 +15,7 @@
+ // a commercial license, send an email to license%arduino.cc@localhost.
+ //
+
+-//go:build !linux && !windows && !darwin
++//go:build !linux && !windows && !darwin && !netbsd
+
+ package sync
+
diff --git a/arduino-serial-discovery/patches/patch-sync_sync__netbsd.go b/arduino-serial-discovery/patches/patch-sync_sync__netbsd.go
new file mode 100644
index 0000000000..3272806253
--- /dev/null
+++ b/arduino-serial-discovery/patches/patch-sync_sync__netbsd.go
@@ -0,0 +1,119 @@
+$NetBSD$
+
+--- sync/sync_netbsd.go.orig 2024-02-18 02:01:15.283417425 +0000
++++ sync/sync_netbsd.go
+@@ -0,0 +1,114 @@
++//
++// This file is part of serial-discovery.
++//
++// Copyright 2018-2021 ARDUINO SA (http://www.arduino.cc/)
++//
++// This software is released under the GNU General Public License version 3,
++// which covers the main part of arduino-cli.
++// The terms of this license can be found at:
++// https://www.gnu.org/licenses/gpl-3.0.en.html
++//
++// You can be released from the requirements of the above licenses by purchasing
++// a commercial license. Buying such a license is mandatory if you want to modify or
++// otherwise use the software for commercial activities involving the Arduino
++// software without disclosing the source code of your own applications. To purchase
++// a commercial license, send an email to license%arduino.cc@localhost.
++//
++
++package sync
++
++import (
++ "fmt"
++ "syscall"
++
++ discovery "github.com/arduino/pluggable-discovery-protocol-handler/v2"
++ "go.bug.st/serial/enumerator"
++)
++
++// Start the sync process, successful events will be passed to eventCB, errors to errorCB.
++// Returns a channel used to stop the sync process.
++// Returns error if sync process can't be started.
++func Start(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) (chan<- bool, error) {
++ // create kqueue
++ kq, err := syscall.Kqueue()
++ if err != nil {
++ return nil, err
++ }
++
++ // open folder
++ fd, err := syscall.Open("/dev", syscall.O_RDONLY, 0)
++ if err != nil {
++ return nil, err
++ }
++
++ // build kevent
++ ev1 := syscall.Kevent_t{
++ Ident: uint64(fd),
++ Filter: syscall.EVFILT_VNODE,
++ Flags: syscall.EV_ADD | syscall.EV_ENABLE | syscall.EV_ONESHOT,
++ Fflags: syscall.NOTE_DELETE | syscall.NOTE_WRITE,
++ Data: 0,
++ Udata: 0,
++ }
++
++ // Run synchronous event emitter
++ closeChan := make(chan bool)
++
++ go func() {
++ defer syscall.Close(fd)
++ defer syscall.Close(kq)
++
++ // Output initial port state: get the current port list to send as initial "add" events
++ current, err := enumerator.GetDetailedPortsList()
++ if err != nil {
++ errorCB(err.Error())
++ return
++ }
++ for _, port := range current {
++ eventCB("add", toDiscoveryPort(port))
++ }
++
++ // wait for events
++ events := make([]syscall.Kevent_t, 10)
++
++ for {
++ t100ms := syscall.Timespec{Nsec: 100_000_000, Sec: 0}
++ n, err := syscall.Kevent(kq, []syscall.Kevent_t{ev1}, events, &t100ms)
++ select {
++ case <-closeChan:
++ return
++ default:
++ }
++ if err == syscall.EINTR {
++ continue
++ }
++ if err != nil {
++ errorCB(fmt.Sprintf("Error decoding serial event: %s", err))
++ break
++ }
++ if n <= 0 {
++ continue
++ }
++
++ // if there is an event retry up to 5 times
++ var enumeratorErr error
++ for retries := 0; retries < 5; retries++ {
++ updates, err := enumerator.GetDetailedPortsList()
++ if err != nil {
++ enumeratorErr = err
++ break
++ }
++ processUpdates(current, updates, eventCB)
++ current = updates
++ }
++ if enumeratorErr != nil {
++ errorCB(fmt.Sprintf("Error enumerating serial ports: %s", enumeratorErr))
++ break
++ }
++ }
++
++ <-closeChan
++ }()
++
++ return closeChan, nil
++}
Home |
Main Index |
Thread Index |
Old Index