gpiod

This is the original gpio.h file processed by dstep

Members

Aliases

gpiod_ctxless_event_handle_cb
alias gpiod_ctxless_event_handle_cb = int function(int, uint, const(timespec)*, void*)

@brief Simple event callback signature.

gpiod_ctxless_event_poll_cb
alias gpiod_ctxless_event_poll_cb = int function(uint, gpiod_ctxless_event_poll_fd*, const(timespec)*, void*)

@brief Simple event poll callback signature.

gpiod_ctxless_set_value_cb
alias gpiod_ctxless_set_value_cb = void function(void*)

@brief Simple set value callback signature.

Enums

GPIOD_CTXLESS_EVENT_CB_RET_ERR
anonymousenum GPIOD_CTXLESS_EVENT_CB_RET_ERR

@brief Return status values that the ctxless event callback can return.

GPIOD_CTXLESS_EVENT_CB_TIMEOUT
anonymousenum GPIOD_CTXLESS_EVENT_CB_TIMEOUT

@brief Event types that can be passed to the ctxless event callback.

GPIOD_CTXLESS_EVENT_POLL_RET_STOP
anonymousenum GPIOD_CTXLESS_EVENT_POLL_RET_STOP

@brief Return status values that the ctxless event poll callback can return.

GPIOD_CTXLESS_EVENT_RISING_EDGE
anonymousenum GPIOD_CTXLESS_EVENT_RISING_EDGE

@brief Event types that the ctxless event monitor can wait for.

GPIOD_CTXLESS_FLAG_OPEN_DRAIN
anonymousenum GPIOD_CTXLESS_FLAG_OPEN_DRAIN

@brief Miscellaneous GPIO flags.

GPIOD_LINE_ACTIVE_STATE_HIGH
anonymousenum GPIOD_LINE_ACTIVE_STATE_HIGH

@brief Possible active state settings.

GPIOD_LINE_BIAS_AS_IS
anonymousenum GPIOD_LINE_BIAS_AS_IS

@brief Possible internal bias settings.

GPIOD_LINE_DIRECTION_INPUT
anonymousenum GPIOD_LINE_DIRECTION_INPUT

@brief Possible direction settings.

GPIOD_LINE_EVENT_RISING_EDGE
anonymousenum GPIOD_LINE_EVENT_RISING_EDGE

@brief Event types.

GPIOD_LINE_REQUEST_DIRECTION_AS_IS
anonymousenum GPIOD_LINE_REQUEST_DIRECTION_AS_IS

@brief Available types of requests.

GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN
anonymousenum GPIOD_LINE_REQUEST_FLAG_OPEN_DRAIN

@brief Miscellaneous GPIO request flags.

Functions

GPIOD_BIT
auto GPIOD_BIT(T nr)

@brief Shift 1 by given offset. @param nr Bit position. @return 1 shifted by nr.

gpiod_chip_close
void gpiod_chip_close(gpiod_chip* chip)

@brief Close a GPIO chip handle and release all allocated resources. @param chip The GPIO chip object.

gpiod_chip_find_line
gpiod_line* gpiod_chip_find_line(gpiod_chip* chip, const(char)* name)

@brief Find a GPIO line by name among lines associated with given GPIO chip. @param chip The GPIO chip object. @param name The name of the GPIO line. @return Pointer to the GPIO line handle or NULL if the line could not be found or an error occurred. @note In case a line with given name is not associated with given chip, the function sets errno to ENOENT.

gpiod_chip_find_lines
int gpiod_chip_find_lines(gpiod_chip* chip, const(char*)* names, gpiod_line_bulk* bulk)

@brief Find a set of GPIO lines by names among lines exposed by this chip. @param chip The GPIO chip object. @param names Array of pointers to C-strings containing the names of the lines to lookup. Must end with a NULL-pointer. @param bulk Line bulk object in which the located lines will be stored. @return 0 if all lines were located, -1 on error. @note If at least one line from the list could not be found among the lines exposed by this chip, the function sets errno to ENOENT.

gpiod_chip_get_all_lines
int gpiod_chip_get_all_lines(gpiod_chip* chip, gpiod_line_bulk* bulk)

@brief Retrieve all lines exposed by a chip and store them in a bulk object. @param chip The GPIO chip object. @param bulk Line bulk object in which to store the line handles. @return 0 on success, -1 on error.

gpiod_chip_get_line
gpiod_line* gpiod_chip_get_line(gpiod_chip* chip, uint offset)

@brief Get the handle to the GPIO line at given offset. @param chip The GPIO chip object. @param offset The offset of the GPIO line. @return Pointer to the GPIO line handle or NULL if an error occured.

gpiod_chip_get_lines
int gpiod_chip_get_lines(gpiod_chip* chip, uint* offsets, uint num_offsets, gpiod_line_bulk* bulk)

