Module hid

High-level Lua interface to the Linux HID subsystem.

This module allows registering Lua table with functions as a HID driver, support for id_table is provided, which allows matching HID devices

Class hid_driver

hid_driver:register (table) Registers a new HID driver.


Class hid_driver

Represents a registered HID driver. This is a userdata object returned by hid.register(). It encapsulates the kernel struct hid_driver and associated Lunatik runtime information necessary to invoke the Lua callback when a HID device is matched. The registered field indicates whether the driver is currently registered
hid_driver:register (table)

Registers a new HID driver. This function creates a new HID driver object from a Lua table and registers it with the kernel. The Lua table must contain the following fields:

  • name: The name of the driver (string).

  • id_table: A table of device IDs that this driver can match against (lua_table).

    • each id is a table consisting of fields:

      • bus: The bus type (integer, default: HID_BUS_ANY).
      • group: The group type (integer, default: HID_GROUP_ANY).
      • vendor: The vendor ID (integer, default: HID_ANY_ID).
      • product: The product ID (integer, default: HID_ANY_ID).
      • driver_data: Additional driver data (integer, default: 0).

Parameters:

  • table table The Lua table containing driver information.

Returns:

    hid_driver The registered HID driver object.

See also:

generated by LDoc 1.5.0 Last updated 2026-02-16 16:00:29