59 lines
1.3 KiB
Go
Raw Normal View History

2017-10-26 14:51:49 -06:00
package main
import (
2017-10-26 17:50:36 -06:00
"encoding/binary"
2017-10-26 14:51:49 -06:00
"fmt"
"os"
)
2017-10-26 17:05:49 -06:00
const (
LCTRL byte = 1 << iota
LSHIFT
LALT
LSUPER
RCTRL
RSHIFT
RALT
RSUPER
)
func main() {
2017-10-26 14:51:49 -06:00
var (
2017-10-27 14:41:09 -06:00
test [8]byte = [8]byte{0x00, 0x00, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e}
test1 [8]byte = [8]byte{0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00}
2017-10-27 14:28:32 -06:00
unpress [8]byte = [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
2017-10-27 14:14:03 -06:00
write []byte
2017-10-26 14:51:49 -06:00
)
2017-10-26 17:05:49 -06:00
fmt.Printf("%08b\n%08b\n%08b\n%08b\n%08b\n%08b\n%08b\n%08b\n\n", LCTRL,
LSHIFT,
LALT,
LSUPER,
RCTRL,
RSHIFT,
RALT,
RSUPER)
fmt.Println()
2017-10-26 18:08:14 -06:00
fmt.Printf("%08b\n", test[0])
//test[0] |= LCTRL
fmt.Printf("%08b\n", test[0])
2017-10-26 17:51:30 -06:00
file, err := os.OpenFile("/dev/hidg0", os.O_WRONLY, os.ModePerm)
2017-10-27 14:14:03 -06:00
2017-10-26 17:50:36 -06:00
fmt.Println(err)
2017-10-27 14:47:56 -06:00
for j := 1; i <= 1000; i++ {
for i := 1; i <= 1000; i++ {
write = append(write, test[:]...)
write = append(write, unpress[:]...)
write = append(write, test1[:]...)
write = append(write, unpress[:]...)
}
write = append(write, LCTRL, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00)
write = append(write, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
write = append(write, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00)
write = append(write, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
2017-10-27 14:14:03 -06:00
}
binary.Write(file, binary.BigEndian, write)
2017-10-26 17:24:18 -06:00
file.Close()
2017-10-27 14:14:03 -06:00
2017-10-26 14:51:49 -06:00
}