@brief Retrieve a set of lines and store them in a line bulk object. @param chip The GPIO chip object. @param offsets Array of offsets of lines to retrieve. @param num_offsets Number of lines to retrieve. @param bulk Line bulk object in which to store the line handles. @return 0 on success, -1 on error.

gpiod_chip_iter_free
void gpiod_chip_iter_free(gpiod_chip_iter* iter)

@brief Release all resources allocated for the gpiochip iterator and close the most recently opened gpiochip (if any). @param iter The gpiochip iterator object.

gpiod_chip_iter_free_noclose
void gpiod_chip_iter_free_noclose(gpiod_chip_iter* iter)

@brief Release all resources allocated for the gpiochip iterator but don't close the most recently opened gpiochip (if any). @param iter The gpiochip iterator object.

gpiod_chip_iter_new
gpiod_chip_iter* gpiod_chip_iter_new()

@brief Create a new gpiochip iterator. @return Pointer to a new chip iterator object or NULL if an error occurred.

gpiod_chip_iter_next
gpiod_chip* gpiod_chip_iter_next(gpiod_chip_iter* iter)

@brief Get the next gpiochip handle. @param iter The gpiochip iterator object. @return Pointer to the next open gpiochip handle or NULL if no more chips are present in the system. @note The previous chip handle will be closed using ::gpiod_chip_iter_free.

gpiod_chip_iter_next_noclose
gpiod_chip* gpiod_chip_iter_next_noclose(gpiod_chip_iter* iter)

@brief Get the next gpiochip handle without closing the previous one. @param iter The gpiochip iterator object. @return Pointer to the next open gpiochip handle or NULL if no more chips are present in the system. @note This function works just like ::gpiod_chip_iter_next but doesn't close the most recently opened chip handle.

gpiod_chip_label
const(char)* gpiod_chip_label(gpiod_chip* chip)

@brief Get the GPIO chip label as represented in the kernel. @param chip The GPIO chip object. @return Pointer to a human-readable string containing the chip label.

gpiod_chip_name
const(char)* gpiod_chip_name(gpiod_chip* chip)

@brief Get the GPIO chip name as represented in the kernel. @param chip The GPIO chip object. @return Pointer to a human-readable string containing the chip name.

gpiod_chip_num_lines
uint gpiod_chip_num_lines(gpiod_chip* chip)

@brief Get the number of GPIO lines exposed by this chip. @param chip The GPIO chip object. @return Number of GPIO lines.

gpiod_chip_open
gpiod_chip* gpiod_chip_open(const(char)* path)

@brief Open a gpiochip by path. @param path Path to the gpiochip device file. @return GPIO chip handle or NULL if an error occurred.

gpiod_chip_open_by_label
gpiod_chip* gpiod_chip_open_by_label(const(char)* label)

@brief Open a gpiochip by label. @param label Label of the gpiochip to open. @return GPIO chip handle or NULL if the chip with given label was not found or an error occured. @note If the chip cannot be found but no other error occurred, errno is set to ENOENT.

gpiod_chip_open_by_name
gpiod_chip* gpiod_chip_open_by_name(const(char)* name)

@brief Open a gpiochip by name. @param name Name of the gpiochip to open. @return GPIO chip handle or NULL if an error occurred.

gpiod_chip_open_by_number
gpiod_chip* gpiod_chip_open_by_number(uint num)

@brief Open a gpiochip by number. @param num Number of the gpiochip. @return GPIO chip handle or NULL if an error occurred.

gpiod_chip_open_lookup
gpiod_chip* gpiod_chip_open_lookup(const(char)* descr)

@brief Open a gpiochip based on the best guess what the path is. @param descr String describing the gpiochip. @return GPIO chip handle or NULL if an error occurred.

gpiod_ctxless_event_loop
int gpiod_ctxless_event_loop(const(char)* device, uint offset, bool active_low, const(char)* consumer, const(timespec)* timeout, gpiod_ctxless_event_poll_cb poll_cb, gpiod_ctxless_event_handle_cb event_cb, void* data)

@brief Wait for events on a single GPIO line. @param device Name, path, number or label of the gpiochip. @param offset GPIO line offset to monitor. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param timeout Maximum wait time for each iteration. @param poll_cb Callback function to call when waiting for events. @param event_cb Callback function to call for each line event. @param data User data passed to the callback. @return 0 if no errors were encountered, -1 if an error occurred. @note The way the ctxless event loop works is described in detail in ::gpiod_ctxless_event_loop_multiple - this is just a wrapper aound this routine which calls it for a single GPIO line.

gpiod_ctxless_event_loop_multiple
int gpiod_ctxless_event_loop_multiple(const(char)* device, const(uint)* offsets, uint num_lines, bool active_low, const(char)* consumer, const(timespec)* timeout, gpiod_ctxless_event_poll_cb poll_cb, gpiod_ctxless_event_handle_cb event_cb, void* data)

