From b8ef4d11fe0d00ce0884ccf982675845b20c3ce9 Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 30 May 2024 16:00:32 +0200 Subject: software: Implement serial port detection --- software/main.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 software/main.go (limited to 'software/main.go') diff --git a/software/main.go b/software/main.go new file mode 100644 index 0000000..66fb8a6 --- /dev/null +++ b/software/main.go @@ -0,0 +1,20 @@ +package main + +import ( + "log" + + "xengineering.eu/iot-core/communication" +) + +func main() { + ports, err := communication.GetStSerials() + if err != nil { + log.Fatal(err) + } + + if len(ports) != 1 { + log.Fatalf("Require exactly one serial port from STMicroelectronics but %d attached", len(ports)) + } + + log.Printf("Detected port: %s\n", ports[0]) +} -- cgit v1.2.3-70-g09d2