libsuinput
libsuinput copied to clipboard
Block until ready for writing
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! */