1515// a commercial license, send an email to license@arduino.cc.
1616//
1717
18+ // Package sync provides functions for synchronizing and processing updates
19+ // related to serial port discovery.
20+ //
21+ // This package includes functions for comparing two lists of serial ports and
22+ // sending 'add' and 'remove' events based on the differences between the lists.
23+ // It also includes utility functions for converting port details to the discovery
24+ // protocol format.
25+ //
26+ // The main function in this package is `processUpdates`, which takes in two lists
27+ // of serial port details and an event callback function. It compares the two lists
28+ // and sends 'add' and 'remove' events based on the differences. The `portListHas`
29+ // function is used to check if a port is contained in a list, and the `toDiscoveryPort`
30+ // function is used to convert port details to the discovery protocol format.
1831package sync
1932
2033import (
@@ -23,6 +36,7 @@ import (
2336 "go.bug.st/serial/enumerator"
2437)
2538
39+ // nolint
2640// processUpdates sends 'add' and 'remove' events by comparing two ports enumeration
2741// made at different times:
2842// - ports present in the new list but not in the old list are reported as 'added'
@@ -44,6 +58,7 @@ func processUpdates(old, new []*enumerator.PortDetails, eventCB discovery.EventC
4458 }
4559}
4660
61+ // nolint
4762// portListHas checks if port is contained in list. The port metadata are
4863// compared in particular the port address, and vid/pid if the port is a usb port.
4964func portListHas (list []* enumerator.PortDetails , port * enumerator.PortDetails ) bool {
0 commit comments