@brief Wait for events on multiple GPIO lines. @param device Name, path, number or label of the gpiochip. @param offsets Array of GPIO line offsets to monitor. @param num_lines Number of lines to monitor. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param timeout Maximum wait time for each iteration. @param poll_cb Callback function to call when waiting for events. Can be NULL. @param event_cb Callback function to call on event occurrence. @param data User data passed to the callback. @return 0 no errors were encountered, -1 if an error occurred. @note The poll callback can be NULL in which case the routine will fall back to a basic, ppoll() based callback.

gpiod_ctxless_event_monitor
int gpiod_ctxless_event_monitor(const(char)* device, int event_type, uint offset, bool active_low, const(char)* consumer, const(timespec)* timeout, gpiod_ctxless_event_poll_cb poll_cb, gpiod_ctxless_event_handle_cb event_cb, void* data)

@brief Wait for events on a single GPIO line. @param device Name, path, number or label of the gpiochip. @param event_type Type of events to listen for. @param offset GPIO line offset to monitor. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param timeout Maximum wait time for each iteration. @param poll_cb Callback function to call when waiting for events. @param event_cb Callback function to call for each line event. @param data User data passed to the callback. @return 0 if no errors were encountered, -1 if an error occurred. @note The way the ctxless event loop works is described in detail in ::gpiod_ctxless_event_monitor_multiple - this is just a wrapper aound this routine which calls it for a single GPIO line.

gpiod_ctxless_event_monitor_ext
int gpiod_ctxless_event_monitor_ext(const(char)* device, int event_type, uint offset, bool active_low, const(char)* consumer, const(timespec)* timeout, gpiod_ctxless_event_poll_cb poll_cb, gpiod_ctxless_event_handle_cb event_cb, void* data, int flags)

@brief Wait for events on a single GPIO line. @param device Name, path, number or label of the gpiochip. @param event_type Type of events to listen for. @param offset GPIO line offset to monitor. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param timeout Maximum wait time for each iteration. @param poll_cb Callback function to call when waiting for events. @param event_cb Callback function to call for each line event. @param data User data passed to the callback. @param flags The flags for the line. @return 0 if no errors were encountered, -1 if an error occurred. @note The way the ctxless event loop works is described in detail in ::gpiod_ctxless_event_monitor_multiple - this is just a wrapper aound this routine which calls it for a single GPIO line.

gpiod_ctxless_event_monitor_multiple
int gpiod_ctxless_event_monitor_multiple(const(char)* device, int event_type, const(uint)* offsets, uint num_lines, bool active_low, const(char)* consumer, const(timespec)* timeout, gpiod_ctxless_event_poll_cb poll_cb, gpiod_ctxless_event_handle_cb event_cb, void* data)

@brief Wait for events on multiple GPIO lines. @param device Name, path, number or label of the gpiochip. @param event_type Type of events to listen for. @param offsets Array of GPIO line offsets to monitor. @param num_lines Number of lines to monitor. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param timeout Maximum wait time for each iteration. @param poll_cb Callback function to call when waiting for events. Can be NULL. @param event_cb Callback function to call on event occurrence. @param data User data passed to the callback. @return 0 no errors were encountered, -1 if an error occurred. @note The poll callback can be NULL in which case the routine will fall back to a basic, ppoll() based callback.

gpiod_ctxless_event_monitor_multiple_ext
int gpiod_ctxless_event_monitor_multiple_ext(const(char)* device, int event_type, const(uint)* offsets, uint num_lines, bool active_low, const(char)* consumer, const(timespec)* timeout, gpiod_ctxless_event_poll_cb poll_cb, gpiod_ctxless_event_handle_cb event_cb, void* data, int flags)

@brief Wait for events on multiple GPIO lines. @param device Name, path, number or label of the gpiochip. @param event_type Type of events to listen for. @param offsets Array of GPIO line offsets to monitor. @param num_lines Number of lines to monitor. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param timeout Maximum wait time for each iteration. @param poll_cb Callback function to call when waiting for events. Can be NULL. @param event_cb Callback function to call on event occurrence. @param data User data passed to the callback. @param flags The flags for the lines. @return 0 no errors were encountered, -1 if an error occurred. @note The poll callback can be NULL in which case the routine will fall back to a basic, ppoll() based callback.

gpiod_ctxless_find_line
int gpiod_ctxless_find_line(const(char)* name, char* chipname, size_t chipname_size, uint* offset)

@brief Determine the chip name and line offset of a line with given name. @param name The name of the GPIO line to lookup. @param chipname Buffer in which the name of the GPIO chip will be stored. @param chipname_size Size of the chip name buffer. @param offset Pointer to an integer in which the line offset will be stored. @return -1 on error, 0 if the line with given name doesn't exist and 1 if the line was found. In the first two cases the contents of chipname and offset remain unchanged. @note The chip name is truncated if the buffer can't hold its entire size.

