From f6267bfc3686037be7bd0c2b394dcdd0dc150258 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 26 Jun 2017 16:22:29 +0200 Subject: tools/syz-tty: add utility for testing of usb console reading code --- tools/syz-tty/syz-tty.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tools/syz-tty/syz-tty.go (limited to 'tools') diff --git a/tools/syz-tty/syz-tty.go b/tools/syz-tty/syz-tty.go new file mode 100644 index 000000000..a03e7ee39 --- /dev/null +++ b/tools/syz-tty/syz-tty.go @@ -0,0 +1,29 @@ +// Copyright 2017 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +// syz-tty is utility for testing of usb console reading code. Usage: +// $ syz-tty /dev/ttyUSBx +// This should dump device console output. +package main + +import ( + "fmt" + "io" + "os" + + "github.com/google/syzkaller/vm/vmimpl" +) + +func main() { + if len(os.Args) != 2 { + fmt.Fprintf(os.Stderr, "usage: %v /dev/ttyUSBx\n", os.Args[0]) + os.Exit(1) + } + con, err := vmimpl.OpenConsole(os.Args[0]) + if err != nil { + fmt.Fprintf(os.Stderr, "failed to open console: %v\n", err) + os.Exit(1) + } + defer con.Close() + io.Copy(os.Stdout, con) +} -- cgit mrf-deployment