Cleanups, and sanity check stuff

main
Minizbot2012 4 years ago
parent bb8c508886
commit 44dec39827
No known key found for this signature in database
GPG Key ID: 977C8ADE12361917

@ -14,7 +14,7 @@ func main() {
flag.Parse()
path, _ := os.Getwd()
Maps := orbweaver.ProcOrbFiles(orbs, path)
KeyBus := make(chan keyevents.KeyEvent, 128)
KeyBus := make(chan *keyevents.KeyEvent, 128)
for i := 0; i <= 4; i++ {
go procKey(KeyBus)
}

@ -10,7 +10,7 @@ var vkm uinput.Keyboard
func init() {
vkm, _ = uinput.CreateKeyboard("/dev/uinput", []byte("Orbmap"))
}
func procKey(kb chan keyevents.KeyEvent) {
func procKey(kb chan *keyevents.KeyEvent) {
for {
KeyEv := <-kb
if KeyEv.Type == 1 {

@ -2,7 +2,6 @@ package orbweaver
import (
"encoding/binary"
"fmt"
"os"
"strings"
@ -32,9 +31,8 @@ type KeyMaps struct {
//ProcOrbFiles processes orbs
func ProcOrbFiles(orbs string, wd string) *KeyMaps {
keymaps := new(KeyMaps)
keymaps := &KeyMaps{}
idx := 0
fmt.Println(wd + ":" + orbs)
if len(orbs) > 0 {
for _, orb := range strings.Split(orbs, ",") {
KMap := new(KeyMap)

@ -5,13 +5,14 @@ package orbweaver
import (
"bytes"
"encoding/binary"
"fmt"
"os"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
//OrbLoop Main loop for this device
func OrbLoop(km *KeyMaps, KeyBus chan keyevents.KeyEvent) {
func OrbLoop(km *KeyMaps, KeyBus chan *keyevents.KeyEvent) {
for i := 0; i < 26; i++ {
ecm[uint16(eventcodes[i])] = i
}
@ -23,11 +24,12 @@ func OrbLoop(km *KeyMaps, KeyBus chan keyevents.KeyEvent) {
b := make([]byte, 24)
for {
f.Read(b)
KeyEv := keyevents.KeyEvent{}
KeyEv := &keyevents.KeyEvent{}
KeyEv.Type = binary.LittleEndian.Uint16(b[16:18])
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[binary.LittleEndian.Uint16(b[18:20])]]
binary.Read(bytes.NewReader(b[20:]), binary.LittleEndian, &KeyEv.Value)
if KeyEv.Code != 0 {
if KeyEv.Code != 0 && KeyEv.Type != 4 {
fmt.Println(KeyEv.Type, KeyEv.Code, KeyEv.Value)
KeyBus <- KeyEv
}
}

@ -1,14 +0,0 @@
//go:generate boxy
package orbweaver
import (
"bytes"
"encoding/binary"
"os"
"github.com/minizbot2012/orbmap/interface/keyevents"
}
//OrbLoop Main loop for this device
func OrbLoop(km *KeyMaps, KeyBus chan keyevents.KeyEvent) {
panic("Windows Not Yet Supported")
}
Loading…
Cancel
Save