gpiod_ctxless_get_value
int gpiod_ctxless_get_value(const(char)* device, uint offset, bool active_low, const(char)* consumer)

@brief Read current value from a single GPIO line. @param device Name, path, number or label of the gpiochip. @param offset Offset of the GPIO line. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @return 0 or 1 (GPIO value) if the operation succeeds, -1 on error.

gpiod_ctxless_get_value_ext
int gpiod_ctxless_get_value_ext(const(char)* device, uint offset, bool active_low, const(char)* consumer, int flags)

@brief Read current value from a single GPIO line. @param device Name, path, number or label of the gpiochip. @param offset Offset of the GPIO line. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param flags The flags for the line. @return 0 or 1 (GPIO value) if the operation succeeds, -1 on error.

gpiod_ctxless_get_value_multiple
int gpiod_ctxless_get_value_multiple(const(char)* device, const(uint)* offsets, int* values, uint num_lines, bool active_low, const(char)* consumer)

@brief Read current values from a set of GPIO lines. @param device Name, path, number or label of the gpiochip. @param offsets Array of offsets of lines whose values should be read. @param values Buffer in which the values will be stored. @param num_lines Number of lines, must be > 0. @param active_low The active state of the lines - true if low. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on error.

gpiod_ctxless_get_value_multiple_ext
int gpiod_ctxless_get_value_multiple_ext(const(char)* device, const(uint)* offsets, int* values, uint num_lines, bool active_low, const(char)* consumer, int flags)

@brief Read current values from a set of GPIO lines. @param device Name, path, number or label of the gpiochip. @param offsets Array of offsets of lines whose values should be read. @param values Buffer in which the values will be stored. @param num_lines Number of lines, must be > 0. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param flags The flags for the lines. @return 0 if the operation succeeds, -1 on error.

gpiod_ctxless_set_value
int gpiod_ctxless_set_value(const(char)* device, uint offset, int value, bool active_low, const(char)* consumer, gpiod_ctxless_set_value_cb cb, void* data)

@brief Set value of a single GPIO line. @param device Name, path, number or label of the gpiochip. @param offset The offset of the GPIO line. @param value New value (0 or 1). @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param cb Optional callback function that will be called right after setting the value. Users can use this, for example, to pause the execution after toggling a GPIO. @param data Optional user data that will be passed to the callback function. @return 0 if the operation succeeds, -1 on error.

gpiod_ctxless_set_value_ext
int gpiod_ctxless_set_value_ext(const(char)* device, uint offset, int value, bool active_low, const(char)* consumer, gpiod_ctxless_set_value_cb cb, void* data, int flags)

@brief Set value of a single GPIO line. @param device Name, path, number or label of the gpiochip. @param offset The offset of the GPIO line. @param value New value (0 or 1). @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param cb Optional callback function that will be called right after setting the value. Users can use this, for example, to pause the execution after toggling a GPIO. @param data Optional user data that will be passed to the callback function. @param flags The flags for the line. @return 0 if the operation succeeds, -1 on error.

gpiod_ctxless_set_value_multiple
int gpiod_ctxless_set_value_multiple(const(char)* device, const(uint)* offsets, const(int)* values, uint num_lines, bool active_low, const(char)* consumer, gpiod_ctxless_set_value_cb cb, void* data)

@brief Set values of multiple GPIO lines. @param device Name, path, number or label of the gpiochip. @param offsets Array of offsets of lines the values of which should be set. @param values Array of integers containing new values. @param num_lines Number of lines, must be > 0. @param active_low The active state of the lines - true if low. @param consumer Name of the consumer. @param cb Optional callback function that will be called right after setting all values. Works the same as in ::gpiod_ctxless_set_value. @param data Optional user data that will be passed to the callback function. @return 0 if the operation succeeds, -1 on error.

gpiod_ctxless_set_value_multiple_ext
int gpiod_ctxless_set_value_multiple_ext(const(char)* device, const(uint)* offsets, const(int)* values, uint num_lines, bool active_low, const(char)* consumer, gpiod_ctxless_set_value_cb cb, void* data, int flags)

@brief Set values of multiple GPIO lines. @param device Name, path, number or label of the gpiochip. @param offsets Array of offsets of lines the values of which should be set. @param values Array of integers containing new values. @param num_lines Number of lines, must be > 0. @param active_low The active state of this line - true if low. @param consumer Name of the consumer. @param cb Optional callback function that will be called right after setting all values. Works the same as in ::gpiod_ctxless_set_value. @param data Optional user data that will be passed to the callback function. @param flags The flags for the lines. @return 0 if the operation succeeds, -1 on error.

gpiod_line_active_state
int gpiod_line_active_state(gpiod_line* line)

