gpiolib: GPIO_GET_LINEHANDLE_IOCTL and GPIO_GET_LINEEVENT_IOCTL at the same time

From: dimitry
Date: Tue Aug 28 2018 - 09:33:18 EST


It seems gpiolib only allows user to request either the line handle descriptor or the line event descriptor, but not both at the same time.

gpiohandle_request hr;
gpioevent_request er;
...
ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &hr); // so far so good
ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, &er); // resource busy

I have a situation where I am trying to have 1 thread monitor an open drain/source line for events, while another thread writes to it. Not entirely unlike i2c pulse stretching. Is this not possible with the current gpiolib design? Or am I doing something wrong? If not possible, is my only choice to run an endless loop checking for line state?

NB: I am not subscribed to the list. Please CC me directly in your replies.

Thank you,
Dimitry