@brief Simple event callback signature.
@brief Simple event poll callback signature.
@brief Simple set value callback signature.
@brief Return status values that the ctxless event callback can return.
@brief Event types that can be passed to the ctxless event callback.
@brief Return status values that the ctxless event poll callback can return.
@brief Event types that the ctxless event monitor can wait for.
@brief Miscellaneous GPIO flags.
@brief Possible active state settings.
@brief Possible internal bias settings.
@brief Possible direction settings.
@brief Event types.
@brief Available types of requests.
@brief Miscellaneous GPIO request flags.
@brief Shift 1 by given offset. @param nr Bit position. @return 1 shifted by nr.
@brief Close a GPIO chip handle and release all allocated resources. @param chip The GPIO chip object.
@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.
@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.
@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.
@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.
@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.
@brief Release all resources allocated for the gpiochip iterator and close the most recently opened gpiochip (if any). @param iter The gpiochip iterator object.
@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.
@brief Create a new gpiochip iterator. @return Pointer to a new chip iterator object or NULL if an error occurred.
@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.
@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.
@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.
@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.
@brief Get the number of GPIO lines exposed by this chip. @param chip The GPIO chip object. @return Number of GPIO lines.
@brief Open a gpiochip by path. @param path Path to the gpiochip device file. @return GPIO chip handle or NULL if an error occurred.
@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.
@brief Open a gpiochip by name. @param name Name of the gpiochip to open. @return GPIO chip handle or NULL if an error occurred.
@brief Open a gpiochip by number. @param num Number of the gpiochip. @return GPIO chip handle or NULL if an error occurred.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@brief Add a single line to a GPIO bulk object. @param bulk Line bulk object. @param line Line to add.
@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.
@brief Initialize a GPIO bulk object. @param bulk Line bulk object.
@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.
@brief Close a GPIO chip owning this line and release all resources. @param line GPIO line object
@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.
@brief Read the GPIO line direction setting. @param line GPIO line object. @return Returns GPIOD_LINE_DIRECTION_INPUT or GPIOD_LINE_DIRECTION_OUTPUT.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@brief Check if the line is currently in use. @param line GPIO line object. @return True if the line is in use, false otherwise.
@brief Free all resources associated with a GPIO line iterator. @param iter Line iterator object.
@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.
@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.
@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.
@brief Check if the line info needs to be updated. @param line GPIO line object. @return Deprecated and no longer functional - always returns false.
@brief Read the GPIO line offset. @param line GPIO line object. @return Line offset.
@brief Release a previously reserved line. @param line GPIO line object.
@brief Release a set of previously reserved lines. @param bulk Set of GPIO lines to release.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@brief Get the API version of the library as a human-readable string. @return Human-readable string containing the library version.
@brief Maximum number of GPIO lines that can be requested at once.
@mainpage libgpiod public API
@brief Helper structure for the ctxless event loop poll callback.
@brief Helper structure for storing a set of GPIO line objects.
@brief Structure holding event info.
@brief Structure holding configuration of a line request.
This is the original gpio.h file processed by dstep