Documentation ¶
Index ¶
- Constants
- func MagicSerialNumber(sn string) string
- type Device
- type DeviceDefinition
- type DeviceDriver
- type DeviceMatrix
- type EncoderMapper
- type EncoderSetter
- type Handler
- type HandlerFunc
- type KeyOverrideEntry
- type LzmaDefPageWriter
- type LzmaDefPageWriterFunc
- type MacroDriver
- type Pos
- type UnlockStatus
- type ViaChannelID
- type ViaCommand
- type ViaKeyboardValueID
- type VialCommand
Constants ¶
const ( // MagicSerialPrefix is a value in the serial number of HID devices // that the Vial desktop app uses to identify compatible devices. MagicSerialPrefix = "vial:f64c2b3c" ViaProtocolVersion = 0x09 VialProtocolVersion = 0x00000006 VialUnlockCounterMax = 50 VialUnlockHoldDuration = 2 * time.Second )
const ( ViaChannelCustom ViaChannelID = 0x00 ViaChannelBacklight = 0x01 ViaChannelRGBLight = 0x02 ViaChannelRGBMatrix = 0x03 ViaChannelQMKAudio = 0x04 ViaChannelQMKLEDMatrix = 0x05 )
Variables ¶
This section is empty.
Functions ¶
func MagicSerialNumber ¶
MagicSerialNumber returns a string value that the Vial desktop app can recognize as a Vial-compatible device based on a "magic" value (see MagicSerialPrefix constant in this package). If the provided string `sn` is not the zero value, it is appended with a separator to the prefix and returned; otherwise just the prefix is returned.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func NewDevice ¶
func NewDevice(def DeviceDefinition, driver DeviceDriver) *Device
func (*Device) UnlockStatus ¶
func (dev *Device) UnlockStatus() UnlockStatus
type DeviceDefinition ¶
type DeviceDefinition struct { Name string `json:"name"` VendorID string `json:"vendorId"` ProductID string `json:"productId"` Matrix DeviceMatrix `json:"matrix"` UnlockKeys []Pos `json:"-"` LzmaDefLength uint16 `json:"-"` LzmaDefWriter LzmaDefPageWriter }
type DeviceDriver ¶
type DeviceMatrix ¶
type EncoderMapper ¶
type EncoderSetter ¶
type HandlerFunc ¶
type KeyOverrideEntry ¶
type KeyOverrideEntry struct { Trigger uint16 Replacement uint16 Layers uint16 TriggerMods uint8 NegativeModMask uint8 SupressedMods uint8 Options uint8 }
the key override structure as it is stored in eeprom and transferred to vial-gui; it is deserialized into key_override_t by vial_get_key_override
type LzmaDefPageWriter ¶
type LzmaDefPageWriterFunc ¶
func (LzmaDefPageWriterFunc) WriteLzmaDefPage ¶
func (fn LzmaDefPageWriterFunc) WriteLzmaDefPage(buf []byte, page uint16) bool
type MacroDriver ¶
type UnlockStatus ¶
type UnlockStatus uint8
const ( Locked UnlockStatus = iota Unlocked UnlockInProgress )
func (UnlockStatus) String ¶
func (i UnlockStatus) String() string
type ViaChannelID ¶
type ViaChannelID uint8
type ViaCommand ¶
type ViaCommand uint8
ViaCommand represents a command from the VIA command set. VIA is a graphical configurator for QMK firmware. Vial is an open source alternative to VIA, and shares some of the same command set as its predecessor. Not all VIA commands are supported by this package, only the ones that are necessary for Vial.
const ( ViaCmdGetProtocolVersion ViaCommand = 0x01 ViaCmdGetKeyboardValue ViaCommand = 0x02 ViaCmdSetKeyboardValue ViaCommand = 0x03 ViaCmdDynamicKeymapGetKeycode ViaCommand = 0x04 ViaCmdDynamicKeymapSetKeycode ViaCommand = 0x05 ViaCmdDynamicKeymapReset ViaCommand = 0x06 ViaCmdLightingSetValue ViaCommand = 0x07 ViaCmdLightingGetValue ViaCommand = 0x08 ViaCmdLightingSave ViaCommand = 0x09 ViaCmdEepromReset ViaCommand = 0x0A ViaCmdBootloaderJump ViaCommand = 0x0B ViaCmdKeymapMacroGetCount ViaCommand = 0x0C ViaCmdKeymapMacroGetBufferSize ViaCommand = 0x0D ViaCmdKeymapMacroGetBuffer ViaCommand = 0x0E ViaCmdKeymapMacroSetBuffer ViaCommand = 0x0F ViaCmdKeymapMacroReset ViaCommand = 0x10 ViaCmdKeymapGetLayerCount ViaCommand = 0x11 ViaCmdKeymapGetBuffer ViaCommand = 0x12 ViaCmdKeymapSetBuffer ViaCommand = 0x13 ViaCmdVialPrefix ViaCommand = 0xFE ViaCmdUnhandled ViaCommand = 0xFF )
func (ViaCommand) String ¶
func (i ViaCommand) String() string
type ViaKeyboardValueID ¶
type ViaKeyboardValueID uint8
const ( ViaKbdUptime ViaKeyboardValueID = 0x01 ViaKbdLayoutOptions ViaKeyboardValueID = 0x02 ViaKbdSwitchMatrixState ViaKeyboardValueID = 0x03 ViaKbdFirmwareVersion ViaKeyboardValueID = 0x04 ViaKbdDeviceIndication ViaKeyboardValueID = 0x05 )
func (ViaKeyboardValueID) String ¶
func (i ViaKeyboardValueID) String() string
type VialCommand ¶
type VialCommand uint8
const ( VialCmdGetKeyboardID VialCommand = 0x00 VialCmdGetSize VialCommand = 0x01 VialCmdGetDef VialCommand = 0x02 VialCmdGetEncoder VialCommand = 0x03 VialCmdSetEncoder VialCommand = 0x04 VialCmdGetUnlockStatus VialCommand = 0x05 VialCmdUnlockStart VialCommand = 0x06 VialCmdUnlockPoll VialCommand = 0x07 VialCmdLock VialCommand = 0x08 VialCmdQmkSettingsQuery VialCommand = 0x09 VialCmdQmkSettingsGet VialCommand = 0x0A VialCmdQmkSettingsSet VialCommand = 0x0B VialCmdQmkSettingsReset VialCommand = 0x0C VialCmdDynamicEntryOp VialCommand = 0x0D )
func (VialCommand) String ¶
func (i VialCommand) String() string