-- See https://wayland.freedesktop.org/libinput/doc/latest/lua-plugins.html -- libinput and evdev are plugin globals tables version = libinput:register({1}) -- no idea what version should be specified here local VID = 0x046D -- Vendor: Logitech local PID = 0x4085 -- Product: G604 Mouse libinput:log_debug("Event viewer plugin initialized on version " .. version) libinput:log_debug("Locating device " .. string.format("%x", VID) .. ":" .. string.format("%x", PID)) libinput:connect("new-evdev-device", function (device) local info = device:info() if info.vid == VID and info.pid == PID then local devName = device:name() libinput:log_debug("Found " .. devName) -- list device enabled usages/events for uk, uv in pairs(evdev) do for duk, _ in pairs(device:usages()) do if uv == duk then libinput:log_debug(uk .. " = " .. tostring(duk)) end end end --[[ -- previous attempt to disable hi-res scrolling before quirks solution if device:usages()[evdev.REL_WHEEL_HI_RES] then libinput:log_info(devName .. ": disabling hi-res scoll") device:disable_evdev_usage(evdev.REL_WHEEL_HI_RES) end ]] device:connect("evdev-frame", function (device, frame, timestamp) libinput:log_debug("-----") -- separate frames for _, event in ipairs(frame) do --[[ REL_WHEEL = 131080 REL_WHEEL_HI_RES = 131083 Scroll up: 131083:15 Scroll down: 131083:-15 ]] libinput:log_debug("EVENT " .. event.usage .. ":" .. event.value) end return frame end) --[[ device:connect("device-removed", function (device, frame, timestamp) libinput:unregister() -- prevents this plugin being enabled after a disconnect and reconnect end) ]] end end)