@brief Read the GPIO line active state setting. @param line GPIO line object. @return Returns GPIOD_LINE_ACTIVE_STATE_HIGH or GPIOD_LINE_ACTIVE_STATE_LOW.

gpiod_line_bias
int gpiod_line_bias(gpiod_line* line)

@brief Read the GPIO line bias setting. @param line GPIO line object. @return Returns GPIOD_LINE_BIAS_PULL_UP, GPIOD_LINE_BIAS_PULL_DOWN, GPIOD_LINE_BIAS_DISABLE or GPIOD_LINE_BIAS_AS_IS.

gpiod_line_bulk_add
void gpiod_line_bulk_add(gpiod_line_bulk* bulk, gpiod_line* line)

@brief Add a single line to a GPIO bulk object. @param bulk Line bulk object. @param line Line to add.

gpiod_line_bulk_get_line
gpiod_line* gpiod_line_bulk_get_line(gpiod_line_bulk* bulk, uint offset)

@brief Retrieve the line handle from a line bulk object at given offset. @param bulk Line bulk object. @param offset Line offset. @return Line handle at given offset.

gpiod_line_bulk_init
void gpiod_line_bulk_init(gpiod_line_bulk* bulk)

@brief Initialize a GPIO bulk object. @param bulk Line bulk object.

gpiod_line_bulk_num_lines
uint gpiod_line_bulk_num_lines(gpiod_line_bulk* bulk)

@brief Retrieve the number of GPIO lines held by this line bulk object. @param bulk Line bulk object. @return Number of lines held by this line bulk.

gpiod_line_close_chip
void gpiod_line_close_chip(gpiod_line* line)

@brief Close a GPIO chip owning this line and release all resources. @param line GPIO line object

gpiod_line_consumer
const(char)* gpiod_line_consumer(gpiod_line* line)

@brief Read the GPIO line consumer name. @param line GPIO line object. @return Name of the GPIO consumer name as it is represented in the kernel. This routine returns a pointer to a null-terminated string or NULL if the line is not used.

gpiod_line_direction
int gpiod_line_direction(gpiod_line* line)

@brief Read the GPIO line direction setting. @param line GPIO line object. @return Returns GPIOD_LINE_DIRECTION_INPUT or GPIOD_LINE_DIRECTION_OUTPUT.

gpiod_line_event_get_fd
int gpiod_line_event_get_fd(gpiod_line* line)

@brief Get the event file descriptor. @param line GPIO line object. @return Number of the event file descriptor or -1 if the user tries to retrieve the descriptor from a line that wasn't configured for event monitoring.

gpiod_line_event_read
int gpiod_line_event_read(gpiod_line* line, gpiod_line_event* event)

@brief Read next pending event from the GPIO line. @param line GPIO line object. @param event Buffer to which the event data will be copied. @return 0 if the event was read correctly, -1 on error. @note This function will block if no event was queued for this line.

gpiod_line_event_read_fd
int gpiod_line_event_read_fd(int fd, gpiod_line_event* event)

@brief Read the last GPIO event directly from a file descriptor. @param fd File descriptor. @param event Buffer in which the event data will be stored. @return 0 if the event was read correctly, -1 on error.

gpiod_line_event_read_fd_multiple
int gpiod_line_event_read_fd_multiple(int fd, gpiod_line_event* events, uint num_events)

@brief Read up to a certain number of events directly from a file descriptor. @param fd File descriptor. @param events Buffer to which the event data will be copied. Must hold at least the amount of events specified in num_events. @param num_events Specifies how many events can be stored in the buffer. @return On success returns the number of events stored in the buffer, on failure -1 is returned.

gpiod_line_event_read_multiple
int gpiod_line_event_read_multiple(gpiod_line* line, gpiod_line_event* events, uint num_events)

@brief Read up to a certain number of events from the GPIO line. @param line GPIO line object. @param events Buffer to which the event data will be copied. Must hold at least the amount of events specified in num_events. @param num_events Specifies how many events can be stored in the buffer. @return On success returns the number of events stored in the buffer, on failure -1 is returned.

gpiod_line_event_wait
int gpiod_line_event_wait(gpiod_line* line, const(timespec)* timeout)

@brief Wait for an event on a single line. @param line GPIO line object. @param timeout Wait time limit. @return 0 if wait timed out, -1 if an error occurred, 1 if an event occurred.

gpiod_line_event_wait_bulk
int gpiod_line_event_wait_bulk(gpiod_line_bulk* bulk, const(timespec)* timeout, gpiod_line_bulk* event_bulk)

@brief Wait for events on a set of lines. @param bulk Set of GPIO lines to monitor. @param timeout Wait time limit. @param event_bulk Bulk object in which to store the line handles on which events occurred. Can be NULL. @return 0 if wait timed out, -1 if an error occurred, 1 if at least one event occurred.

gpiod_line_find
gpiod_line* gpiod_line_find(const(char)* name)

