LinuxCommandLibrary

libinput

Configure, test, and debug input devices

TLDR

List all devices recognized by libinput

$ sudo libinput list-devices
copy

Print all libinput events
$ sudo libinput debug-events
copy

Show a GUI to visualize libinput's events
$ sudo libinput debug-gui
copy

Debug tablet axis values
$ sudo libinput debug-tablet
copy

Display help
$ libinput [[-h|--help]]
copy

SYNOPSIS

libinput <subcommand> [options...]

PARAMETERS

subcommand
    Specifies the action to perform. Common subcommands include:
list-devices: Lists all detected input devices.
debug-events: Shows input events in real-time.
debug-gestures: Displays gesture events for touchpads.
measure: Provides tools for measuring device properties (e.g., touchpad size, button wobble).
record: Records input events to a file.
replay: Replays recorded input events from a file.
locate-device: Locates a libinput device based on its syspath.

--verbose
    (Applicable to list-devices and debug-events)
Provides more detailed output. For list-devices, it shows device capabilities and configurations. For debug-events, it shows initial device configurations.

--raw
    (Applicable to debug-events)
Prints raw, unparsed input events as received from the kernel, in addition to processed libinput events.

--tablet
    (Applicable to debug-events)
Filters output to only show events from tablet devices.

--strip-details
    (Applicable to debug-events)
Omits detailed event information like coordinates, useful for focusing on event types.

[device]
    (Applicable to debug-events, debug-gestures)
Specifies a particular device node (e.g., /dev/input/eventX) to monitor, instead of all devices.

output_file
    (Applicable to record)
The file path where recorded input events will be saved.

input_file
    (Applicable to replay)
The file path from which recorded input events will be read and replayed.

syspath
    (Applicable to locate-device)
The syspath of the input device (e.g., /sys/devices/...) to locate its libinput device.

DESCRIPTION

libinput is a foundational library in modern Linux, responsible for handling input devices like touchpads, mice, keyboards, and tablets. It provides a unified and robust interface for Wayland compositors and X.Org drivers.

The libinput command-line utility serves as a powerful suite of tools to inspect, debug, and measure various aspects of these input devices. It allows users and developers to understand how libinput processes events, identify configuration issues, and test device behavior. These tools are crucial for troubleshooting input-related problems, analyzing specific device interactions, and developing effective input handling solutions within the Linux graphics stack. They can display raw kernel events, show processed gesture recognition, measure physical properties of devices, and record/replay input streams for detailed analysis and automated testing.

CAVEATS

Many libinput subcommands (e.g., debug-events, record) require root privileges to access input device nodes directly in /dev/input/. The output of debug-events can be very verbose; using filters like --tablet, --strip-details, or specifying a device is highly recommended for focused analysis. These tools are primarily intended for debugging and development rather than general user interaction.

USAGE CONTEXT

The libinput tools are invaluable for diagnosing and resolving issues related to input device behavior, such as touchpad scrolling inconsistencies, mouse pointer acceleration problems, keyboard layout issues, and tablet input errors. They help differentiate between hardware malfunctions, kernel driver bugs, and libinput-specific configuration discrepancies.

CONFIGURATION

While the libinput command itself is for debugging, the configuration of libinput's behavior (e.g., touchpad settings, pointer speed) is typically managed through desktop environment settings, graphical control panels, or system-wide Udev rules and configuration files in /etc/libinput/. The libinput debug-events --verbose output can be helpful in understanding what configuration settings libinput is currently applying to a device.

HISTORY

libinput emerged as a modern input stack for Linux, specifically to address the architectural limitations and complexities of the older X.Org input system. Its development gained significant momentum with the rise of Wayland, aiming to provide a robust, unified, and secure method for handling input devices in a compositor-centric environment. The command-line utilities, initially separate tools like libinput-debug-events and libinput-list-devices, were developed as essential companions to the library. They enable developers and system administrators to inspect and troubleshoot input device behavior in Wayland-native setups, much like xinput served the X.Org world. Over time, these individual utilities were consolidated under the single libinput command for streamlined access.

SEE ALSO

xinput(1), evtest(1), udevadm(8)

Copied to clipboard