test program

This commit is contained in:
lordwelch 2017-10-27 14:14:03 -06:00
parent d29dc973fa
commit f81cd49648

17
main.go
View File

@ -19,7 +19,9 @@ const (
func main() {
var (
test [9]byte = [...]byte{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00}
test [8]byte = [...]byte{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}
unpress [8]byte = [...]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
write []byte
)
fmt.Printf("%08b\n%08b\n%08b\n%08b\n%08b\n%08b\n%08b\n%08b\n\n", LCTRL,
LSHIFT,
@ -34,11 +36,14 @@ func main() {
//test[0] |= LCTRL
fmt.Printf("%08b\n", test[0])
file, err := os.OpenFile("/dev/hidg0", os.O_WRONLY, os.ModePerm)
file2, err2 := os.OpenFile("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[:])
for i := 1; i <= 100; i++ {
write = append(write, test[:]...)
write = append(write, unpress[:]...)
}
binary.Write(file, binary.BigEndian, write)
file.Close()
file2.Close()
}