Documentation ¶
Index ¶
- func ToStringUEvent(evt UEvent) string
- type ConnectionMode
- type Device
- func (d *Device) CleanupUDevDatabaseData() error
- func (d *Device) Close() error
- func (d *Device) EmitUDevEvent(action KObjAction) error
- func (d *Device) GetSysPath() string
- func (d *Device) GetUDevDBDevicePath() string
- func (d *Device) GetUDevDBInputPath() string
- func (d *Device) Initialize(udev *UDev)
- func (d *Device) MakeDeviceNode()
- func (d *Device) WriteUDevDatabaseData()
- type DeviceType
- type KObjAction
- type NetlinkConnection
- type UDev
- type UEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToStringUEvent ¶
Types ¶
type ConnectionMode ¶
type ConnectionMode int
const ( KERNEL ConnectionMode = 1 UDEV ConnectionMode = 2 )
type Device ¶
type Device struct { OriginalId int Id int KObj string Env map[string]string Major int16 Minor int16 DevPath string DeviceType DeviceType // contains filtered or unexported fields }
func (*Device) CleanupUDevDatabaseData ¶
func (*Device) EmitUDevEvent ¶
func (d *Device) EmitUDevEvent(action KObjAction) error
func (*Device) GetSysPath ¶
func (*Device) GetUDevDBDevicePath ¶
func (*Device) GetUDevDBInputPath ¶
func (*Device) Initialize ¶
* This function should be called after all of the public properties of the device have been set.
func (*Device) MakeDeviceNode ¶
func (d *Device) MakeDeviceNode()
func (*Device) WriteUDevDatabaseData ¶
func (d *Device) WriteUDevDatabaseData()
type DeviceType ¶
type DeviceType int
const ( KEYBOARD DeviceType = iota MOUSE TOUCHSCREEN GAMEPAD )
type KObjAction ¶
type KObjAction string
const ( ADD KObjAction = "add" REMOVE KObjAction = "remove" CHANGE KObjAction = "change" MOVE KObjAction = "move" ONLINE KObjAction = "online" OFFLINE KObjAction = "offline" BIND KObjAction = "bind" UNBIND KObjAction = "unbind" )
func ParseKObjAction ¶
func ParseKObjAction(raw string) (a KObjAction, err error)
func (KObjAction) String ¶
func (a KObjAction) String() string
type NetlinkConnection ¶
type NetlinkConnection struct { Fd int Addr syscall.SockaddrNetlink Mode ConnectionMode // contains filtered or unexported fields }
func NewNetlinkConnection ¶
func NewNetlinkConnection(ctx context.Context, mode ConnectionMode) *NetlinkConnection
func (*NetlinkConnection) Close ¶
func (c *NetlinkConnection) Close() error
Close allow to close file descriptor and socket bound
func (*NetlinkConnection) Connect ¶
func (c *NetlinkConnection) Connect() error
func (*NetlinkConnection) ReadMsg ¶
func (c *NetlinkConnection) ReadMsg() (msg []byte, err error)
ReadMsg allow to read an entire uevent msg
func (*NetlinkConnection) ReadUEvent ¶
func (c *NetlinkConnection) ReadUEvent() (*UEvent, error)
ReadMsg allow to read an entire uevent msg
func (*NetlinkConnection) WriteUEvent ¶
func (c *NetlinkConnection) WriteUEvent(event UEvent) (err error)
type UDev ¶
type UDev struct { // Used to listen to events from udev UDevEvents *eventemitter.Emitter // Used to listen to events from the Kernel KernelEvents *eventemitter.Emitter // contains filtered or unexported fields }
func (*UDev) WriteUDevEvent ¶
type UEvent ¶
type UEvent struct { Action KObjAction KObj string Env map[string]string }
func ParseUEvent ¶
Click to show internal directories.
Click to hide internal directories.