You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
547 B
Lua

local ffi = require("ffi")
local uinput = require("lib.uinput")
local u = uinput()
print("version", u.version)
u:set_evbit("KEY")
u:set_keybit("KEY_SPACE")
u:setup{
id={bustype="USB", vendor=0x1234, product=0x5678},
name="test"}
u:create()
print("created", u.sysname)
ffi.cdef("int usleep(long usecs);")
ffi.C.usleep(100000)
u:write{type="KEY", code="KEY_SPACE", value=1}
u:write{type="SYN", code="REPORT"}
u:write{type="KEY", code="KEY_SPACE", value=0}
u:write{type="SYN", code="REPORT"}
-- ffi.C.usleep(10000000)
u:destroy()
u = nil