Skip to content
Advertisement

linux uinput: simple example?

I’m having some problems getting both sides of code using uinput working.

Based on Getting started with uinput: the user level input subsystem[dead link; archived] I put together the following writer (minus error handling):

JavaScript

That seems to work, at least the full input_event structure seems to be written.

I then wrote the most naive reader of events I could come up with:

JavaScript

Unfortunately the reader side doesn’t work at all; only manages to read 8 bytes each time, which isn’t nearly a full input_event structure.

What silly mistake am I making?

Advertisement

Answer

You should also be writing a sync event after the actual event. In your writer side code:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement