inputattach
Attach serial port devices as input devices
TLDR
Attach a Pulse8 CEC device to the input system
Display help
SYNOPSIS
inputattach [options] protocol device
PARAMETERS
-h
Displays help information and exits.
-v
Shows version information and exits.
-r
Instructs inputattach to attempt to reopen the serial device if it encounters a hangup or becomes unavailable.
-n
Prevents inputattach from daemonizing (forking into the background). It will remain in the foreground.
-d
Enables verbose debug output, providing detailed information about the data being read and processed.
-o speed
Overrides the default baud rate for the serial port. speed should be a numerical value like 9600 or 19200.
-s file
Creates a PID file at the specified file path when daemonizing. This file contains the process ID of the daemon.
protocol
Specifies the input device protocol to be used for interpreting serial data. Examples include microsoft, logitech, ps2, elo, wacom, keyboard, spaceorb, magellan, usbtouchscreen, etc.
device
The path to the serial device file (e.g., /dev/ttyS0, /dev/ttyUSB0 for USB-to-serial adapters, or /dev/ser1).
DESCRIPTION
The inputattach command is a crucial utility designed to connect various serial input devices to the Linux kernel's robust input subsystem. It operates by reading raw data from a specified serial port (e.g., /dev/ttyS0), interpreting this data according to a predefined input protocol (such as microsoft, logitech, wacom, or elo), and subsequently injecting corresponding input events into the system. This process allows traditional serial devices, which lack direct kernel support via generic serial drivers, to function seamlessly as standard input devices. These devices then become accessible to user-space applications like X servers, desktop environments, or custom industrial control software. Primarily beneficial for integrating older hardware or specialized industrial equipment, inputattach typically runs in the foreground unless daemonized, continuously monitoring the serial port for input.
CAVEATS
Requires root privileges to open serial devices and create input devices.
Can conflict with other processes attempting to access the same serial port.
Must be running for the attached device to function; often integrated as a system service.
Modern USB devices typically use kernel modules, making inputattach unnecessary or conflicting.
Some protocols might already be handled by kernel modules (e.g., PS/2 mice via psmouse), potentially leading to duplicate input events if both are active.
SUPPORTED PROTOCOLS
inputattach supports a diverse range of serial input protocols, enabling compatibility with various types of devices. This includes numerous serial mouse protocols (e.g., Microsoft, Logitech, PS/2), touchscreen protocols (e.g., ELO, Wacom, MicroTouch), specialized joysticks (e.g., SpaceOrb, Magellan), and custom serial keyboard interfaces. The specific list can usually be found by running inputattach -h.
INTERACTION WITH THE INPUT LAYER
The primary function of inputattach is to convert serial data streams into standardized input events that conform to the Linux kernel's evdev (event device) interface. evdev is the unified interface for all input devices, allowing applications like Xorg, Wayland compositors, and other desktop environments to automatically detect, configure, and utilize the attached device as if it were a native kernel-supported input device. This abstraction simplifies the development of user-space applications by providing a consistent input event stream.
HISTORY
Part of the input-tools package, inputattach was developed to provide crucial support for legacy or specialized serial input devices in the evolving Linux environment. Its role has been to bridge the gap between these older peripherals and the modern Linux input subsystem, particularly the evdev interface. While the widespread adoption of USB and native kernel drivers has reduced its necessity for common peripherals, it remains an indispensable tool for integrating specific industrial, embedded, or vintage hardware systems where serial connectivity is paramount.
SEE ALSO
ser2net(8), agetty(8), mousedev(4), evdev(4)