summaryrefslogtreecommitdiff
path: root/software/main.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-05-30 16:00:32 +0200
committerxengineering <me@xengineering.eu>2024-05-30 16:00:32 +0200
commitb8ef4d11fe0d00ce0884ccf982675845b20c3ce9 (patch)
tree3beb57ff849ed74569ce325225bc819791c25a6a /software/main.go
parenteab833271eeaa8d54991c11eccec9445f662a191 (diff)
downloadiot-core-b8ef4d11fe0d00ce0884ccf982675845b20c3ce9.tar
iot-core-b8ef4d11fe0d00ce0884ccf982675845b20c3ce9.tar.zst
iot-core-b8ef4d11fe0d00ce0884ccf982675845b20c3ce9.zip
software: Implement serial port detection
Diffstat (limited to 'software/main.go')
-rw-r--r--software/main.go20
1 files changed, 20 insertions, 0 deletions
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])
+}