tree
This commit is contained in:
parent
4dff17ca5c
commit
34290e969c
41
main.go
41
main.go
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -17,41 +18,29 @@ const (
|
|||||||
RSUPER
|
RSUPER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Press(press [8]byte, file io.Writer) {
|
||||||
|
binary.Write(file, binary.BigEndian, press[:])
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var (
|
var (
|
||||||
test [8]byte = [8]byte{0x00, 0x00, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e}
|
press [8]byte = [8]byte{0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00} // down
|
||||||
test1 [8]byte = [8]byte{0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00}
|
press1 [8]byte = [8]byte{0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00} // backspace
|
||||||
|
press2 [8]byte = [8]byte{0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00} // t
|
||||||
unpress [8]byte = [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
unpress [8]byte = [8]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,
|
|
||||||
LALT,
|
|
||||||
LSUPER,
|
|
||||||
RCTRL,
|
|
||||||
RSHIFT,
|
|
||||||
RALT,
|
|
||||||
RSUPER)
|
|
||||||
fmt.Println()
|
|
||||||
fmt.Printf("%08b\n", test[0])
|
|
||||||
//test[0] |= LCTRL
|
|
||||||
fmt.Printf("%08b\n", test[0])
|
|
||||||
file, err := os.OpenFile("/dev/hidg0", os.O_WRONLY, os.ModePerm)
|
file, err := os.OpenFile("/dev/hidg0", os.O_WRONLY, os.ModePerm)
|
||||||
|
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
for j := 1; j <= 1000; j++ {
|
for j := 1; j <= 1000; j++ {
|
||||||
for i := 1; i <= 1000; i++ {
|
Press(press, file)
|
||||||
write = append(write, test[:]...)
|
Press(unpress, file)
|
||||||
write = append(write, unpress[:]...)
|
Press(press1, file)
|
||||||
write = append(write, test1[:]...)
|
Press(unpress, file)
|
||||||
write = append(write, unpress[:]...)
|
Press(press2, file)
|
||||||
}
|
Press(unpress, file)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
binary.Write(file, binary.BigEndian, write)
|
|
||||||
|
|
||||||
file.Close()
|
file.Close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user