aboutsummaryrefslogtreecommitdiff
path: root/dev_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'dev_darwin.go')
-rw-r--r--dev_darwin.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/dev_darwin.go b/dev_darwin.go
index c49fd75..305a696 100644
--- a/dev_darwin.go
+++ b/dev_darwin.go
@@ -4,6 +4,7 @@ import (
"bufio"
"errors"
"io"
+ "log"
"github.com/kylelemons/gousb/usb"
)
@@ -97,16 +98,19 @@ func (d USB) Close() error {
// ReadString reads until End of Text
func (d USB) ReadString() (string, error) {
buf := bufio.NewReader(d.Reader)
- resp, err := buf.ReadString(ETX)
+ s, err := buf.ReadString(ETX)
if err != nil {
return "", err
}
- return resp[:len(resp)-1], nil
+ s = s[:len(s)-1]
+ log.Printf(">>> %q", s)
+ return s, nil
}
// WriteString terminates transfer with End of Text
func (d USB) WriteString(s string) error {
buf := bufio.NewWriter(d.Writer)
+ log.Printf("<<< %q", s)
buf.WriteString(s)
buf.WriteByte(ETX)
return buf.Flush()
@@ -115,6 +119,7 @@ func (d USB) WriteString(s string) error {
// Command prefixes transfer with Escape
func (d USB) Command(b []byte) error {
buf := bufio.NewWriter(d.Writer)
+ log.Printf(">>> %q", b)
buf.WriteByte(ESC)
buf.Write(b)
return buf.Flush()