gopkg.in/hugelgupf/u-root.v9@v9.0.0-20180831063832-3f6f1057f09b/integration/testdata/io/uinit/io.go (about) 1 // Copyright 2018 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 "log" 10 "os" 11 "os/exec" 12 ) 13 14 // Prints the string "UART TEST\r\n" using IO. 15 func main() { 16 // Writing to the serial port is atomic in QEMU, so no polling or 17 // sleeping is needed between characters. 18 for _, b := range []byte("UART TEST\r\n") { 19 cmd := exec.Command("io", "outb", "0x3f8", fmt.Sprintf("%d", b)) 20 cmd.Stdout = os.Stdout 21 cmd.Stderr = os.Stderr 22 err := cmd.Run() 23 if err != nil { 24 log.Fatal(err) 25 } 26 } 27 }