@brief Find a GPIO line by its name. @param name Name of the GPIO line. @return Returns the GPIO line handle if the line exists in the system or NULL if it couldn't be located or an error occurred.

gpiod_line_get
gpiod_line* gpiod_line_get(const(char)* device, uint offset)

@brief Get a GPIO line handle by GPIO chip description and offset. @param device String describing the gpiochip. @param offset The offset of the GPIO line. @return GPIO line handle or NULL if an error occurred.

gpiod_line_get_chip
gpiod_chip* gpiod_line_get_chip(gpiod_line* line)

@brief Get the handle to the GPIO chip controlling this line. @param line The GPIO line object. @return Pointer to the GPIO chip handle controlling this line.

gpiod_line_get_value
int gpiod_line_get_value(gpiod_line* line)

@brief Read current value of a single GPIO line. @param line GPIO line object. @return 0 or 1 if the operation succeeds. On error this routine returns -1 and sets the last error number.

gpiod_line_get_value_bulk
int gpiod_line_get_value_bulk(gpiod_line_bulk* bulk, int* values)

@brief Read current values of a set of GPIO lines. @param bulk Set of GPIO lines to reserve. @param values An array big enough to hold line_bulk->num_lines values. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_is_free
bool gpiod_line_is_free(gpiod_line* line)

@brief Check if the calling user has neither requested ownership of this line nor configured any event notifications. @param line GPIO line object. @return True if given line is free, false otherwise.

gpiod_line_is_open_drain
bool gpiod_line_is_open_drain(gpiod_line* line)

@brief Check if the line is an open-drain GPIO. @param line GPIO line object. @return True if the line is an open-drain GPIO, false otherwise.

gpiod_line_is_open_source
bool gpiod_line_is_open_source(gpiod_line* line)

@brief Check if the line is an open-source GPIO. @param line GPIO line object. @return True if the line is an open-source GPIO, false otherwise.

gpiod_line_is_requested
bool gpiod_line_is_requested(gpiod_line* line)

@brief Check if the calling user has ownership of this line. @param line GPIO line object. @return True if given line was requested, false otherwise.

gpiod_line_is_used
bool gpiod_line_is_used(gpiod_line* line)

@brief Check if the line is currently in use. @param line GPIO line object. @return True if the line is in use, false otherwise.

gpiod_line_iter_free
void gpiod_line_iter_free(gpiod_line_iter* iter)

@brief Free all resources associated with a GPIO line iterator. @param iter Line iterator object.

gpiod_line_iter_new
gpiod_line_iter* gpiod_line_iter_new(gpiod_chip* chip)

@brief Create a new line iterator. @param chip Active gpiochip handle over the lines of which we want to iterate. @return New line iterator or NULL if an error occurred.

gpiod_line_iter_next
gpiod_line* gpiod_line_iter_next(gpiod_line_iter* iter)

@brief Get the next GPIO line handle. @param iter The GPIO line iterator object. @return Pointer to the next GPIO line handle or NULL if there are no more lines left.

gpiod_line_name
const(char)* gpiod_line_name(gpiod_line* line)

@brief Read the GPIO line name. @param line GPIO line object. @return Name of the GPIO line as it is represented in the kernel. This routine returns a pointer to a null-terminated string or NULL if the line is unnamed.

gpiod_line_needs_update
bool gpiod_line_needs_update(gpiod_line* line)

@brief Check if the line info needs to be updated. @param line GPIO line object. @return Deprecated and no longer functional - always returns false.

gpiod_line_offset
uint gpiod_line_offset(gpiod_line* line)

@brief Read the GPIO line offset. @param line GPIO line object. @return Line offset.

gpiod_line_release
void gpiod_line_release(gpiod_line* line)

@brief Release a previously reserved line. @param line GPIO line object.

gpiod_line_release_bulk
void gpiod_line_release_bulk(gpiod_line_bulk* bulk)

@brief Release a set of previously reserved lines. @param bulk Set of GPIO lines to release.

gpiod_line_request
int gpiod_line_request(gpiod_line* line, const(gpiod_line_request_config)* config, int default_val)

@brief Reserve a single line. @param line GPIO line object. @param config Request options. @param default_val Initial line value - only relevant if we're setting the direction to output. @return 0 if the line was properly reserved. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_request_both_edges_events
int gpiod_line_request_both_edges_events(gpiod_line* line, const(char)* consumer)

@brief Request all event type notifications on a single line. @param line GPIO line object. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_both_edges_events_flags
int gpiod_line_request_both_edges_events_flags(gpiod_line* line, const(char)* consumer, int flags)

@brief Request all event type notifications on a single line. @param line GPIO line object. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_bulk
int gpiod_line_request_bulk(gpiod_line_bulk* bulk, const(gpiod_line_request_config)* config, const(int)* default_vals)

