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.

22 lines
660 B
Lua

local base = string.match(..., "(.-)[^%.]+%.[^%.]+$")
local enums = require(base.."ev_api.decls").enums
local ffi = require("ffi")
local fh = require(base.."helper.ffi_struct")
local format = string.format
local mt, index = {}, {}
fh.gen_enum_accessor(index, enums.BUS, "bustype")
fh.gen_raw_accessor(index, "vendor")
fh.gen_raw_accessor(index, "product")
fh.gen_raw_accessor(index, "version")
function index:tostring()
return format("id{bustype=%s, vendor=%#x, product=%#x, version=%#x}",
self.bustype, self.vendor, self.product, self.version)
end
mt.__tostring = index.tostring
return fh.base(mt, index, ffi.typeof("struct input_id"))