libsuinput icon indicating copy to clipboard operation
libsuinput copied to clipboard

Block until ready for writing

Open multimeric opened this issue 5 years ago • 0 comments

Further to discussion here: https://github.com/tuomasjjrasanen/python-uinput/issues/6#issuecomment-249155296, we have noticed that attempting to use suinput_create, and then immediately suinput_emit will not work, likely because suinput_create isn't blocking until it's ready. It returns immediately.

Might this be because we're opening the uinput device with O_NONBLOCK? Alternatively, I notice in the uinput kernel examples, they also use a sleep(1), but say that "This pause is only needed in our example code". Any idea how we can have libsuinput do this for us?

/* * On UI_DEV_CREATE the kernel will create the device node for this * device. We are inserting a pause here so that userspace has time * to detect, initialize the new device, and can start listening to * the event, otherwise it will not notice the event we are about * to send. This pause is only needed in our example code! */

multimeric avatar Sep 22 '19 15:09 multimeric