@brief Reserve a set of GPIO lines. @param bulk Set of GPIO lines to reserve. @param config Request options. @param default_vals Initial line values - only relevant if we're setting the direction to output. @return 0 if the all lines were properly requested. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_request_bulk_both_edges_events
int gpiod_line_request_bulk_both_edges_events(gpiod_line_bulk* bulk, const(char)* consumer)

@brief Request all event type notifications on a set of lines. @param bulk Set of GPIO lines to request. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_bulk_both_edges_events_flags
int gpiod_line_request_bulk_both_edges_events_flags(gpiod_line_bulk* bulk, const(char)* consumer, int flags)

@brief Request all event type notifications on a set of lines. @param bulk Set of GPIO lines to request. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_bulk_falling_edge_events
int gpiod_line_request_bulk_falling_edge_events(gpiod_line_bulk* bulk, const(char)* consumer)

@brief Request falling edge event notifications on a set of lines. @param bulk Set of GPIO lines to request. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_bulk_falling_edge_events_flags
int gpiod_line_request_bulk_falling_edge_events_flags(gpiod_line_bulk* bulk, const(char)* consumer, int flags)

@brief Request falling edge event notifications on a set of lines. @param bulk Set of GPIO lines to request. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_bulk_input
int gpiod_line_request_bulk_input(gpiod_line_bulk* bulk, const(char)* consumer)

@brief Reserve a set of GPIO lines, set the direction to input. @param bulk Set of GPIO lines to reserve. @param consumer Name of the consumer. @return 0 if the lines were properly reserved, -1 on failure.

gpiod_line_request_bulk_input_flags
int gpiod_line_request_bulk_input_flags(gpiod_line_bulk* bulk, const(char)* consumer, int flags)

@brief Reserve a set of GPIO lines, set the direction to input. @param bulk Set of GPIO lines to reserve. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the lines were properly reserved, -1 on failure.

gpiod_line_request_bulk_output
int gpiod_line_request_bulk_output(gpiod_line_bulk* bulk, const(char)* consumer, const(int)* default_vals)

@brief Reserve a set of GPIO lines, set the direction to output. @param bulk Set of GPIO lines to reserve. @param consumer Name of the consumer. @param default_vals Initial line values. @return 0 if the lines were properly reserved, -1 on failure.

gpiod_line_request_bulk_output_flags
int gpiod_line_request_bulk_output_flags(gpiod_line_bulk* bulk, const(char)* consumer, int flags, const(int)* default_vals)

@brief Reserve a set of GPIO lines, set the direction to output. @param bulk Set of GPIO lines to reserve. @param consumer Name of the consumer. @param flags Additional request flags. @param default_vals Initial line values. @return 0 if the lines were properly reserved, -1 on failure.

gpiod_line_request_bulk_rising_edge_events
int gpiod_line_request_bulk_rising_edge_events(gpiod_line_bulk* bulk, const(char)* consumer)

@brief Request rising edge event notifications on a set of lines. @param bulk Set of GPIO lines to request. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_bulk_rising_edge_events_flags
int gpiod_line_request_bulk_rising_edge_events_flags(gpiod_line_bulk* bulk, const(char)* consumer, int flags)

@brief Request rising edge event notifications on a set of lines. @param bulk Set of GPIO lines to request. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_falling_edge_events
int gpiod_line_request_falling_edge_events(gpiod_line* line, const(char)* consumer)

@brief Request falling edge event notifications on a single line. @param line GPIO line object. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_falling_edge_events_flags
int gpiod_line_request_falling_edge_events_flags(gpiod_line* line, const(char)* consumer, int flags)

@brief Request falling edge event notifications on a single line. @param line GPIO line object. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_input
int gpiod_line_request_input(gpiod_line* line, const(char)* consumer)

@brief Reserve a single line, set the direction to input. @param line GPIO line object. @param consumer Name of the consumer. @return 0 if the line was properly reserved, -1 on failure.

gpiod_line_request_input_flags
int gpiod_line_request_input_flags(gpiod_line* line, const(char)* consumer, int flags)

@brief Reserve a single line, set the direction to input. @param line GPIO line object. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the line was properly reserved, -1 on failure.

gpiod_line_request_output
int gpiod_line_request_output(gpiod_line* line, const(char)* consumer, int default_val)

@brief Reserve a single line, set the direction to output. @param line GPIO line object. @param consumer Name of the consumer. @param default_val Initial line value. @return 0 if the line was properly reserved, -1 on failure.

gpiod_line_request_output_flags
int gpiod_line_request_output_flags(gpiod_line* line, const(char)* consumer, int flags, int default_val)

@brief Reserve a single line, set the direction to output. @param line GPIO line object. @param consumer Name of the consumer. @param flags Additional request flags. @param default_val Initial line value. @return 0 if the line was properly reserved, -1 on failure.

gpiod_line_request_rising_edge_events
int gpiod_line_request_rising_edge_events(gpiod_line* line, const(char)* consumer)

