You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
660 B
Go

package hid
import (
"bytes"
_ "embed"
"github.com/Minizbot2012/minxdr"
"github.com/OrbTools/OrbCommon/hid/structs"
)
//go:embed generated.bin
var file []byte
func init() {
minxdr.Unmarshal(bytes.NewReader(file), &Mappings)
}
var Mappings structs.KeyMaps
func GetMappingFromHID(uv uint16) structs.Key {
return Mappings.Usb[uv]
}
func GetMappingFromWindows(uv uint16) structs.Key {
return Mappings.Win[uv]
}
func GetMappingFromLinux(uv uint16) structs.Key {
return Mappings.Evdev[uv]
}
func GetMappingFromName(name string) structs.Key {
return Mappings.Code[name]
}
func GetMappingFromX(code uint16) structs.Key {
return Mappings.Xkb[code]
}