2017-10-26 13:51:49 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2017-10-26 16:05:49 -07:00
|
|
|
const (
|
|
|
|
LCTRL byte = 1 << iota
|
|
|
|
LSHIFT
|
|
|
|
LALT
|
|
|
|
LSUPER
|
|
|
|
RCTRL
|
|
|
|
RSHIFT
|
|
|
|
RALT
|
|
|
|
RSUPER
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2017-10-26 13:51:49 -07:00
|
|
|
var (
|
2017-10-26 16:05:49 -07:00
|
|
|
test [8]byte = [8]byte{0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a}
|
2017-10-26 13:51:49 -07:00
|
|
|
)
|
2017-10-26 16:05:49 -07: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()
|
|
|
|
fmt.Printf("%08b\n", test[0])
|
|
|
|
test[0] |= LCTRL
|
|
|
|
fmt.Printf("%08b\n", test[0])
|
|
|
|
file, _ := os.Open("/dev/hidg0")
|
|
|
|
file.Write(test[:])
|
2017-10-26 13:51:49 -07:00
|
|
|
|
|
|
|
}
|