diff --git a/devices/devices_json.go b/devices/devices_json.go index 337bdc6..8126447 100644 --- a/devices/devices_json.go +++ b/devices/devices_json.go @@ -35,7 +35,7 @@ func LoadKeymap(file io.ReadCloser, dev *DeviceDef) *KeyMap { return mapped } -//SavePKMKeymap saves an orb after edit +//SaveKeymap Saves Orbmap KM structure func SaveKeymap(file io.WriteCloser, mapped interface{}) { binary.Write(file, binary.LittleEndian, mapped) file.Close() diff --git a/hid/generated.bin b/hid/generated.bin index d06eb33..3115fea 100644 Binary files a/hid/generated.bin and b/hid/generated.bin differ diff --git a/hid/generator/gen.go b/hid/generator/gen.go index a62dca3..dd2fa91 100644 --- a/hid/generator/gen.go +++ b/hid/generator/gen.go @@ -2,34 +2,15 @@ package main import ( "encoding/json" + "github.com/OrbTools/OrbCommon/hid" + xdr "github.com/davecgh/go-xdr/xdr2" "io" "io/fs" "os" "regexp" "strconv" - - xdr "github.com/davecgh/go-xdr/xdr2" ) -type KeyMaps struct { - Usb map[uint16]Key - Evdev map[uint16]Key - Xkb map[uint16]Key - Win map[uint16]Key - Mac map[uint16]Key - Code map[string]Key - Arr []Key -} - -type Key struct { - Usb uint16 - Evdev uint16 - Xkb uint16 - Win uint16 - Mac uint16 - Code string -} - func main() { rege, _ := regexp.Compile("DOM_CODE\\(0x07([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), 0x([0-9a-f]*), \"?[A-Za-z0-9]*\"?, ([A-Za-z_0-9]*)") //DOM_CODE(USB, evdev, XKB, Win, Mac, _, Code) @@ -37,22 +18,22 @@ func main() { byts, _ := io.ReadAll(fil) fil.Close() matches := rege.FindAllSubmatch(byts, -1) - KeyMaps := KeyMaps{ - Usb: make(map[uint16]Key), - Evdev: make(map[uint16]Key), - Xkb: make(map[uint16]Key), - Win: make(map[uint16]Key), - Mac: make(map[uint16]Key), - Code: make(map[string]Key), + KeyMaps := hid.KeyMaps{ + Usb: make(map[uint16]hid.Key), + Evdev: make(map[uint16]hid.Key), + Xkb: make(map[uint16]hid.Key), + Win: make(map[uint16]hid.Key), + Mac: make(map[uint16]hid.Key), + Code: make(map[string]hid.Key), } - Arr := make([]Key, 0) + Arr := make([]hid.Key, 0) for _, bar := range matches { U, _ := strconv.ParseUint(string(bar[1]), 16, 16) E, _ := strconv.ParseUint(string(bar[2]), 16, 16) X, _ := strconv.ParseUint(string(bar[3]), 16, 16) W, _ := strconv.ParseUint(string(bar[4]), 16, 16) M, _ := strconv.ParseUint(string(bar[5]), 16, 16) - Keys := Key{ + Keys := hid.Key{ Usb: uint16(U), Evdev: uint16(E), Xkb: uint16(X),