RaspberrPi project source code
guowenxue
20 hours ago e1c45b607ef7c6cddebe93d96e8f6e0cd4987da6
project/lightd/hal/gpio.c
@@ -21,13 +21,6 @@
#include "gpio.h"
#define RPI_GPIONAME        "gpiochip0"
#include <errno.h>
#include "logger.h"
#include "util_proc.h"
#include "gpio.h"
#define RPI_GPIONAME        "gpiochip0"
static struct gpiod_chip    *s_chip;
static gpio_t               *s_gpio = NULL;
@@ -93,7 +86,7 @@
            goto failed;
        }
        if( gpio->output[i].active_level )
        if( gpio->input[i].active_level )
            rv = gpiod_line_request_rising_edge_events(gpio->input[i].line, gpio->input[i].name) ;
        else
            rv = gpiod_line_request_falling_edge_events(gpio->input[i].line, gpio->input[i].name) ;
@@ -101,14 +94,14 @@
        if( rv < 0 )
        {
            log_error("gpiod request '%s' pin[#%d] event edge [%s] failure: %s\n",
                    gpio->input[i].name, gpio->input[i].pin, gpio->output[i].active_level?"rising":"falling", strerror(errno));
                    gpio->input[i].name, gpio->input[i].pin, gpio->input[i].active_level?"rising":"falling", strerror(errno));
            rv = -4;
            goto failed;
        }
        else
        {
            log_info("gpiod request '%s' pin[#%d] event edge [%s] ok\n",
                    gpio->input[i].name, gpio->input[i].pin, gpio->output[i].active_level?"rising":"falling");
                    gpio->input[i].name, gpio->input[i].pin, gpio->input[i].active_level?"rising":"falling");
        }
    }