Skip to content

BlueLua/evdev

evdev

Test LuaRocks Lua Versions Platform License

Lua bindings for Linux evdev input devices and /dev/uinput virtual devices.

Check out the documentation for guides and examples.

✨ Features

  • Device Discovery: List and search for connected input devices by name, path, or physical location.
  • Event Stream: Read kernel input events with high-resolution timestamps.
  • Virtual Devices: Emulate any hardware input device (mouse, keyboard, gamepad) programmatically via uinput.
  • Event Selector: Poll multiple devices concurrently in a single non-blocking event loop.
  • Multiple Lua Versions: Compatible with LuaJIT, Lua 5.1, 5.2, 5.3, 5.4, and 5.5.

📦 Installation

luarocks install bluelua-evdev

🚀 Usage

local evdev = require "evdev"

local dev = assert(evdev.device.open("/dev/input/event0"))

for event in dev:events() do
  if evdev.events.is_press(event) then
    print("Key pressed: " .. event. code)
  end
end