keyboard

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2022 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DryRun          bool
	Remap           map[uint32]uint16
	RogKey          []string `json:"rogKey"`
	BrightnessLevel byte     `json:"brightnessLevel"`
}

Config defines the behavior of Keyboard Control. If DryRun is set to true, no actual IOs will be performed. Remap defines the key remapping behavior or Fn+ArrowLeft/ArrowRight (see system/keyboard) to standard key scancode.

type Control

type Control struct {
	Config
	// contains filtered or unexported fields
}

Control allows you to set the hid related functionalities directly. The controller is safe for multiple goroutines.

func NewControl

func NewControl(config Config) (*Control, error)

NewControl checks if the computer has the hid control interface, and returns a control interface if it does

func (*Control) Apply

func (c *Control) Apply() error

Apply satisfies persist.Registry

func (*Control) BrightnessDown

func (c *Control) BrightnessDown() error

BrightnessDown decreases the keyboard backlight by one level

func (*Control) BrightnessUp

func (c *Control) BrightnessUp() error

BrightnessUp increases the keyboard backlight by one level

func (*Control) Close

func (c *Control) Close() error

Close satisfied persist.Registry

func (*Control) CurrentBrightness

func (c *Control) CurrentBrightness() Level

CurrentBrightness returns current brightness Level

func (*Control) EmulateKeyPress

func (c *Control) EmulateKeyPress(keyCode uint16) error

EmulateKeyPress will emulate a keypress via SendInput() scancode. Note: some applications using DirectInput may not register this.

func (*Control) GetWSInfo

func (c *Control) GetWSInfo() gin.H

func (*Control) HandleWSMessage

func (c *Control) HandleWSMessage(ws *websocket.Conn, action int, value string)

func (*Control) Initialize

func (c *Control) Initialize() error

Initialize will send initialization buffer to the keyboard control device. Note: This should be called prior to calling any control methods, and after ACPI resume.

func (*Control) Load

func (c *Control) Load(v []byte) error

Load satisfies persist.Registry TODO: check if the input is actually valid

func (*Control) Name

func (c *Control) Name() string

Name satisfies persist.Registry

func (*Control) Notify

func (c *Control) Notify(t plugin.Notification)

Notify satifies system/plugin.Plugin

func (*Control) Run

func (c *Control) Run(haltCtx context.Context, cb chan<- plugin.Callback) <-chan error

Run satifies system/plugin.Plugin

func (*Control) SetBrightness

func (c *Control) SetBrightness(v Level) error

SetBrightness change the keyboard backlight directly

func (*Control) ToggleTouchPad

func (c *Control) ToggleTouchPad() error

ToggleTouchPad will toggle enabling/disabling the touchpad

func (*Control) Value

func (c *Control) Value() []byte

Value satisfies persist.Registry

type Level

type Level byte

Level defines the different level of keybroad brightness

const (
	OFF    Level = 0x00 // Off
	LOW    Level = 0x01 // Low
	MEDIUM Level = 0x02 // Medium
	HIGH   Level = 0x03 // High
)

Brightness level

func (Level) String

func (i Level) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL