How to get intercept-tools to work

From razwiki
Jump to navigation Jump to search

If you have udevmon.service running, stop it using `sudo systemctl stop udevmon.service`

hack $ cat x2y.c
#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>

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);
    }
}
gcc x2y.c -o x2y
export DEVNODE=/dev/input/by-path/platform-i8042-serio-0-event-kbd
sudo intercept -g $DEVNODE | x2y | sudo uinput -d $DEVNODE