Documentation ¶
Index ¶
- Constants
- Variables
- type AsyncOttoJob
- type AsyncOttoVM
- func (avm *AsyncOttoVM) HandleEvent(event Event)
- func (avm AsyncOttoVM) IsWorking() bool
- func (avm *AsyncOttoVM) Run(ctx context.Context, src interface{}, anonymousSelfInvoked bool) (val otto.Value, res error)
- func (avm *AsyncOttoVM) RunAsync(ctx context.Context, src interface{}, anonymousSelfInvoked bool) (job *AsyncOttoJob, err error)
- func (avm *AsyncOttoVM) SetDefaultHandler()
- func (avm *AsyncOttoVM) SetEventHandler(handler EventHandler)
- func (avm *AsyncOttoVM) SetWorking(working bool)
- type Event
- type EventHandler
- type EventType
- type HIDController
- func (ctl *HIDController) Abort()
- func (ctl *HIDController) CancelAllBackgroundJobs()
- func (ctl *HIDController) GetAllBackgroundJobs() (jobs []*AsyncOttoJob, err error)
- func (ctl *HIDController) GetBackgroundJobByID(id int) (job *AsyncOttoJob, err error)
- func (ctl *HIDController) HandleEvent(event Event)
- func (ctl *HIDController) NextUnusedVM() (vm *AsyncOttoVM, err error)
- func (ctl *HIDController) RunScript(ctx context.Context, script string, anonymousSelfInvoked bool) (val otto.Value, err error)
- func (ctl *HIDController) SetDefaultHandler()
- func (ctl *HIDController) SetEventHandler(handler EventHandler)
- func (ctl *HIDController) StartScriptAsBackgroundJob(ctx context.Context, script string, anonymousSelfInvoked bool) (job *AsyncOttoJob, err error)
- func (ctl *HIDController) WaitBackgroundJobResult(ctx context.Context, job *AsyncOttoJob) (val otto.Value, err error)
- type HIDKeyboard
- func (kbd *HIDKeyboard) Close()
- func (kbd HIDKeyboard) ListLanguageMapNames() (mapNames []string)
- func (kbd *HIDKeyboard) LoadLanguageMapDir(dirpath string) (err error)
- func (kbd *HIDKeyboard) LoadLanguageMapFromFile(filepath string) (err error)
- func (kbd *HIDKeyboard) PressKeySequence(reports []KeyboardOutReport) (err error)
- func (kbd *HIDKeyboard) SetActiveLanguageMap(name string) (err error)
- func (kbd *HIDKeyboard) StringToKeyCombo(comboStr string) (result *KeyboardOutReport, err error)
- func (kbd *HIDKeyboard) StringToPressKeyCombo(comboStr string) (err error)
- func (kbd *HIDKeyboard) StringToPressKeySequence(str string) (err error)
- func (kbd *HIDKeyboard) WaitLEDStateChange(irqFunc <-chan func(), intendedChange byte, timeout time.Duration) (changed *HIDLEDState, err error)
- func (kbd *HIDKeyboard) WaitLEDStateChangeRepeated(irqFunc <-chan func(), intendedChange byte, repeatCount int, ...) (changed *HIDLEDState, err error)
- type HIDKeyboardLanguageMap
- type HIDLEDState
- type KeyboardLEDStateListener
- type KeyboardLEDStateWatcher
- type KeyboardOutReport
- func (rep KeyboardOutReport) Deserialize(data []byte) (err error)
- func (kr *KeyboardOutReport) MarshalJSON() ([]byte, error)
- func (rep KeyboardOutReport) Serialize() (out []byte)
- func (kr KeyboardOutReport) String() string
- func (kr *KeyboardOutReport) UnmarshalJSON(b []byte) error
- func (rep KeyboardOutReport) WriteTo(filePath string) (err error)
- func (rep KeyboardOutReport) WriteToFile(file *os.File) (err error)
- type Mouse
- func (m *Mouse) Click(bt1, bt2, bt3 bool) (err error)
- func (m *Mouse) Close()
- func (m *Mouse) DoubleClick(bt1, bt2, bt3 bool) (err error)
- func (m *Mouse) Move(x, y int8) (err error)
- func (m *Mouse) MoveStepped(x, y int16) (err error)
- func (m *Mouse) MoveTo(x, y float64) (err error)
- func (m *Mouse) SetButtons(bt1, bt2, bt3 bool) (err error)
Constants ¶
const ( HID_MOD_KEY_LEFT_CONTROL = 0x01 HID_MOD_KEY_LEFT_SHIFT = 0x02 HID_MOD_KEY_LEFT_ALT = 0x04 HID_MOD_KEY_LEFT_GUI = 0x08 HID_MOD_KEY_RIGHT_CONTROL = 0x10 HID_MOD_KEY_RIGHT_SHIFT = 0x20 HID_MOD_KEY_RIGHT_ALT = 0x40 HID_MOD_KEY_RIGHT_GUI = 0x80 HID_KEY_RESERVED = 0x00 HID_KEY_ERROR_ROLLOVER = 0x01 HID_KEY_POST_FAIL = 0x02 HID_KEY_ERROR_UNDEFINED = 0x03 HID_KEY_A = 0x04 HID_KEY_B = 0x05 HID_KEY_C = 0x06 HID_KEY_D = 0x07 // Keyboard d and D HID_KEY_E = 0x08 // Keyboard e and E HID_KEY_F = 0x09 // Keyboard f and F HID_KEY_G = 0x0a // Keyboard g and G HID_KEY_H = 0x0b // Keyboard h and H HID_KEY_I = 0x0c // Keyboard i and I HID_KEY_J = 0x0d // Keyboard j and J HID_KEY_K = 0x0e // Keyboard k and K HID_KEY_L = 0x0f // Keyboard l and L HID_KEY_M = 0x10 // Keyboard m and M HID_KEY_N = 0x11 // Keyboard n and N HID_KEY_O = 0x12 // Keyboard o and O HID_KEY_P = 0x13 // Keyboard p and P HID_KEY_Q = 0x14 // Keyboard q and Q HID_KEY_R = 0x15 // Keyboard r and R HID_KEY_S = 0x16 // Keyboard s and S HID_KEY_T = 0x17 // Keyboard t and T HID_KEY_U = 0x18 // Keyboard u and U HID_KEY_V = 0x19 // Keyboard v and V HID_KEY_W = 0x1a // Keyboard w and W HID_KEY_X = 0x1b // Keyboard x and X HID_KEY_Y = 0x1c // Keyboard y and Y HID_KEY_Z = 0x1d // Keyboard z and Z HID_KEY_1 = 0x1e // Keyboard 1 and ! HID_KEY_2 = 0x1f // Keyboard 2 and @ HID_KEY_3 = 0x20 // Keyboard 3 and # HID_KEY_4 = 0x21 // Keyboard 4 and $ HID_KEY_5 = 0x22 // Keyboard 5 and % HID_KEY_6 = 0x23 // Keyboard 6 and ^ HID_KEY_7 = 0x24 // Keyboard 7 and & HID_KEY_8 = 0x25 // Keyboard 8 and * HID_KEY_9 = 0x26 // Keyboard 9 and ( HID_KEY_0 = 0x27 // Keyboard 0 and ) HID_KEY_ENTER = 0x28 // Keyboard Return (ENTER) HID_KEY_ESC = 0x29 // Keyboard ESCAPE HID_KEY_BACKSPACE = 0x2a // Keyboard DELETE (Backspace) HID_KEY_TAB = 0x2b // Keyboard Tab HID_KEY_SPACE = 0x2c // Keyboard Spacebar HID_KEY_MINUS = 0x2d // Keyboard - and _ HID_KEY_EQUAL = 0x2e // Keyboard = and + HID_KEY_LEFTBRACE = 0x2f // Keyboard [ and { HID_KEY_RIGHTBRACE = 0x30 // Keyboard ] and } HID_KEY_BACKSLASH = 0x31 // Keyboard \ and | HID_KEY_HASHTILDE = 0x32 // Keyboard Non-US # and ~ HID_KEY_SEMICOLON = 0x33 // Keyboard ; and : HID_KEY_APOSTROPHE = 0x34 // Keyboard ' and " HID_KEY_GRAVE = 0x35 // Keyboard ` and ~ HID_KEY_COMMA = 0x36 // Keyboard , and < HID_KEY_DOT = 0x37 // Keyboard . and > HID_KEY_SLASH = 0x38 // Keyboard / and ? HID_KEY_CAPSLOCK = 0x39 // Keyboard Caps Lock HID_KEY_F1 = 0x3a // Keyboard F1 HID_KEY_F2 = 0x3b // Keyboard F2 HID_KEY_F3 = 0x3c // Keyboard F3 HID_KEY_F4 = 0x3d // Keyboard F4 HID_KEY_F5 = 0x3e // Keyboard F5 HID_KEY_F6 = 0x3f // Keyboard F6 HID_KEY_F7 = 0x40 // Keyboard F7 HID_KEY_F8 = 0x41 // Keyboard F8 HID_KEY_F9 = 0x42 // Keyboard F9 HID_KEY_F10 = 0x43 // Keyboard F10 HID_KEY_F11 = 0x44 // Keyboard F11 HID_KEY_F12 = 0x45 // Keyboard F12 HID_KEY_SYSRQ = 0x46 // Keyboard Print Screen HID_KEY_SCROLLLOCK = 0x47 // Keyboard Scroll Lock HID_KEY_PAUSE = 0x48 // Keyboard Pause HID_KEY_INSERT = 0x49 // Keyboard Insert HID_KEY_HOME = 0x4a // Keyboard Home HID_KEY_PAGEUP = 0x4b // Keyboard Page Up HID_KEY_DELETE = 0x4c // Keyboard Delete Forward HID_KEY_END = 0x4d // Keyboard End HID_KEY_PAGEDOWN = 0x4e // Keyboard Page Down HID_KEY_RIGHT = 0x4f // Keyboard Right Arrow HID_KEY_LEFT = 0x50 // Keyboard Left Arrow HID_KEY_DOWN = 0x51 // Keyboard Down Arrow HID_KEY_UP = 0x52 // Keyboard Up Arrow HID_KEY_NUMLOCK = 0x53 // Keyboard Num Lock and Clear HID_KEY_KPSLASH = 0x54 // Keypad / HID_KEY_KPASTERISK = 0x55 // Keypad * HID_KEY_KPMINUS = 0x56 // Keypad - HID_KEY_KPPLUS = 0x57 // Keypad + HID_KEY_KPENTER = 0x58 // Keypad ENTER HID_KEY_KP1 = 0x59 // Keypad 1 and End HID_KEY_KP2 = 0x5a // Keypad 2 and Down Arrow HID_KEY_KP3 = 0x5b // Keypad 3 and PageDn HID_KEY_KP4 = 0x5c // Keypad 4 and Left Arrow HID_KEY_KP5 = 0x5d // Keypad 5 HID_KEY_KP6 = 0x5e // Keypad 6 and Right Arrow HID_KEY_KP7 = 0x5f // Keypad 7 and Home HID_KEY_KP8 = 0x60 // Keypad 8 and Up Arrow HID_KEY_KP9 = 0x61 // Keypad 9 and Page Up HID_KEY_KP0 = 0x62 // Keypad 0 and Insert HID_KEY_KPDOT = 0x63 // Keypad . and Delete HID_KEY_102ND = 0x64 // Keyboard Non-US \ and | HID_KEY_COMPOSE = 0x65 // Keyboard Application HID_KEY_POWER = 0x66 // Keyboard Power HID_KEY_KPEQUAL = 0x67 // Keypad = HID_KEY_F13 = 0x68 // Keyboard F13 HID_KEY_F14 = 0x69 // Keyboard F14 HID_KEY_F15 = 0x6a // Keyboard F15 HID_KEY_F16 = 0x6b // Keyboard F16 HID_KEY_F17 = 0x6c // Keyboard F17 HID_KEY_F18 = 0x6d // Keyboard F18 HID_KEY_F19 = 0x6e // Keyboard F19 HID_KEY_F20 = 0x6f // Keyboard F20 HID_KEY_F21 = 0x70 // Keyboard F21 HID_KEY_F22 = 0x71 // Keyboard F22 HID_KEY_F23 = 0x72 // Keyboard F23 HID_KEY_F24 = 0x73 // Keyboard F24 HID_KEY_OPEN = 0x74 // Keyboard Execute HID_KEY_HELP = 0x75 // Keyboard Help HID_KEY_PROPS = 0x76 // Keyboard Menu HID_KEY_FRONT = 0x77 // Keyboard Select HID_KEY_STOP = 0x78 // Keyboard Stop HID_KEY_AGAIN = 0x79 // Keyboard Again HID_KEY_UNDO = 0x7a // Keyboard Undo HID_KEY_CUT = 0x7b // Keyboard Cut HID_KEY_COPY = 0x7c // Keyboard Copy HID_KEY_PASTE = 0x7d // Keyboard Paste HID_KEY_FIND = 0x7e // Keyboard Find HID_KEY_MUTE = 0x7f // Keyboard Mute HID_KEY_VOLUMEUP = 0x80 // Keyboard Volume Up HID_KEY_VOLUMEDOWN = 0x81 // Keyboard Volume Down // = 0x82 Keyboard Locking Caps Lock // = 0x83 Keyboard Locking Num Lock // = 0x84 Keyboard Locking Scroll Lock HID_KEY_KPCOMMA = 0x85 // Keypad Comma // = 0x86 Keypad Equal Sign HID_KEY_RO = 0x87 // Keyboard International1 HID_KEY_KATAKANAHIRAGANA = 0x88 // Keyboard International2 HID_KEY_YEN = 0x89 // Keyboard International3 HID_KEY_HENKAN = 0x8a // Keyboard International4 HID_KEY_MUHENKAN = 0x8b // Keyboard International5 HID_KEY_KPJPCOMMA = 0x8c // Keyboard International6 // = 0x8d Keyboard International7 // = 0x8e Keyboard International8 // = 0x8f Keyboard International9 HID_KEY_HANGEUL = 0x90 // Keyboard LANG1 HID_KEY_HANJA = 0x91 // Keyboard LANG2 HID_KEY_KATAKANA = 0x92 // Keyboard LANG3 HID_KEY_HIRAGANA = 0x93 // Keyboard LANG4 HID_KEY_ZENKAKUHANKAKU = 0x94 // Keyboard LANG5 // = 0xb0 Keypad 00 // = 0xb1 Keypad 000 // = 0xb2 Thousands Separator // = 0xb3 Decimal Separator // = 0xb4 Currency Unit // = 0xb5 Currency Sub-unit HID_KEY_KPLEFTPAREN = 0xb6 // Keypad ( HID_KEY_KPRIGHTPAREN = 0xb7 // Keypad ) HID_KEY_LEFTCTRL = 0xe0 // Keyboard Left Control HID_KEY_LEFTSHIFT = 0xe1 // Keyboard Left Shift HID_KEY_LEFTALT = 0xe2 // Keyboard Left Alt HID_KEY_LEFTMETA = 0xe3 // Keyboard Left GUI HID_KEY_RIGHTCTRL = 0xe4 // Keyboard Right Control HID_KEY_RIGHTSHIFT = 0xe5 // Keyboard Right Shift HID_KEY_RIGHTALT = 0xe6 // Keyboard Right Alt HID_KEY_RIGHTMETA = 0xe7 // Keyboard Right GUI HID_KEY_MEDIA_PLAYPAUSE = 0xe8 HID_KEY_MEDIA_STOPCD = 0xe9 HID_KEY_MEDIA_PREVIOUSSONG = 0xea HID_KEY_MEDIA_NEXTSONG = 0xeb HID_KEY_MEDIA_EJECTCD = 0xec HID_KEY_MEDIA_VOLUMEUP = 0xed HID_KEY_MEDIA_VOLUMEDOWN = 0xee HID_KEY_MEDIA_MUTE = 0xef HID_KEY_MEDIA_WWW = 0xf0 HID_KEY_MEDIA_BACK = 0xf1 HID_KEY_MEDIA_FORWARD = 0xf2 HID_KEY_MEDIA_STOP = 0xf3 HID_KEY_MEDIA_FIND = 0xf4 HID_KEY_MEDIA_SCROLLUP = 0xf5 HID_KEY_MEDIA_SCROLLDOWN = 0xf6 HID_KEY_MEDIA_EDIT = 0xf7 HID_KEY_MEDIA_SLEEP = 0xf8 HID_KEY_MEDIA_COFFEE = 0xf9 HID_KEY_MEDIA_REFRESH = 0xfa HID_KEY_MEDIA_CALC = 0xfb )
const ( MaskNumLock = 1 << 0 MaskCapsLock = 1 << 1 MaskScrollLock = 1 << 2 MaskCompose = 1 << 3 MaskKana = 1 << 4 MaskNone = 1 << 7 //not really a mask, indicates no change MaskAny = MaskNumLock | MaskCapsLock | MaskScrollLock | MaskCompose | MaskKana MaskAnyOrNone = MaskNumLock | MaskCapsLock | MaskScrollLock | MaskCompose | MaskKana | MaskNone )
const ( BUTTON1 = byte(1 << 0) BUTTON2 = byte(1 << 1) BUTTON3 = byte(1 << 2) )
const (
MAX_VM = 8
)
Variables ¶
var ( ErrAbort = errors.New("Event listening aborted") ErrIrq = errors.New("Aborted due to interrupt request") ErrNotAllowed = errors.New("Calling not allowed (currently disabled)") ErrNoKeyboard = errors.New("Using HID keyboard not allowed (currently disabled)") ErrNoMouse = errors.New("Using HID mouse not allowed (currently disabled)") )
var ( KeyboardReportEmpty = NewKeyboardOutReport(0) ErrTimeout = errors.New("Timeout reached") )
var ( UsbKeyToString = generateKey2Str() StringToUsbKey = generateStr2Key() UsbModKeyToString = generateMod2Str() StringToUsbModKey = generateStr2Mod() )
Functions ¶
This section is empty.
Types ¶
type AsyncOttoJob ¶
type AsyncOttoJob struct { Cancel context.CancelFunc Id int Source interface{} ResultErr error ResultValue otto.Value // contains filtered or unexported fields }
func (*AsyncOttoJob) GetVMId ¶
func (job *AsyncOttoJob) GetVMId() (vmID int, err error)
func (*AsyncOttoJob) Result ¶
func (job *AsyncOttoJob) Result() interface{}
func (*AsyncOttoJob) ResultJsonString ¶
func (job *AsyncOttoJob) ResultJsonString() (string, error)
func (*AsyncOttoJob) SetFinished ¶
func (job *AsyncOttoJob) SetFinished()
func (*AsyncOttoJob) WaitFinished ¶
func (job *AsyncOttoJob) WaitFinished()
func (*AsyncOttoJob) WaitResult ¶
func (job *AsyncOttoJob) WaitResult() (otto.Value, error)
type AsyncOttoVM ¶
func NewAsyncOttoVM ¶
func NewAsyncOttoVM(vm *otto.Otto) *AsyncOttoVM
func NewAsyncOttoVMClone ¶
func NewAsyncOttoVMClone(vm *otto.Otto) *AsyncOttoVM
func (*AsyncOttoVM) HandleEvent ¶
func (avm *AsyncOttoVM) HandleEvent(event Event)
func (AsyncOttoVM) IsWorking ¶
func (avm AsyncOttoVM) IsWorking() bool
func (*AsyncOttoVM) RunAsync ¶
func (avm *AsyncOttoVM) RunAsync(ctx context.Context, src interface{}, anonymousSelfInvoked bool) (job *AsyncOttoJob, err error)
func (*AsyncOttoVM) SetDefaultHandler ¶
func (avm *AsyncOttoVM) SetDefaultHandler()
func (*AsyncOttoVM) SetEventHandler ¶
func (avm *AsyncOttoVM) SetEventHandler(handler EventHandler)
func (*AsyncOttoVM) SetWorking ¶
func (avm *AsyncOttoVM) SetWorking(working bool)
type Event ¶
type Event struct { Type EventType Job *AsyncOttoJob Vm *AsyncOttoVM Message string }
type EventHandler ¶
type EventHandler interface {
HandleEvent(event Event)
}
type EventType ¶
type EventType int32
const ( EventType_JOB_STARTED EventType = 0 EventType_JOB_STOPPED EventType = 1 EventType_CONTROLLER_ABORTED EventType = 2 EventType_JOB_CANCELLED EventType = 3 EventType_JOB_SUCCEEDED EventType = 4 EventType_JOB_SUCCEEDED_NO_RESULT EventType = 5 EventType_JOB_FAILED EventType = 6 EventType_JOB_WAIT_LED_FINISHED EventType = 7 EventType_JOB_WAIT_LED_REPEATED_FINISHED EventType = 8 EventType_JOB_NO_FREE_VM EventType = 9 )
type HIDController ¶
type HIDController struct { Keyboard *HIDKeyboard Mouse *Mouse // contains filtered or unexported fields }
func NewHIDController ¶
func (*HIDController) Abort ¶
func (ctl *HIDController) Abort()
func (*HIDController) CancelAllBackgroundJobs ¶
func (ctl *HIDController) CancelAllBackgroundJobs()
func (*HIDController) GetAllBackgroundJobs ¶
func (ctl *HIDController) GetAllBackgroundJobs() (jobs []*AsyncOttoJob, err error)
func (*HIDController) GetBackgroundJobByID ¶
func (ctl *HIDController) GetBackgroundJobByID(id int) (job *AsyncOttoJob, err error)
func (*HIDController) HandleEvent ¶
func (ctl *HIDController) HandleEvent(event Event)
func (*HIDController) NextUnusedVM ¶
func (ctl *HIDController) NextUnusedVM() (vm *AsyncOttoVM, err error)
func (*HIDController) SetDefaultHandler ¶
func (ctl *HIDController) SetDefaultHandler()
func (*HIDController) SetEventHandler ¶
func (ctl *HIDController) SetEventHandler(handler EventHandler)
func (*HIDController) StartScriptAsBackgroundJob ¶
func (ctl *HIDController) StartScriptAsBackgroundJob(ctx context.Context, script string, anonymousSelfInvoked bool) (job *AsyncOttoJob, err error)
func (*HIDController) WaitBackgroundJobResult ¶
func (ctl *HIDController) WaitBackgroundJobResult(ctx context.Context, job *AsyncOttoJob) (val otto.Value, err error)
type HIDKeyboard ¶
type HIDKeyboard struct { DevicePath string ActiveLanguageLayout *HIDKeyboardLanguageMap LanguageMaps map[string]*HIDKeyboardLanguageMap //available language maps LEDWatcher *KeyboardLEDStateWatcher KeyDelay int KeyDelayJitter int // contains filtered or unexported fields }
func NewKeyboard ¶
func (*HIDKeyboard) Close ¶
func (kbd *HIDKeyboard) Close()
func (HIDKeyboard) ListLanguageMapNames ¶
func (kbd HIDKeyboard) ListLanguageMapNames() (mapNames []string)
func (*HIDKeyboard) LoadLanguageMapDir ¶
func (kbd *HIDKeyboard) LoadLanguageMapDir(dirpath string) (err error)
func (*HIDKeyboard) LoadLanguageMapFromFile ¶
func (kbd *HIDKeyboard) LoadLanguageMapFromFile(filepath string) (err error)
func (*HIDKeyboard) PressKeySequence ¶
func (kbd *HIDKeyboard) PressKeySequence(reports []KeyboardOutReport) (err error)
PressKeySequence writes the output reports given in `reports` to the keyboard device in sequential order. A all empty report is automatically appended in order to release all keys after finishing the sequence (press in contrast to hold).
There's a clear reason to use sequences of reports. For example the character 'à' on a German keyboard layout, is created by pressing the key with [`] in combination with [SHIFT], followed by the key [A]. To represent the underlying key sequence three reports are needed: 1) A report containing the key [`] (key equal from US layout) along with the [SHIFT] modifier 2) A report containing the key [A] (the [A] key results in lower case 'a', as no [SHIFT] modifier is used) 3) A report containing no key and no modifier representing the release of all keys
It is worth mentioning, that a single report could hold 8 different modifiers and up to 6 dedicated keys, for the keyboard type used here. Anyway, packing the keys [A] and [`] in a single report, along with the [SHIFT] modifier, would lead to a different result (if there's a result at all). The reason is, that the pressing order of the two keys [A] and [`] couldn't be determined anymore, neither would it be possible to distinguish if the [SHIFT] modifier should be combined with [A], [`] or both.
As shown, even a single character could be represented by several reports in sequential order! This is why PressKeySequence is needed.
A key combination, in contrast to a sequence, combines several keys in a single report (f.e. CTRL+ALT+A)
func (*HIDKeyboard) SetActiveLanguageMap ¶
func (kbd *HIDKeyboard) SetActiveLanguageMap(name string) (err error)
func (*HIDKeyboard) StringToKeyCombo ¶
func (kbd *HIDKeyboard) StringToKeyCombo(comboStr string) (result *KeyboardOutReport, err error)
func (*HIDKeyboard) StringToPressKeyCombo ¶
func (kbd *HIDKeyboard) StringToPressKeyCombo(comboStr string) (err error)
func (*HIDKeyboard) StringToPressKeySequence ¶
func (kbd *HIDKeyboard) StringToPressKeySequence(str string) (err error)
func (*HIDKeyboard) WaitLEDStateChange ¶
func (kbd *HIDKeyboard) WaitLEDStateChange(irqFunc <-chan func(), intendedChange byte, timeout time.Duration) (changed *HIDLEDState, err error)
Waits for single LED state change intendedChange: Mask values combined with logical or, to indicate which LEDs are allowed to trigger MaskNu return value changed: Mask values combined with logical or, indicating which LED actually changed in order to stop waiting
func (*HIDKeyboard) WaitLEDStateChangeRepeated ¶
func (kbd *HIDKeyboard) WaitLEDStateChangeRepeated(irqFunc <-chan func(), intendedChange byte, repeatCount int, minRepeatDelay time.Duration, timeout time.Duration) (changed *HIDLEDState, err error)
type HIDKeyboardLanguageMap ¶
type HIDKeyboardLanguageMap struct { Name string Description string Mapping map[string][]KeyboardOutReport }
func (*HIDKeyboardLanguageMap) StoreToFile ¶
func (klm *HIDKeyboardLanguageMap) StoreToFile(filePath string) (err error)
type HIDLEDState ¶
func (HIDLEDState) AnyOn ¶
func (s HIDLEDState) AnyOn() bool
func (HIDLEDState) Changes ¶
func (s HIDLEDState) Changes(other HIDLEDState) (result HIDLEDState)
func (HIDLEDState) Mask ¶
func (s HIDLEDState) Mask(mask HIDLEDState) (result HIDLEDState)
type KeyboardLEDStateListener ¶
type KeyboardLEDStateListener struct {
// contains filtered or unexported fields
}
func (*KeyboardLEDStateListener) Unregister ¶
func (l *KeyboardLEDStateListener) Unregister()
type KeyboardLEDStateWatcher ¶
type KeyboardLEDStateWatcher struct {
// contains filtered or unexported fields
}
func NewLEDStateWatcher ¶
func NewLEDStateWatcher(ctx context.Context, devFilePath string) (res *KeyboardLEDStateWatcher, err error)
func (*KeyboardLEDStateWatcher) RetrieveNewListener ¶
func (w *KeyboardLEDStateWatcher) RetrieveNewListener() (l *KeyboardLEDStateListener, err error)
func (*KeyboardLEDStateWatcher) Stop ¶
func (w *KeyboardLEDStateWatcher) Stop() (err error)
- unregisters all listeners - listeners which are still processed receive an interrupt on their interrupt channel, it is the responsibility of the listener to deal with this interrupt and close the channel after the interrupt is consumed (wrting to the channel happens only once) - close ledStateFile
type KeyboardOutReport ¶
func NewKeyboardOutReport ¶
func NewKeyboardOutReport(modifiers byte, keys ...byte) (res KeyboardOutReport)
func (KeyboardOutReport) Deserialize ¶
func (rep KeyboardOutReport) Deserialize(data []byte) (err error)
func (*KeyboardOutReport) MarshalJSON ¶
func (kr *KeyboardOutReport) MarshalJSON() ([]byte, error)
func (KeyboardOutReport) Serialize ¶
func (rep KeyboardOutReport) Serialize() (out []byte)
func (KeyboardOutReport) String ¶
func (kr KeyboardOutReport) String() string
func (*KeyboardOutReport) UnmarshalJSON ¶
func (kr *KeyboardOutReport) UnmarshalJSON(b []byte) error
func (KeyboardOutReport) WriteTo ¶
func (rep KeyboardOutReport) WriteTo(filePath string) (err error)
func (KeyboardOutReport) WriteToFile ¶
func (rep KeyboardOutReport) WriteToFile(file *os.File) (err error)
Accepts *os.File, in contrast to WriteTo() this allows keeping the file open
type Mouse ¶
type Mouse struct {
// contains filtered or unexported fields
}