[lkml]   [2019]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] gpiolib: fix incorrect IRQ requesting of an active-low lineevent
pt., 5 lip 2019 o 12:35 <> napisał(a):
> Hi Bartosz,
> For example, there is a button which drives level to be low when it is pushed, and drivers level to be high when it is released.
> We want to catch the event when the button is pushed.
> In user space we configure a line event with the following code:
> req.handleflags = GPIOHANDLE_REQUEST_INPUT;
> and we hope to get "falling" events by reading the device node:
> while (1) {
> read(fd, &dat,sizeof(dat));
> if ( == 0) {
> printf("button pushed\n");
> }
> }
> Run the same logic on another board which the polarity of the button is inverted. The button drives level to be high when it is pushed.
> For the inverted level case, we have to add flag GPIOHANDLE_REQUEST_ACTIVE_LOW:
> At the result, there are no any events been caught when the button is pushed.
> By the way, button releasing will emit a "falling" event.
> Sincerely,
> Michael Wu

First: please don't top-post on the mailing list.

Second: have you even built the version you sent? Because I'm getting this:

drivers/gpio/gpiolib.c: In function ‘lineevent_create’:
drivers/gpio/gpiolib.c:963:4: error: ‘IRQ_TRIGGER_RISING’ undeclared
(first use in this function)

And third: after fixing the define, this indeed looks like a bug and
I'll need to add a test for that to libgpiod once it's upstream.
Strange we didn't catch it before.

Please send a fixed version and add a Cc tag for stable. Nice catch!

Best regards
Bartosz Golaszewski

 \ /
  Last update: 2019-07-05 14:51    [W:2.296 / U:3.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site