@brief Request rising edge event notifications on a single line. @param line GPIO line object. @param consumer Name of the consumer. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_request_rising_edge_events_flags
int gpiod_line_request_rising_edge_events_flags(gpiod_line* line, const(char)* consumer, int flags)

@brief Request rising edge event notifications on a single line. @param line GPIO line object. @param consumer Name of the consumer. @param flags Additional request flags. @return 0 if the operation succeeds, -1 on failure.

gpiod_line_set_config
int gpiod_line_set_config(gpiod_line* line, int direction, int flags, int value)

@brief Update the configuration of a single GPIO line. @param line GPIO line object. @param direction Updated direction which may be one of GPIOD_LINE_REQUEST_DIRECTION_AS_IS, GPIOD_LINE_REQUEST_DIRECTION_INPUT, or GPIOD_LINE_REQUEST_DIRECTION_OUTPUT. @param flags Replacement flags. @param value The new output value for the line when direction is GPIOD_LINE_REQUEST_DIRECTION_OUTPUT. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_config_bulk
int gpiod_line_set_config_bulk(gpiod_line_bulk* bulk, int direction, int flags, const(int)* values)

@brief Update the configuration of a set of GPIO lines. @param bulk Set of GPIO lines. @param direction Updated direction which may be one of GPIOD_LINE_REQUEST_DIRECTION_AS_IS, GPIOD_LINE_REQUEST_DIRECTION_INPUT, or GPIOD_LINE_REQUEST_DIRECTION_OUTPUT. @param flags Replacement flags. @param values An array holding line_bulk->num_lines new logical values for lines when direction is GPIOD_LINE_REQUEST_DIRECTION_OUTPUT. A NULL pointer is interpreted as a logical low for all lines. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_direction_input
int gpiod_line_set_direction_input(gpiod_line* line)

@brief Set the direction of a single GPIO line to input. @param line GPIO line object. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_direction_input_bulk
int gpiod_line_set_direction_input_bulk(gpiod_line_bulk* bulk)

@brief Set the direction of a set of GPIO lines to input. @param bulk Set of GPIO lines. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_direction_output
int gpiod_line_set_direction_output(gpiod_line* line, int value)

@brief Set the direction of a single GPIO line to output. @param line GPIO line object. @param value The logical value output on the line. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_direction_output_bulk
int gpiod_line_set_direction_output_bulk(gpiod_line_bulk* bulk, const(int)* values)

@brief Set the direction of a set of GPIO lines to output. @param bulk Set of GPIO lines. @param values An array holding line_bulk->num_lines new logical values for lines. A NULL pointer is interpreted as a logical low for all lines. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_flags
int gpiod_line_set_flags(gpiod_line* line, int flags)

@brief Update the configuration flags of a single GPIO line. @param line GPIO line object. @param flags Replacement flags. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_flags_bulk
int gpiod_line_set_flags_bulk(gpiod_line_bulk* bulk, int flags)

@brief Update the configuration flags of a set of GPIO lines. @param bulk Set of GPIO lines. @param flags Replacement flags. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_value
int gpiod_line_set_value(gpiod_line* line, int value)

@brief Set the value of a single GPIO line. @param line GPIO line object. @param value New value. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_set_value_bulk
int gpiod_line_set_value_bulk(gpiod_line_bulk* bulk, const(int)* values)

@brief Set the values of a set of GPIO lines. @param bulk Set of GPIO lines to reserve. @param values An array holding line_bulk->num_lines new values for lines. A NULL pointer is interpreted as a logical low for all lines. @return 0 is the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_line_update
int gpiod_line_update(gpiod_line* line)

@brief Re-read the line info. @param line GPIO line object. @return 0 if the operation succeeds. In case of an error this routine returns -1 and sets the last error number.

gpiod_version_string
const(char)* gpiod_version_string()

@brief Get the API version of the library as a human-readable string. @return Human-readable string containing the library version.

Manifest constants

GPIOD_LINE_BULK_MAX_LINES
enum GPIOD_LINE_BULK_MAX_LINES;

@brief Maximum number of GPIO lines that can be requested at once.

Structs

gpiod_chip
struct gpiod_chip

@mainpage libgpiod public API

gpiod_chip_iter
struct gpiod_chip_iter
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
gpiod_ctxless_event_poll_fd
struct gpiod_ctxless_event_poll_fd

@brief Helper structure for the ctxless event loop poll callback.

gpiod_line
struct gpiod_line
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
gpiod_line_bulk
struct gpiod_line_bulk

@brief Helper structure for storing a set of GPIO line objects.

gpiod_line_event
struct gpiod_line_event

@brief Structure holding event info.

gpiod_line_iter
struct gpiod_line_iter
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
gpiod_line_request_config
struct gpiod_line_request_config

@brief Structure holding configuration of a line request.

Meta