aboutsummaryrefslogtreecommitdiff
path: root/usblp.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-06 14:38:32 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-06 14:38:32 +0200
commit2273ac77c7106c36536d17ee6f07d9492780a573 (patch)
treea8fc8079c87029d22157dd26583753c4334d8e15 /usblp.go
parent670a733b2202558a0970d225abd7088f6d68a01e (diff)
Linux support
Diffstat (limited to 'usblp.go')
-rw-r--r--usblp.go25
1 files changed, 25 insertions, 0 deletions
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)
+}