UniInputEngine is a Linux kernel driver that creates virtual input devices, including a keyboard, mouse, gamepad, and button device.
It uses the Linux input subsystem to generate input events directly from the kernel, allowing software on Linux to receive synthetic input events as if they came from real hardware.
-
Auto-loads at boot using
/etc/modules-load.d/uniinputengine.conf. -
Thread-safe input emission using kernel mutexes
-
Creates multiple virtual input devices
- Virtual keyboard
- Virtual mouse
- Virtual gamepad
- Virtual button device
-
Kernel-level input event generation (directly from the Linux kernel)
- Emits key events
- Emits button events
- Emits mouse button events - Emits relative mouse movement (X, Y, wheel)
- Emits gamepad button and axis events
-
Detected as real hardware
- Applications read events through
/dev/input/eventX - Behaves exactly like physical input devices
- Applications read events through
-
Full keyboard support
- Registers all Linux
KEY_codes
- Registers all Linux
-
Virtual Keyboard Support
- Supports all keys available in the Linux kernel (from
KEY_0toKEY_MAX) - Supports key repeat events (
REP_DELAY,REP_PERIOD)
- Supports all keys available in the Linux kernel (from
-
Virtual Mouse Support
- Buttons:
BTN_LEFT,BTN_RIGHT,BTN_MIDDLE,BTN_SIDE,BTN_EXTRA,BTN_FORWARD,BTN_BACK - Relative movement:
REL_X,REL_Y - Scroll wheel:
REL_WHEEL,REL_HWHEEL
- Buttons:
-
Virtual Gamepad Support
- Buttons:
BTN_SOUTH,BTN_EAST,BTN_NORTH,BTN_WEST,BTN_TL,BTN_TR,BTN_TL2,BTN_TR2,BTN_THUMBL,BTN_THUMBR,BTN_SELECT,BTN_START,BTN_MODE,BTN_TRIGGER - Analog axes:
ABS_X,ABS_Y,ABS_Z,ABS_RX,ABS_RY,ABS_RZ - Hat switch:
ABS_HAT0X,ABS_HAT0Y
- Buttons:
-
Virtual Button Device Support
- Buttons: from
BTN_0toBTN_9
- Buttons: from
-
Works on most Linux distributions with proper kernel headers.
-
Linux kernel 6.14 or newer
- Tested on 6.14, 6.15, 6.16, 6.17, and 6.18 on Ubuntu 24.04.3 LTS
-
GCC 13 or newer, or the GCC version used to build your running kernel
- For mainline kernels 6.15 and 6.16, GCC 14 is required
- GCC 14 must be accessible as
/usr/bin/gcc-14(symlinked if installed elsewhere)- Simply naming it
gccis not enough
- Simply naming it
- For mainline kernels 6.17 and 6.18, GCC 15 is required
- GCC 15 must be accessible as
/usr/bin/gcc-15(symlinked if installed elsewhere)- Simply naming it
gccis not enough
- Simply naming it
-
Make
-
Linux kernel headers for the running kernel (usually preinstalled on Ubuntu)
Note for mainline kernels 6.15 and 6.16:
/usr/bin/gcc-14 symlink is mandatory. Without it, you may get compilation errors.
Note for mainline kernels 6.17 and 6.18:
/usr/bin/gcc-15 symlink is mandatory. Without it, you may get compilation errors.
- Clone the repository:
git clone https://github.com/s-r-e-e-r-a-j/UniInputEngine.git- Go to the UniInputEngine directory:
cd UniInputEngine- Give execute permission to the
install.shscript:
chmod +x install.sh- Build and install:
sudo ./install.shAfter installation, you can verify that the virtual input devices are loaded correctly by checking /proc/bus/input/devices:
cat /proc/bus/input/devicesYou should see output similar to the following:
- Virtual Keyboard
I: Bus=0006 Vendor=0000 Product=0000 Version=0000
N: Name="uniinputengine-virtual-keyboard"
P: Phys=uniinputengine/input0
S: Sysfs=/devices/virtual/input/input12
U: Uniq=
H: Handlers=sysrq rfkill kbd event6
B: PROP=0
B: EV=3
B: KEY=7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffff fffffffffffffffe
- Virtual Mouse
I: Bus=0006 Vendor=0000 Product=0000 Version=0000
N: Name="uniinputengine-virtual-mouse"
P: Phys=uniinputengine/input1
S: Sysfs=/devices/virtual/input/input13
U: Uniq=
H: Handlers=mouse2 event7
B: PROP=0
B: EV=7
B: KEY=7f0000 0 0 0 0
B: REL=143
- Virtual Gamepad
I: Bus=0006 Vendor=0000 Product=0000 Version=0000
N: Name="uniinputengine-virtual-gamepad"
P: Phys=uniinputengine/input2
S: Sysfs=/devices/virtual/input/input14
U: Uniq=
H: Handlers=event8 js1
B: PROP=0
B: EV=b
B: KEY=7fdb000100000000 0 0 0 0
B: ABS=3003f
- Virtual Button Device
I: Bus=0006 Vendor=0000 Product=0000 Version=0000
N: Name="uniinputengine-virtual-button"
P: Phys=uniinputengine/input3
S: Sysfs=/devices/virtual/input/input15
U: Uniq=
H: Handlers=event9
B: PROP=0
B: EV=3
B: KEY=3ff 0 0 0 0
Device Event Numbers:
Each virtual device created by UniInputEngine has a specific event number shown in theHandlersline of/proc/bus/input/devices.
This event number corresponds to the/dev/input/eventXfile used to send input to that device and read input events coming from that device.Important: Event numbers can change after a reboot. Always check the current numbers using:
cat /proc/bus/input/devicesExample output (event numbers may differ on your system):
uniinputengine-virtual-keyboard→ Handlers:event6→ Use/dev/input/event6uniinputengine-virtual-mouse→ Handlers:event7→ Use/dev/input/event7uniinputengine-virtual-gamepad→ Handlers:event8→ Use/dev/input/event8uniinputengine-virtual-button→ Handlers:event9→ Use/dev/input/event9
After checking the event number via /proc/bus/input/devices, you can use evtest to see all supported keys, buttons, and their corresponding keycodes/values for each virtual device.
Note:
evtestis not required for the UniInputEngine driver to function. It is only used to check supported keys/buttons and for testing purposes. If it’s not installed, you can install it using your package manager:# Debian/Ubuntu sudo apt install evtest # Fedora/RHEL sudo dnf install evtest # Arch Linux sudo pacman -Sy evtest
For example:
# virtual keyboard
sudo evtest /dev/input/event6
# virtual mouse
sudo evtest /dev/input/event7
# virtual gamepad
sudo evtest /dev/input/event8
# virtual button device
sudo evtest /dev/input/event9 This will show the full list of supported input events (keys, buttons, relative movements, axes, etc.) and their corresponding keycodes, so you can verify everything is working correctly.
Run each command separately to avoid errors:
sudo rmmod uniinputenginesudo rm /etc/modules-load.d/uniinputengine.confsudo rm /lib/modules/$(uname -r)/extra/uniinputengine.kosudo depmod -aThis project is licensed under the GNU General Public License v3.0