### Install Interception Tools on Ubuntu Source: https://github.com/meicale/interception-tools/blob/master/README.md Install interception-tools on Ubuntu by adding a PPA and using apt. ```bash sudo add-apt-repository ppa:deafmute/interception sudo apt install interception-tools ``` -------------------------------- ### systemd Service: Enable and start udevmon Source: https://context7.com/meicale/interception-tools/llms.txt Commands to enable and start the udevmon service using systemd. After enabling, the service will start automatically on boot. Status and logs can be checked using the provided commands. ```bash # Enable and start sudo systemctl daemon-reload sudo systemctl enable --now udevmon # Check status / logs systemctl status udevmon journalctl -u udevmon -f ``` -------------------------------- ### udevmon YAML Configuration Examples Source: https://context7.com/meicale/interception-tools/llms.txt Examples of udevmon YAML configurations demonstrating device matching by LINK, EVENTS, and NAME. Includes a global SHELL setting. ```yaml # /etc/interception/udevmon.yaml # Apply caps2esc to a specific keyboard by device link - JOB: intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE DEVICE: LINK: /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd # Fallback: apply caps2esc to any keyboard that has both CapsLock and Escape # and whose device link ends with -event-kbd (excludes mice that report those keys) - JOB: intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE DEVICE: EVENTS: EV_KEY: [[KEY_CAPSLOCK, KEY_ESC]] # device must support BOTH keys LINK: .*-event-kbd # ECMAScript regex # Match by device name regex - JOB: intercept -g $DEVNODE | my-plugin | uinput -d $DEVNODE DEVICE: NAME: .*[Kk]eyboard.* # Match by any of several event codes (any one is sufficient) - JOB: intercept -g $DEVNODE | mouse-plugin | uinput -d $DEVNODE DEVICE: EVENTS: EV_KEY: [BTN_LEFT, BTN_TOUCH] # Use a custom shell (e.g. zsh) for all jobs in this document SHELL: [zsh, -c] --- - JOB: intercept -g $DEVNODE | my-plugin | uinput -d $DEVNODE DEVICE: LINK: .*-event-kbd ``` -------------------------------- ### Install Interception Tools on Void Linux Source: https://github.com/meicale/interception-tools/blob/master/README.md Install the interception-tools package using xbps-install on Void Linux. ```bash $ xbps-install -S interception-tools ``` -------------------------------- ### Install Build Dependencies on Ubuntu Source: https://github.com/meicale/interception-tools/blob/master/README.md Install the necessary build dependencies for Interception Tools on Ubuntu using apt. ```bash $ sudo apt install cmake libevdev-dev libudev-dev libyaml-cpp-dev libboost-dev ``` -------------------------------- ### Hybrid Device Configuration Example Source: https://github.com/meicale/interception-tools/blob/master/README.md Shows how to configure a hybrid virtual device by piping input through multiple devices and tools. Ensure the specified device paths are correct. ```bash sudo uinput -p -d /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse -d /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd | sudo tee /etc/interception/hybrid.yaml ``` -------------------------------- ### Mux Tool Input/Output Routing Example Source: https://github.com/meicale/interception-tools/blob/master/README.md Demonstrates how the 'mux' tool redirects input based on activity in different channels. Use this to understand complex routing scenarios. ```bash mux -i M | mux -o KM -i K -o KM -i X -o XM ``` -------------------------------- ### Mux Tool Combined Input/Output Example Source: https://github.com/meicale/interception-tools/blob/master/README.md Combines multiple inputs and outputs for flexible event routing. This configuration allows for complex event distribution scenarios. ```bash -i w -i x -o y -o z ``` -------------------------------- ### Install Interception Tools on Fedora Source: https://github.com/meicale/interception-tools/blob/master/README.md Install interception-tools on Fedora by enabling a COPR repository and using dnf. ```bash $ sudo dnf copr enable fszymanski/interception-tools $ sudo dnf install interception-tools ``` -------------------------------- ### Install Interception Tools on Archlinux Source: https://github.com/meicale/interception-tools/blob/master/README.md Install the interception-tools package using pacman on Archlinux. ```bash $ pacman -S interception-tools ``` -------------------------------- ### Build Interception Tools from Source Source: https://context7.com/meicale/interception-tools/llms.txt Installs build dependencies and compiles the interception-tools project using CMake. Installs binaries to /usr/local/bin. ```bash # Install build dependencies (Debian/Ubuntu) sudo apt install cmake libevdev-dev libudev-dev libyaml-cpp-dev libboost-dev # Clone and build git clone https://gitlab.com/interception/linux/tools.git interception-tools cd interception-tools cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build # Install binaries to /usr/local/bin sudo cmake --install build ``` -------------------------------- ### Mux Tool Multiple Input/Output Example Source: https://github.com/meicale/interception-tools/blob/master/README.md Demonstrates redirecting output to a single destination from multiple inputs. Useful for consolidating events from various sources. ```bash -i x -i y -i etc -o z ``` -------------------------------- ### YAML Configuration for Hybrid Device Setup Source: https://github.com/meicale/interception-tools/blob/master/README.md This configuration demonstrates how to set up hybrid devices by merging input streams and directing them to separate virtual output devices. It's useful for scenarios where a single physical device needs to be split into multiple logical devices, such as separating keyboard and touchpad inputs. ```yaml - CMD: mux -c caps2esc -c keyboard -c mouse - JOB: - mux -i caps2esc | caps2esc | mux -o keyboard -o mouse - mux -i keyboard | uinput -c /etc/interception/keyboard.yaml - mux -i mouse | uinput -c /etc/interception/mouse.yaml - JOB: intercept -g $DEVNODE | mux -o caps2esc DEVICE: NAME: AT Translated Set 2 keyboard - JOB: intercept -g $DEVNODE | mux -o caps2esc DEVICE: NAME: ETPS/2 Elantech Touchpad ``` -------------------------------- ### Install Interception Tools via Package Manager Source: https://context7.com/meicale/interception-tools/llms.txt Provides installation commands for various Linux distributions including Arch, Void, Ubuntu (PPA), and Fedora (COPR). ```bash # Arch Linux pacman -S interception-tools # Void Linux xbps-install -S interception-tools # Ubuntu (PPA) sudo add-apt-repository ppa:deafmute/interception sudo apt install interception-tools # Fedora (COPR) dnf copr enable fszymanski/interception-tools dnf install interception-tools ``` -------------------------------- ### Install Build Dependencies on Fedora Source: https://github.com/meicale/interception-tools/blob/master/README.md Install the necessary build dependencies for Interception Tools on Fedora using dnf. ```bash $ dnf install cmake libevdev-devel systemd-devel yaml-cpp-devel boost-devel ``` -------------------------------- ### Mux Tool Switch Mode Example 2 Source: https://github.com/meicale/interception-tools/blob/master/README.md Shows another scenario in 'mux' tool switch mode where input is only redirected after activity is detected in a specific input, due to the absence of a default output. ```bash mux -i e | mux -i i -o o ``` -------------------------------- ### Mux Tool Switch Mode Example 1 Source: https://github.com/meicale/interception-tools/blob/master/README.md Illustrates 'mux' tool behavior in switch mode where input is redirected by default but can change based on activity in another input. ```bash mux -i e | mux -o o -i i ``` -------------------------------- ### Mux Tool Multiple Output Example Source: https://github.com/meicale/interception-tools/blob/master/README.md Illustrates redirecting input to multiple destinations. Use this when events need to be processed by several different handlers. ```bash -i x -o y -o z -o etc ``` -------------------------------- ### mux switch mode: Route events based on activity Source: https://context7.com/meicale/interception-tools/llms.txt Demonstrates mux switch mode for routing events. The first example redirects 'source' to 'out' only after activity in 'trigger'. The second example redirects 'source' to 'out' by default, but to nowhere after 'stop' activity. The third example combines multiple switch triggers and outputs. ```bash # Switch: redirect 'source' to 'out' only after first activity in 'trigger' mux -i source | mux -i trigger -o out ``` ```bash # Switch: 'source' goes to 'out' by default, redirected to nowhere after 'stop' activity mux -i source | mux -o out -i stop ``` ```bash # Combine multiple switch triggers and multiple outputs mux -i source | mux -i trigger1 -i trigger2 -o out1 -o out2 ``` -------------------------------- ### Increase udevmon Priority Source: https://github.com/meicale/interception-tools/blob/master/README.md Example of increasing udevmon priority using 'nice' for critical input device handling. Redirects stdout and stderr to log files. ```bash $ sudo nice -n -20 udevmon -c udevmon.yaml >udevmon.log 2>udevmon.err & ``` -------------------------------- ### systemd Service: udevmon.service configuration Source: https://context7.com/meicale/interception-tools/llms.txt This is the systemd unit file for the udevmon service. It specifies dependencies, execution commands, and restart behavior. Ensure the ExecStart path matches your udevmon installation. ```ini # /usr/lib/systemd/system/udevmon.service (provided in the repo as udevmon.service) [Unit] Description=udevmon Wants=systemd-udev-settle.service After=systemd-udev-settle.service [Service] ExecStart=/usr/bin/nice -n -20 /usr/bin/udevmon -c /etc/interception/udevmon.yaml Restart=on-failure [Install] WantedBy=multi-user.target ``` -------------------------------- ### Device-Specific Job Fallbacks Source: https://github.com/meicale/interception-tools/blob/master/README.md Illustrates how to apply different configurations based on device properties. The first matching job is executed, allowing for specific overrides and general fallbacks. ```yaml - JOB: intercept -g $DEVNODE | caps2esc -m 2 | uinput -d $DEVNODE DEVICE: LINK: /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd - JOB: intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE DEVICE: EVENTS: EV_KEY: [[KEY_CAPSLOCK, KEY_ESC]] LINK: .*-event-kbd ``` -------------------------------- ### Print device description in YAML format Source: https://github.com/meicale/interception-tools/blob/master/README.md Use 'uinput -p' to print a device's characteristics in YAML format. This output can be used to configure virtual devices. ```text uinput -p -d /dev/input/by-id/my-kbd ``` -------------------------------- ### Build Interception Tools from Source Source: https://github.com/meicale/interception-tools/blob/master/README.md Clone the repository, navigate to the directory, and use CMake to configure and build the Interception Tools. ```bash $ git clone https://gitlab.com/interception/linux/tools.git interception-tools $ cd interception-tools $ cmake -B build -DCMAKE_BUILD_TYPE=Release $ cmake --build build ``` -------------------------------- ### OpenRC Init Script: udevmon init script Source: https://context7.com/meicale/interception-tools/llms.txt This is an OpenRC init script for managing the udevmon service on systems using OpenRC (e.g., Gentoo, Alpine). It provides commands to add the service to the default runlevel and start/stop/status it. ```bash # /etc/init.d/udevmon (provided in the repo as udevmon.init) # Start/stop on OpenRC systems (e.g. Gentoo, Alpine, Artix) rc-update add udevmon default rc-service udevmon start rc-service udevmon status ``` -------------------------------- ### Hybrid virtual devices: Split output into separate devices Source: https://context7.com/meicale/interception-tools/llms.txt This YAML configuration demonstrates how to split a hybrid virtual device output into separate keyboard and mouse virtual devices. This is a fallback if merging into a single hybrid device fails. ```yaml - CMD: mux -c stream -c keyboard -c mouse - JOB: - mux -i stream | caps2esc | mux -o keyboard -o mouse - mux -i keyboard | uinput -c /etc/interception/keyboard.yaml - mux -i mouse | uinput -c /etc/interception/mouse.yaml - JOB: intercept -g $DEVNODE | mux -o stream DEVICE: NAME: AT Translated Set 2 keyboard - JOB: intercept -g $DEVNODE | mux -o stream DEVICE: NAME: ETPS/2 Elantech Touchpad ``` -------------------------------- ### Monitor Input Devices with udevmon Source: https://github.com/meicale/interception-tools/blob/master/README.md Use udevmon to monitor input devices and launch tasks. Specify a configuration file using the -c option. ```text udevmon - monitor input devices for launching tasks usage: udevmon [-h | -c configuration.yaml] options: -h show this message and exit -c configuration.yaml use configuration.yaml as configuration /etc/interception/udevmon.d/*.yaml is also read if present ``` -------------------------------- ### Inject Events from stdin into a Virtual Device Source: https://context7.com/meicale/interception-tools/llms.txt The 'uinput' command creates a virtual kernel input device by cloning characteristics from real devices or YAML descriptions. It reads raw input_event records from stdin and replays them into the virtual device. Use '-p' to dump a device's YAML description. ```bash # Print usage uinput -h ``` ```bash # Clone a keyboard's capabilities and relay stdin events to virtual device uinput -d /dev/input/by-id/usb-My_Keyboard-event-kbd ``` ```bash # Use a saved YAML description instead of a live device uinput -c /etc/interception/my-keyboard.yaml ``` ```bash # Merge two real devices into a single hybrid virtual device (keyboard + mouse) uinput -d /dev/input/by-id/usb-My_Keyboard-event-kbd \ -d /dev/input/by-id/usb-Logitech_Receiver-if02-event-mouse ``` ```bash # Dump a device's YAML description to a file for later use sudo uinput -p -d /dev/input/by-id/usb-My_Keyboard-event-kbd \ | sudo tee /etc/interception/my-keyboard.yaml ``` ```yaml # Example YAML device description output by `uinput -p -d `: # NAME: USB-HID Gaming Keyboard # BUSTYPE: BUS_USB # VENDOR: 9610 # PRODUCT: 65 # EVENTS: # EV_SYN: [SYN_REPORT, SYN_CONFIG, SYN_DROPPED] # EV_KEY: [KEY_ESC, KEY_1, KEY_2, ..., KEY_CAPSLOCK, KEY_A, ...] # EV_MSC: [MSC_SCAN] # EV_LED: [LED_NUML, LED_CAPSL, LED_SCROLLL] # EV_REP: # REP_DELAY: 250 # REP_PERIOD: 33 ``` -------------------------------- ### udevmon configuration to match all specified events Source: https://github.com/meicale/interception-tools/blob/master/README.md udevmon configuration to launch a job only if a device produces ALL specified events. This is useful for more precise device matching. ```yaml - JOB: intercept -g $DEVNODE | magic | uinput -d $DEVNODE DEVICE: EVENTS: EV_KEY: [KEY_A, KEY_B, [KEY_X, KEY_Y]] ``` -------------------------------- ### udevmon YAML: Combine keyboard and mouse with muxer Source: https://context7.com/meicale/interception-tools/llms.txt This YAML configuration for udevmon sets up muxers and jobs for processing input devices. It demonstrates combining keyboard and mouse events and applying filters. ```yaml # /etc/interception/udevmon.yaml # Create all muxers first (CMD = sequential, waited at startup) - CMD: mux -c caps2esc # Standalone job: consume the muxer, apply filter, output to virtual hybrid device - JOB: mux -i caps2esc | caps2esc | uinput -c /etc/interception/gaming-keyboard.yaml # Device job: grab keyboard, feed into muxer - JOB: intercept -g $DEVNODE | mux -o caps2esc DEVICE: LINK: /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd # Device job: observe mouse (not grabbed), also feed into muxer # Mouse EV_KEY events (clicks) will reach caps2esc → Caps+Click = Ctrl+Click - JOB: intercept $DEVNODE | mux -o caps2esc DEVICE: LINK: /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse ``` -------------------------------- ### Read from 'kbd' muxer, process, send to virtual device Source: https://context7.com/meicale/interception-tools/llms.txt This command reads from the 'kbd' muxer, applies the 'caps2esc' filter, and outputs to a virtual uinput device. The configuration file '/etc/interception/keyboard.yaml' must exist and be correctly formatted. ```bash mux -i kbd | caps2esc | uinput -c /etc/interception/keyboard.yaml ``` -------------------------------- ### Run udevmon Manually and as a Systemd Service Source: https://context7.com/meicale/interception-tools/llms.txt Commands to run udevmon manually with high priority to minimize input latency, and instructions for enabling it as a systemd service for recommended usage. ```bash # Run manually (use high priority to avoid input latency) sudo nice -n -20 udevmon -c /etc/interception/udevmon.yaml >udevmon.log 2>&1 & # Enable as a systemd service (recommended) sudo systemctl enable --now udevmon ``` -------------------------------- ### udevmon YAML Device Selector Reference Source: https://context7.com/meicale/interception-tools/llms.txt Comprehensive reference for udevmon YAML device selectors, including LINK, NAME, PRODUCT, VENDOR, BUSTYPE, PROPERTIES, and EVENTS with detailed matching criteria. ```yaml # All fields are optional; unset fields match anything (regex ".*") # Regex grammar: Modified ECMAScript (std::regex) - JOB: intercept -g $DEVNODE | plugin | uinput -d $DEVNODE DEVICE: LINK: /dev/input/by-id/exact-link-or-regex NAME: ".*[Kk]eyboard.*" LOCATION: "usb-0000:00:14.0-1/input0" PRODUCT: "65" # decimal product ID VENDOR: "9610" # decimal vendor ID BUSTYPE: "3" # decimal bus type DRIVER_VERSION: ".*" PROPERTIES: - INPUT_PROP_POINTER # any of: device has this property - [INPUT_PROP_DIRECT, INPUT_PROP_BUTTONPAD] # set: device has all of these EVENTS: EV_KEY: [KEY_A, KEY_B, [KEY_X, KEY_Y]] # any of KEY_A, KEY_B, or (KEY_X AND KEY_Y) EV_REL: [] # empty list: device supports EV_REL (any relative axis) ``` -------------------------------- ### Redirect Input to Virtual Device with uinput Source: https://github.com/meicale/interception-tools/blob/master/README.md uinput redirects device input events from stdin to a virtual device. Use -c or -d to merge device descriptions. ```text uinput - redirect device input events from stdin to virtual device usage: uinput [-h | [-p] [-c device.yaml] [-d devnode]] options: -h show this message and exit -p show resulting YAML device description merge and exit -c device.yaml merge YAML device description to resulting virtual device (repeatable) -d devnode merge reference device description to resulting virtual device (repeatable) ``` -------------------------------- ### Basic Muxer and Job Configuration Source: https://github.com/meicale/interception-tools/blob/master/README.md Defines a muxer and a job that pipes input through caps2esc to a virtual device. Ensure device links are correct for your system. ```yaml - CMD: mux -c caps2esc - JOB: mux -i caps2esc | caps2esc | uinput -c /etc/interception/gaming-keyboard.yaml - JOB: intercept -g $DEVNODE | mux -o caps2esc DEVICE: LINK: /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd - JOB: intercept $DEVNODE | mux -o caps2esc DEVICE: LINK: /dev/input/by-id/usb-Logitech_USB_Receiver-if02-event-mouse ``` -------------------------------- ### udevmon configuration to match by device link Source: https://github.com/meicale/interception-tools/blob/master/README.md udevmon configuration to trigger a job based on a specific device link path. This provides a more direct way to target a particular hardware device. ```yaml - JOB: intercept -g $DEVNODE | caps2esc | uinput -d $DEVNODE DEVICE: LINK: /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd ``` -------------------------------- ### udevmon YAML: Complex multi-device routing with mux switch mode Source: https://context7.com/meicale/interception-tools/llms.txt This YAML configuration demonstrates advanced routing using mux switch mode. It routes events from multiple devices (keyboard, mouse) to different processing streams based on activity. ```yaml # Complex multi-device routing with per-device filter selection: # - K: generic keyboards → caps2esc (default filter) # - X: special keyboard → caps2esc -m 2 (alternate filter) # - M: mice → routed to whichever keyboard group is active # - H: final hybrid output virtual device - CMD: mux -c K -c X -c M -c KM -c XM -c H - JOB: # Switch: M events go to KM by default, but XM if there's activity in X - mux -i M | mux -o KM -i K -o KM -i X -o XM # Apply different filters per combined stream - mux -i KM | caps2esc | mux -o H - mux -i XM | caps2esc -m 2 | mux -o H # Final output to hybrid virtual device - mux -i H | uinput -c /etc/interception/hybrid.yaml - JOB: intercept -g $DEVNODE | mux -o X -o XM DEVICE: LINK: /dev/input/by-id/SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd - JOB: intercept -g $DEVNODE | mux -o M DEVICE: EVENTS: EV_KEY: [BTN_LEFT, BTN_TOUCH] - JOB: intercept -g $DEVNODE | mux -o K -o KM DEVICE: EVENTS: EV_KEY: [[KEY_CAPSLOCK, KEY_ESC]] NAME: .*[Kk]eyboard.* LINK: .*-event-kbd ``` -------------------------------- ### Mux: Create Named Muxers Source: https://context7.com/meicale/interception-tools/llms.txt Command to create named POSIX message queue muxers for inter-pipeline communication. These should be run at udevmon startup via the CMD directive. ```bash # Step 1: Create named muxers (run at udevmon startup via CMD) mux -c kbd -c mouse -c combined ``` -------------------------------- ### Write keyboard events into 'kbd' muxer Source: https://context7.com/meicale/interception-tools/llms.txt This command pipes keyboard events from a specific device into a muxer named 'kbd'. Ensure the device path is correct for your system. ```bash intercept -g /dev/input/by-id/usb-My_Keyboard-event-kbd | mux -o kbd ``` -------------------------------- ### Device links in standalone jobs: Save device YAML Source: https://context7.com/meicale/interception-tools/llms.txt This command manually saves the YAML description of a device. This is useful for standalone jobs where device symlinks might not be available at boot time. Run this command after boot when the device link is present. ```bash # Save device YAML once (run manually after boot when link is available) sudo uinput -p -d /dev/input/by-id/usb-My_Keyboard-event-kbd \ | sudo tee /etc/interception/my-keyboard.yaml ``` -------------------------------- ### Merge multiple device descriptions and YAML config Source: https://github.com/meicale/interception-tools/blob/master/README.md Merge characteristics from multiple devices and a YAML configuration file into a single YAML output. Non-list characteristics are overridden by later inputs. ```text uinput -p -d /dev/input/by-id/my-kbd -d /dev/input/by-id/my-mouse -c my-extra.yaml ``` -------------------------------- ### udevmon configuration to intercept and transform input Source: https://github.com/meicale/interception-tools/blob/master/README.md udevmon configuration to automatically run a command pipeline when a device matching specific event criteria is attached. The $DEVNODE environment variable provides the device path. ```yaml - JOB: intercept -g $DEVNODE | y2z | x2y | uinput -d $DEVNODE DEVICE: EVENTS: EV_KEY: [KEY_X, KEY_Y] ``` -------------------------------- ### Complex Muxing for Keyboard and Mouse Input Source: https://github.com/meicale/interception-tools/blob/master/README.md An advanced configuration demonstrating how to combine and filter input from multiple keyboards and mice using several muxers and conditional filtering. ```yaml - CMD: mux -c K -c X -c M -c KM -c XM -c H - JOB: - mux -i M | mux -o KM -i K -o KM -i X -o XM - mux -i KM | caps2esc | mux -o H - mux -i XM | caps2esc -m 2 | mux -o H - mux -i H | uinput -c /etc/interception/hybrid.yaml - JOB: intercept -g $DEVNODE | mux -o X -o XM DEVICE: LINK: /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard_SN0000000001-event-kbd - JOB: intercept -g $DEVNODE | mux -o M DEVICE: EVENTS: EV_KEY: [BTN_LEFT, BTN_TOUCH] - JOB: intercept -g $DEVNODE | mux -o K -o KM DEVICE: EVENTS: EV_KEY: [[KEY_CAPSLOCK, KEY_ESC]] NAME: .*[Kk]eyboard.* LINK: .*-event-kbd ``` -------------------------------- ### Process priority: Manual invocation with high priority Source: https://context7.com/meicale/interception-tools/llms.txt This command manually invokes udevmon with a high process priority using `nice -n -20`. Running with high priority is crucial to prevent input event lag or drops. ```bash sudo nice -n -20 udevmon -c /etc/interception/udevmon.yaml ``` -------------------------------- ### C program to swap KEY_X and KEY_Y events Source: https://github.com/meicale/interception-tools/blob/master/README.md This C program reads input events from stdin, swaps KEY_X to KEY_Y if detected, and writes the modified events to stdout. It's useful for in-between processing in an input interception pipeline. Ensure stdin and stdout are unbuffered. ```c #include #include #include int main(void) { setbuf(stdin, NULL), setbuf(stdout, NULL); struct input_event event; while (fread(&event, sizeof(event), 1, stdin) == 1) { if (event.type == EV_KEY && event.code == KEY_X) event.code = KEY_Y; fwrite(&event, sizeof(event), 1, stdout); } } ``` -------------------------------- ### Redirect Device Input Events with intercept Source: https://github.com/meicale/interception-tools/blob/master/README.md The intercept utility redirects device input events to stdout. Use the -g option to grab the device. ```text intercept - redirect device input events to stdout usage: intercept [-h | [-g] devnode] options: -h show this message and exit -g grab device devnode path of device to capture events from ``` -------------------------------- ### Interception Tools YAML Configuration Structure Source: https://github.com/meicale/interception-tools/blob/master/README.md Provides the basic structure for the YAML configuration file used by interception-tools. Customize 'SHELL', 'CMD', 'JOB', 'DEVICE', and 'EVENTS' based on your needs. ```yaml SHELL: LA --- - CMD: S | LS - JOB: S | LS DEVICE: LINK: R NAME: R LOCATION: R PRODUCT: R VENDOR: R BUSTYPE: R DRIVER_VERSION: R PROPERTIES: LP EVENTS: EV_KEY: LE EV_REL: LE ... ``` -------------------------------- ### C/C++ Plugin for Input Event Filtering Source: https://context7.com/meicale/interception-tools/llms.txt This C program reads input events from stdin, modifies them (swapping KEY_X and KEY_Y), and writes them to stdout. Ensure buffering is disabled for immediate event flow. It serves as a template for creating custom input filtering plugins. ```c /* x2y.c — swap KEY_X and KEY_Y on any keyboard */ #include #include #include int main(void) { /* Disable buffering so events flow through immediately */ setbuf(stdin, NULL); setbuf(stdout, NULL); struct input_event event; while (fread(&event, sizeof(event), 1, stdin) == 1) { if (event.type == EV_KEY && event.code == KEY_X) event.code = KEY_Y; else if (event.type == EV_KEY && event.code == KEY_Y) event.code = KEY_X; if (fwrite(&event, sizeof(event), 1, stdout) != 1) return EXIT_FAILURE; } return EXIT_SUCCESS; } /* * Build: gcc -o x2y x2y.c * * Use: * DEVNODE=/dev/input/by-id/usb-My_Keyboard-event-kbd * sudo intercept -g $DEVNODE | ./x2y | uinput -d $DEVNODE * * Compose multiple plugins — order matters: * sudo intercept -g $DEVNODE | ./x2y | ./y2z | uinput -d $DEVNODE * * Plugin guideline: when synthesizing event sequences (not just remapping), * always emit EV_SYN (SYN_REPORT) events with distinct timestamps between * key events to ensure applications handle them correctly: * * struct input_event syn = { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }; * clock_gettime(CLOCK_MONOTONIC, &ts); * syn.time.tv_sec = ts.tv_sec; * syn.time.tv_usec = ts.tv_nsec / 1000; * fwrite(&syn, sizeof(syn), 1, stdout); */ ``` -------------------------------- ### Mux Streams of Input Events Source: https://github.com/meicale/interception-tools/blob/master/README.md The mux utility multiplexes streams of input events. Configure queue size with -s and specify input/output muxers with -i and -o. ```text mux - mux streams of input events usage: mux [-h | [-s size] -c name | [-i name] [-o name]] options: -h show this message and exit -s size muxer's queue size (default: 100) -c name name of muxer to create (repeatable) -i name name of muxer to read input from or switch on (repeatable in switch mode) -o name name of muxer to write output to (repeatable) ``` -------------------------------- ### Intercept Device Events to stdout Source: https://context7.com/meicale/interception-tools/llms.txt The 'intercept' command streams raw input_event records from a specified evdev device to stdout. It can optionally grab the device for exclusive access. Useful for observing or piping events into other tools. ```bash # Print usage intercept -h ``` ```bash # Stream events from a keyboard to stdout (non-exclusive, for observation) intercept /dev/input/by-id/usb-My_Keyboard-event-kbd | evtest --grab /dev/stdin ``` ```bash # Grab device exclusively (other consumers see no events) and pipe to uinput DEVNODE=/dev/input/by-id/usb-My_Keyboard-event-kbd intercept -g $DEVNODE | uinput -d $DEVNODE ``` ```bash # Identity pipeline: grab keyboard, pass events unmodified to a virtual clone # The virtual device substitutes the physical one completely sudo intercept -g /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard-event-kbd \ | uinput -d /dev/input/by-id/usb-SEMITEK_USB-HID_Gaming_Keyboard-event-kbd ``` -------------------------------- ### mux duplication: Duplicate output to two muxers Source: https://context7.com/meicale/interception-tools/llms.txt This command duplicates the output of an intercepted device to two separate muxers simultaneously. This is useful for sending the same input stream to multiple processing pipelines. ```bash intercept $DEVNODE | mux -o muxer1 -o muxer2 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.