diff options
author | root <sina@snix.ir> | 2022-05-09 22:16:53 +0000 |
---|---|---|
committer | root <sina@snix.ir> | 2022-05-09 22:16:53 +0000 |
commit | 18c771ef6a99911570d8618db76d624ecd2a1ab0 (patch) | |
tree | 33a2b24372b253e7850e5b1edeec9b0393c36bfc | |
parent | e6e91a1b9bfd7d447612d76fcc519cc577a279fc (diff) |
_example folder name
-rw-r--r-- | example/main.go | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/example/main.go b/example/main.go deleted file mode 100644 index 06ac0ad..0000000 --- a/example/main.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( - "io" - "log" - "os" - - "snix.ir/userial" -) - - -// we need something to read, so we gonna mess with terminal.. -const cisco_router_cmd = ` - - -enable -show ip int br -conf t -int gig0/0 -ip addr 192.168.122.200 255.255.255.0 -no shut - -do show ip int br - -` - -func main() { - - // default conf - p, err := userial.NewSerial().OpenPort("/dev/ttyACM0") - - // serial port with custom config - // - // p_dev := "/dev/ttyACM0" - // s := userial.NewSerial().SetBuadRate(userial.B0019200) - // p, err = s.SetParity(userial.ParityEvn).OpenPort(p_dev) - - if err != nil { - log.Fatal(err) - } - - defer p.Close() - - if _, err := p.Write([]byte(cisco_router_cmd)); err != nil { - panic(err) - } - - if _, err := io.Copy(os.Stdout, p); err != nil { - panic(err) - } - -} |