Re: Need help with libgpiod gpiod_line_request_both_edges_events()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gpiod_line_event_wait only blocks until there's an event or a timeout
occurs, it does not read the event. To do that, you need to call
gpiod_line_event_read.

Something like this should work:

/* Flush all pending events */
timeout.tv_sec = 1;
struct gpiod_line_event evt;
do {
    printf("Flushing ...\n");
    ret = gpiod_line_event_wait(input, &timeout);
    if (ret < 0) {
        printf("Error: could not flush pending events (errno=%i)\n",
errno);
        return ret;
    } else if (ret == 1) {
        gpiod_line_event_read(input, &evt);
    }
} while (ret == 1);


kind regards,

Gasper


On 06. 03. 2018 22:41, Timur Tabi wrote:
> /* Flush all pending events */
> timeout.tv_sec = 1;
> do {
>     printf("Flushing ...\n");
>     ret = gpiod_line_event_wait(input, &timeout);
>     if (ret < 0) {
>         printf("Error: could not flush pending events (errno=%i)\n",
> errno);
>         return ret;
>     }
> } while (ret == 1); 

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux