From 2273ac77c7106c36536d17ee6f07d9492780a573 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 6 May 2015 14:38:32 +0200 Subject: Linux support --- usblp.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 usblp.go (limited to 'usblp.go') diff --git a/usblp.go b/usblp.go new file mode 100644 index 0000000..b6cf987 --- /dev/null +++ b/usblp.go @@ -0,0 +1,25 @@ +package main + +import ( + "bufio" + "os" +) + +type LPDevice struct { + *os.File +} + +func NewLPDevice(path string) (LPDevice, error) { + f, err := os.OpenFile(path, os.O_RDWR, 0666) + return LPDevice{f}, err +} + +func (d LPDevice) Close() { + d.Close() +} + +func (d LPDevice) Handle() *bufio.ReadWriter { + r := bufio.NewReader(d.File) + w := bufio.NewWriter(d.File) + return bufio.NewReadWriter(r, w) +} -- cgit v1.2.3