Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Writing to device? #4

Open
evanpurkhiser opened this issue Mar 27, 2017 · 1 comment
Open

Writing to device? #4

evanpurkhiser opened this issue Mar 27, 2017 · 1 comment

Comments

@evanpurkhiser
Copy link

Would be awesome if this library supported writing to the devices :-)

@omeryagmurlu
Copy link

omeryagmurlu commented Sep 24, 2021

Just for future reference: you can easily write to any device using the constants and structs provided in the library

func input_event(typ uint16, code uint16, value int32) ev.InputEvent {
	return ev.InputEvent{
		Time: syscall.Timeval{
			Sec:  time.Now().Unix(),
			Usec: time.Now().UnixNano() / 1000 % 1000,
		},
		Type:  typ,
		Code:  code,
		Value: value,
	}
}

and

binary.Write(f, binary.LittleEndian, input_event(ev.EV_KEY, ev.KEY_LEFTCTRL, 1))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants