From 56476d2fe6f6edba2aa2b689a664524a394c2026 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Thu, 26 Oct 2017 17:50:36 -0600 Subject: [PATCH] test program --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 8da2061..b84ccb0 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "encoding/binary" "fmt" "os" ) @@ -32,7 +33,12 @@ func main() { fmt.Printf("%08b\n", test[0]) test[0] |= LCTRL fmt.Printf("%08b\n", test[0]) - file, _ := os.Open("/dev/hidg0") - file.Write(test[:]) + file, err := os.Open("/dev/hidg0", os.O_WRONLY, os.ModePerm) + file2, err2 := os.Open("test", os.O_WRONLY|os.O_CREATE, os.ModePerm) + fmt.Println(err) + fmt.Println(err2) + binary.Write(file, binary.BigEndian, test[:]) + binary.Write(file2, binary.BigEndian, test[:]) file.Close() + file2.Close() }