Samuel Nicholas (Enetheru) commented on issue #87 at Samuel Nicholas (Enetheru) / midi2input

Samuel Nicholas (Enetheru)
2023-03-12T01:50:29Z

Hey, Thanks for the interest.

I haven't looked at any of the code for a long time, but you mentioned following the instructions INSTALL.archlinux.md That file doesn't make any mention of the uinput udev rules needed to grant permission for read/write to the uinput device I'm assuming that you did that manually, there is a udev script to do that on startup have a look at: /res/udev/rules.d/99-m2i-uinput.rules

The print output you quoted is in /src/lua.cpp:219

which then calls uinput.keypress(...) /src/uinput.cpp:101

which then calls uinput.keydown(...) /src/uinput.cpp:106

which calls uinput directly "libevdev_uinput_write_event(uidev, EV_KEY, input_event_code, 1);"

the uidev is created at /src/uinput.cpp:83

int rc = libevdev_uinput_create_from_device(dev, fd, &uidev);
if (rc < 0){
//no point in continuing if we cannot create a virtual device.
spdlog::critical( FMT_STRING("Failed to create virtual input device: ({})"), strerror(-rc));
close(fd);
return true;
}

And if that errors then the application quits on start, so its a mystery.

I don't actually have a Linux machine to test with at the moment, so I cant check if it "works for me"^tm If I did have a Linux machine, I would be looking for a way to verify the uidev device exists. look for other examples of evdev input simulation and testing they work so I can narrow down on whether it's my app.

Something interesting with this piece of information you gave me: "[info] LUA: keypress: 1 (or 0x0031)".

My code doesn't say "(or keycode)", and you are using the XK_KEYCODE from the x11 header, as per the other examples. but since the move to evdev its now the keycodes in the input event codes from linux headers. Sorry for this confusion. https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h

Even so, you should be getting the letter N 0x31 = 49 = KEY_N

The Denon SC200 was the last controller I used, check that out for a more up to date config using the correct keycodes.

Still, it should be sending N, and you state that its not sending any keypresses. Please let me know.