libgpiod  0.3.2
gpiod.h
1 /*
2  * GPIO chardev utils for linux.
3  *
4  * Copyright (C) 2017 Bartosz Golaszewski <bartekgola@gmail.com>
5  *
6  * This library is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or (at
9  * your option) any later version.
10  */
11 
21 #ifndef __LIBGPIOD_GPIOD_H__
22 #define __LIBGPIOD_GPIOD_H__
23 
24 #include <stdlib.h>
25 #include <stdbool.h>
26 #include <time.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct gpiod_chip;
33 struct gpiod_line;
34 struct gpiod_chip_iter;
35 
46 #define GPIOD_API __attribute__((visibility("default")))
47 
53 #define GPIOD_BIT(nr) (1UL << (nr))
54 
74 #define _GPIOD_ERRNO_OFFSET 10000
75 
79 enum {
94 };
95 
100 int gpiod_errno(void) GPIOD_API;
101 
107 const char * gpiod_strerror(int errnum) GPIOD_API;
108 
113 const char * gpiod_last_strerror(void) GPIOD_API;
114 
134 int gpiod_simple_get_value_multiple(const char *consumer, const char *device,
135  const unsigned int *offsets, int *values,
136  unsigned int num_lines,
137  bool active_low) GPIOD_API;
138 
147 static inline int gpiod_simple_get_value(const char *consumer,
148  const char *device,
149  unsigned int offset, bool active_low)
150 {
151  int value, status;
152 
153  status = gpiod_simple_get_value_multiple(consumer, device, &offset,
154  &value, 1, active_low);
155  if (status < 0)
156  return status;
157 
158  return value;
159 }
160 
164 typedef void (*gpiod_set_value_cb)(void *);
165 
179 int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
180  const unsigned int *offsets,
181  const int *values, unsigned int num_lines,
182  bool active_low, gpiod_set_value_cb cb,
183  void *data) GPIOD_API;
184 
198 static inline int gpiod_simple_set_value(const char *consumer,
199  const char *device,
200  unsigned int offset, int value,
201  bool active_low,
202  gpiod_set_value_cb cb, void *data)
203 {
204  return gpiod_simple_set_value_multiple(consumer, device, &offset,
205  &value, 1, active_low,
206  cb, data);
207 }
208 
212 enum {
219 };
220 
224 enum {
229 };
230 
234 typedef int (*gpiod_event_cb)(int, const struct timespec *, void *);
235 
248 int gpiod_simple_event_loop(const char *consumer, const char *device,
249  unsigned int offset, bool active_low,
250  const struct timespec *timeout,
251  gpiod_event_cb callback, void *cbdata) GPIOD_API;
252 
268 enum {
275 };
276 
280 enum {
285 };
286 
290 enum {
295 };
296 
300 #define GPIOD_REQUEST_MAX_LINES 64
301 
310  struct gpiod_line *lines[GPIOD_REQUEST_MAX_LINES];
312  unsigned int num_lines;
314 };
315 
321 #define GPIOD_LINE_BULK_INITIALIZER { { NULL }, 0 }
322 
329 static inline void gpiod_line_bulk_init(struct gpiod_line_bulk *bulk)
330 {
331  bulk->num_lines = 0;
332 }
333 
339 static inline void gpiod_line_bulk_add(struct gpiod_line_bulk *bulk,
340  struct gpiod_line *line)
341 {
342  bulk->lines[bulk->num_lines++] = line;
343 }
344 
350 unsigned int gpiod_line_offset(struct gpiod_line *line) GPIOD_API;
351 
359 const char * gpiod_line_name(struct gpiod_line *line) GPIOD_API;
360 
368 const char * gpiod_line_consumer(struct gpiod_line *line) GPIOD_API;
369 
375 int gpiod_line_direction(struct gpiod_line *line) GPIOD_API;
376 
382 int gpiod_line_active_state(struct gpiod_line *line) GPIOD_API;
383 
389 bool gpiod_line_is_used_by_kernel(struct gpiod_line *line) GPIOD_API;
390 
396 bool gpiod_line_is_open_drain(struct gpiod_line *line) GPIOD_API;
397 
403 bool gpiod_line_is_open_source(struct gpiod_line *line) GPIOD_API;
404 
415 int gpiod_line_update(struct gpiod_line *line) GPIOD_API;
416 
430 bool gpiod_line_needs_update(struct gpiod_line *line) GPIOD_API;
431 
436  const char *consumer;
442  int flags;
444 };
445 
458 int gpiod_line_request(struct gpiod_line *line,
459  const struct gpiod_line_request_config *config,
460  int default_val) GPIOD_API;
461 
469 int gpiod_line_request_input(struct gpiod_line *line,
470  const char *consumer,
471  bool active_low) GPIOD_API;
472 
481 int gpiod_line_request_output(struct gpiod_line *line, const char *consumer,
482  bool active_low, int default_val) GPIOD_API;
483 
498  const struct gpiod_line_request_config *config,
499  const int *default_vals) GPIOD_API;
500 
509  const char *consumer,
510  bool active_low) GPIOD_API;
511 
521  const char *consumer, bool active_low,
522  const int *default_vals) GPIOD_API;
523 
528 void gpiod_line_release(struct gpiod_line *line) GPIOD_API;
529 
538 
544 bool gpiod_line_is_reserved(struct gpiod_line *line) GPIOD_API;
545 
552 bool gpiod_line_is_free(struct gpiod_line *line) GPIOD_API;
553 
560 int gpiod_line_get_value(struct gpiod_line *line) GPIOD_API;
561 
574  int *values) GPIOD_API;
575 
583 int gpiod_line_set_value(struct gpiod_line *line, int value) GPIOD_API;
584 
596  int *values) GPIOD_API;
597 
607 struct gpiod_line * gpiod_line_find_by_name(const char *name) GPIOD_API;
608 
614 struct gpiod_chip * gpiod_line_get_chip(struct gpiod_line *line) GPIOD_API;
615 
626 enum {
633 };
634 
639  const char *consumer;
647 };
648 
653  struct timespec ts;
657 };
658 
666 int gpiod_line_event_request(struct gpiod_line *line,
667  struct gpiod_line_evreq_config *config) GPIOD_API;
668 
676 int gpiod_line_event_request_rising(struct gpiod_line *line,
677  const char *consumer,
678  bool active_low) GPIOD_API;
679 
687 int gpiod_line_event_request_falling(struct gpiod_line *line,
688  const char *consumer,
689  bool active_low) GPIOD_API;
690 
698 int gpiod_line_event_request_all(struct gpiod_line *line,
699  const char *consumer,
700  bool active_low) GPIOD_API;
701 
706 void gpiod_line_event_release(struct gpiod_line *line) GPIOD_API;
707 
713 bool gpiod_line_event_configured(struct gpiod_line *line) GPIOD_API;
714 
722 int gpiod_line_event_wait(struct gpiod_line *line,
723  const struct timespec *timeout) GPIOD_API;
724 
735  const struct timespec *timeout,
736  struct gpiod_line **line) GPIOD_API;
737 
744 int gpiod_line_event_read(struct gpiod_line *line,
745  struct gpiod_line_event *event) GPIOD_API;
746 
755 int gpiod_line_event_get_fd(struct gpiod_line *line) GPIOD_API;
756 
767 int gpiod_line_event_read_fd(int fd, struct gpiod_line_event *event) GPIOD_API;
768 
785 struct gpiod_chip * gpiod_chip_open(const char *path) GPIOD_API;
786 
794 struct gpiod_chip * gpiod_chip_open_by_name(const char *name) GPIOD_API;
795 
803 struct gpiod_chip * gpiod_chip_open_by_number(unsigned int num) GPIOD_API;
804 
811 struct gpiod_chip * gpiod_chip_open_by_label(const char *label) GPIOD_API;
812 
822 struct gpiod_chip * gpiod_chip_open_lookup(const char *descr) GPIOD_API;
823 
828 void gpiod_chip_close(struct gpiod_chip *chip) GPIOD_API;
829 
835 const char * gpiod_chip_name(struct gpiod_chip *chip) GPIOD_API;
836 
842 const char * gpiod_chip_label(struct gpiod_chip *chip) GPIOD_API;
843 
849 unsigned int gpiod_chip_num_lines(struct gpiod_chip *chip) GPIOD_API;
850 
857 struct gpiod_line *
858 gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset) GPIOD_API;
859 
874 struct gpiod_chip_iter * gpiod_chip_iter_new(void) GPIOD_API;
875 
881 void gpiod_chip_iter_free(struct gpiod_chip_iter *iter) GPIOD_API;
882 
892 void gpiod_chip_iter_free_noclose(struct gpiod_chip_iter *iter) GPIOD_API;
893 
905 struct gpiod_chip *
906 gpiod_chip_iter_next(struct gpiod_chip_iter *iter) GPIOD_API;
907 
920 struct gpiod_chip *
921 gpiod_chip_iter_next_noclose(struct gpiod_chip_iter *iter) GPIOD_API;
922 
933 #define gpiod_foreach_chip(iter, chip) \
934  for ((chip) = gpiod_chip_iter_next(iter); \
935  !gpiod_chip_iter_done(iter); \
936  (chip) = gpiod_chip_iter_next(iter))
937 
948 #define gpiod_foreach_chip_noclose(iter, chip) \
949  for ((chip) = gpiod_chip_iter_next_noclose(iter); \
950  !gpiod_chip_iter_done(iter); \
951  (chip) = gpiod_chip_iter_next_noclose(iter))
952 
958 bool gpiod_chip_iter_done(struct gpiod_chip_iter *iter) GPIOD_API;
959 
967 bool gpiod_chip_iter_err(struct gpiod_chip_iter *iter) GPIOD_API;
968 
979 const char *
980 gpiod_chip_iter_failed_chip(struct gpiod_chip_iter *iter) GPIOD_API;
981 
985 enum {
992 };
993 
1001  unsigned int offset;
1003  struct gpiod_chip *chip;
1005  int state;
1007 };
1008 
1013 #define GPIOD_LINE_ITER_INITIALIZER(chip) { 0, (chip), GPIOD_LINE_ITER_INIT }
1014 
1020 static inline void gpiod_line_iter_init(struct gpiod_line_iter *iter,
1021  struct gpiod_chip *chip)
1022 {
1023  iter->offset = 0;
1024  iter->chip = chip;
1025  iter->state = GPIOD_LINE_ITER_INIT;
1026 }
1027 
1034 struct gpiod_line *
1036 
1042 static inline bool gpiod_line_iter_done(const struct gpiod_line_iter *iter)
1043 {
1044  return iter->state == GPIOD_LINE_ITER_DONE;
1045 }
1046 
1054 static inline bool gpiod_line_iter_err(const struct gpiod_line_iter *iter)
1055 {
1056  return iter->state == GPIOD_LINE_ITER_ERR;
1057 }
1058 
1065 static inline unsigned int
1067 {
1068  return iter->offset - 1;
1069 }
1070 
1077 #define gpiod_foreach_line(iter, line) \
1078  for ((line) = gpiod_line_iter_next(iter); \
1079  !gpiod_line_iter_done(iter); \
1080  (line) = gpiod_line_iter_next(iter))
1081 
1095 const char * gpiod_version_string(void) GPIOD_API;
1096 
1101 #ifdef __cplusplus
1102 } /* extern "C" */
1103 #endif
1104 
1105 #endif /* __LIBGPIOD_GPIOD_H__ */
Private: number of libgpiod-specific error numbers.
Definition: gpiod.h:92
int gpiod_line_event_get_fd(struct gpiod_line *line) GPIOD_API
Get the event file descriptor.
void gpiod_line_event_release(struct gpiod_line *line) GPIOD_API
Stop listening for events and release the line.
bool gpiod_line_is_open_drain(struct gpiod_line *line) GPIOD_API
Check if the line is an open-drain GPIO.
Rising or falling edge event: only relevant for event requests.
Definition: gpiod.h:631
Direction is output - we&#39;re driving the GPIO line.
Definition: gpiod.h:273
const char * gpiod_chip_name(struct gpiod_chip *chip) GPIOD_API
Get the GPIO chip name as represented in the kernel.
int gpiod_line_event_wait_bulk(struct gpiod_line_bulk *bulk, const struct timespec *timeout, struct gpiod_line **line) GPIOD_API
Wait for the first event on a set of lines.
struct gpiod_chip * gpiod_line_get_chip(struct gpiod_line *line) GPIOD_API
Get the handle to the GPIO chip controlling this line.
bool gpiod_chip_iter_done(struct gpiod_chip_iter *iter) GPIOD_API
Check if we&#39;re done iterating over gpiochips on this iterator.
struct gpiod_line * gpiod_line_find_by_name(const char *name) GPIOD_API
Find a GPIO line by its name.
int active_state
Requested active state configuration.
Definition: gpiod.h:440
bool gpiod_chip_iter_err(struct gpiod_chip_iter *iter) GPIOD_API
Check if we&#39;ve encountered an error condition while opening a gpiochip.
Direction is input - we&#39;re reading the state of a GPIO line.
Definition: gpiod.h:271
Waiting for events timed out.
Definition: gpiod.h:213
struct gpiod_chip * gpiod_chip_open_lookup(const char *descr) GPIOD_API
Open a gpiochip based on the best guess what the path is.
Continue processing events.
Definition: gpiod.h:225
int gpiod_line_get_value(struct gpiod_line *line) GPIOD_API
Read current value of a single GPIO line.
Number of lines in the request exceeds limit.
Definition: gpiod.h:90
static void gpiod_line_bulk_add(struct gpiod_line_bulk *bulk, struct gpiod_line *line)
Add a single line to a GPIO bulk object.
Definition: gpiod.h:339
int(* gpiod_event_cb)(int, const struct timespec *, void *)
Simple event callack signature.
Definition: gpiod.h:234
static void gpiod_line_iter_init(struct gpiod_line_iter *iter, struct gpiod_chip *chip)
Initialize a GPIO line iterator.
Definition: gpiod.h:1020
unsigned int num_lines
Number of lines currently held in this structure.
Definition: gpiod.h:312
void gpiod_chip_close(struct gpiod_chip *chip) GPIOD_API
Close a GPIO chip handle and release all allocated resources.
int event_type
Type of the event we want to be notified about.
Definition: gpiod.h:641
int gpiod_line_set_value(struct gpiod_line *line, int value) GPIOD_API
Set the value of a single GPIO line.
int line_flags
Misc line flags - same as for line requests.
Definition: gpiod.h:645
Falling edge event occured.
Definition: gpiod.h:217
static bool gpiod_line_iter_done(const struct gpiod_line_iter *iter)
Check if we&#39;re done iterating over lines on this iterator.
Definition: gpiod.h:1042
#define GPIOD_API
Makes symbol visible.
Definition: gpiod.h:46
int gpiod_line_get_value_bulk(struct gpiod_line_bulk *bulk, int *values) GPIOD_API
Read current values of a set of GPIO lines.
struct gpiod_chip * gpiod_chip_open_by_number(unsigned int num) GPIOD_API
Open a gpiochip by number.
Not all lines in bulk belong to the same GPIO chip.
Definition: gpiod.h:86
Falling edge event.
Definition: gpiod.h:629
The active state of a GPIO is active-low.
Definition: gpiod.h:283
const char * consumer
Name of the consumer.
Definition: gpiod.h:639
There was an error retrieving info for a line.
Definition: gpiod.h:990
int gpiod_simple_get_value_multiple(const char *consumer, const char *device, const unsigned int *offsets, int *values, unsigned int num_lines, bool active_low) GPIOD_API
Read current values from a set of GPIO lines.
Rising edge event.
Definition: gpiod.h:627
const char * gpiod_last_strerror(void) GPIOD_API
Convert the last libgpiod error number to a human-readable string.
static bool gpiod_line_iter_err(const struct gpiod_line_iter *iter)
Check if we&#39;ve encountered an error condition while retrieving info for a line.
Definition: gpiod.h:1054
int gpiod_line_event_wait(struct gpiod_line *line, const struct timespec *timeout) GPIOD_API
Wait for an event on a single line.
int gpiod_line_event_read(struct gpiod_line *line, struct gpiod_line_event *event) GPIOD_API
Read the last event from the GPIO line.
int gpiod_line_event_request_rising(struct gpiod_line *line, const char *consumer, bool active_low) GPIOD_API
Request rising edge event notifications on a single line.
Line iterator is initiated or iterating over lines.
Definition: gpiod.h:986
void gpiod_line_release(struct gpiod_line *line) GPIOD_API
Release a previously reserved line.
struct gpiod_chip * gpiod_chip_open(const char *path) GPIOD_API
Open a gpiochip by path.
Structure holding event info.
Definition: gpiod.h:652
unsigned int offset
Current line offset.
Definition: gpiod.h:1001
int gpiod_simple_set_value_multiple(const char *consumer, const char *device, const unsigned int *offsets, const int *values, unsigned int num_lines, bool active_low, gpiod_set_value_cb cb, void *data) GPIOD_API
Set values of a set of a set of GPIO lines.
int gpiod_line_request_bulk_output(struct gpiod_line_bulk *bulk, const char *consumer, bool active_low, const int *default_vals) GPIOD_API
Reserve a set of GPIO lines, set the direction to output.
struct gpiod_chip_iter * gpiod_chip_iter_new(void) GPIOD_API
Create a new gpiochip iterator.
void gpiod_chip_iter_free(struct gpiod_chip_iter *iter) GPIOD_API
Release all resources allocated for the gpiochip iterator and close the most recently opened gpiochip...
Line iterator is done with all lines on this chip.
Definition: gpiod.h:988
Stop processing events.
Definition: gpiod.h:227
#define GPIOD_BIT(nr)
Shift 1 by given offset.
Definition: gpiod.h:53
struct gpiod_chip * gpiod_chip_open_by_name(const char *name) GPIOD_API
Open a gpiochip by name.
bool gpiod_line_is_open_source(struct gpiod_line *line) GPIOD_API
Check if the line is an open-source GPIO.
int direction
Requested direction.
Definition: gpiod.h:438
int gpiod_line_request_bulk_input(struct gpiod_line_bulk *bulk, const char *consumer, bool active_low) GPIOD_API
Reserve a set of GPIO lines, set the direction to input.
int gpiod_line_active_state(struct gpiod_line *line) GPIOD_API
Read the GPIO line active state setting.
bool gpiod_line_is_used_by_kernel(struct gpiod_line *line) GPIOD_API
Check if the line is used by the kernel.
bool gpiod_line_is_free(struct gpiod_line *line) GPIOD_API
Check if the calling user has neither requested ownership of this line nor configured any event notif...
int gpiod_line_direction(struct gpiod_line *line) GPIOD_API
Read the GPIO line direction setting.
int gpiod_line_event_request_all(struct gpiod_line *line, const char *consumer, bool active_low) GPIOD_API
Request all event type notifications on a single line.
The caller has no ownership of this line.
Definition: gpiod.h:82
static unsigned int gpiod_line_iter_last_offset(const struct gpiod_line_iter *iter)
Get the offset of the last line we tried to open.
Definition: gpiod.h:1066
const char * gpiod_line_name(struct gpiod_line *line) GPIOD_API
Read the GPIO line name.
void(* gpiod_set_value_cb)(void *)
Simple set value callback signature.
Definition: gpiod.h:164
The caller has not configured any events on this line.
Definition: gpiod.h:84
int gpiod_line_event_request(struct gpiod_line *line, struct gpiod_line_evreq_config *config) GPIOD_API
Request event notifications for a single line.
Rising edge event occured.
Definition: gpiod.h:215
Only relevant for line requests - don&#39;t set the direction.
Definition: gpiod.h:269
Helper structure for storing a set of GPIO line objects.
Definition: gpiod.h:309
const char * gpiod_strerror(int errnum) GPIOD_API
Convert error number to a human-readable string.
#define GPIOD_REQUEST_MAX_LINES
Maximum number of GPIO lines that can be requested at once.
Definition: gpiod.h:300
int gpiod_line_update(struct gpiod_line *line) GPIOD_API
Re-read the line info.
#define _GPIOD_ERRNO_OFFSET
Private: offset for all libgpiod error numbers.
Definition: gpiod.h:74
unsigned int gpiod_line_offset(struct gpiod_line *line) GPIOD_API
Read the GPIO line offset.
int state
Current state of the iterator.
Definition: gpiod.h:1005
static int gpiod_simple_get_value(const char *consumer, const char *device, unsigned int offset, bool active_low)
Read current value from a single GPIO line.
Definition: gpiod.h:147
struct gpiod_chip * gpiod_chip_iter_next_noclose(struct gpiod_chip_iter *iter) GPIOD_API
Get the next gpiochip handle without closing the previous one.
int event_type
Type of the event that occurred.
Definition: gpiod.h:655
bool gpiod_line_needs_update(struct gpiod_line *line) GPIOD_API
Check if the line info needs to be updated.
struct gpiod_chip * chip
GPIO chip whose line we&#39;re iterating over.
Definition: gpiod.h:1003
const char * consumer
Name of the consumer.
Definition: gpiod.h:436
int flags
Other configuration flags.
Definition: gpiod.h:442
struct gpiod_chip * gpiod_chip_open_by_label(const char *label) GPIOD_API
Open a gpiochip by label.
struct gpiod_line * gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset) GPIOD_API
Get the handle to the GPIO line at given offset.
static void gpiod_line_bulk_init(struct gpiod_line_bulk *bulk)
Initialize a GPIO bulk object.
Definition: gpiod.h:329
bool gpiod_line_event_configured(struct gpiod_line *line) GPIOD_API
Check if event notifications are configured on this line.
The line is an open-source port.
Definition: gpiod.h:293
This line is currently in use.
Definition: gpiod.h:88
void gpiod_line_release_bulk(struct gpiod_line_bulk *bulk) GPIOD_API
Release a set of previously reserved lines.
No error.
Definition: gpiod.h:80
const char * gpiod_chip_label(struct gpiod_chip *chip) GPIOD_API
Get the GPIO chip label as represented in the kernel.
int gpiod_line_event_request_falling(struct gpiod_line *line, const char *consumer, bool active_low) GPIOD_API
Request falling edge event notifications on a single line.
const char * gpiod_chip_iter_failed_chip(struct gpiod_chip_iter *iter) GPIOD_API
Get the name of the gpiochip that we failed to access.
int gpiod_line_set_value_bulk(struct gpiod_line_bulk *bulk, int *values) GPIOD_API
Set the values of a set of GPIO lines.
struct gpiod_line * lines[GPIOD_REQUEST_MAX_LINES]
Buffer for line pointers.
Definition: gpiod.h:310
bool gpiod_line_is_reserved(struct gpiod_line *line) GPIOD_API
Check if the calling user has ownership of this line.
int gpiod_line_request_bulk(struct gpiod_line_bulk *bulk, const struct gpiod_line_request_config *config, const int *default_vals) GPIOD_API
Reserve a set of GPIO lines.
const char * gpiod_line_consumer(struct gpiod_line *line) GPIOD_API
Read the GPIO line consumer name.
The active state of a GPIO is active-high.
Definition: gpiod.h:281
GPIO line iterator structure.
Definition: gpiod.h:1000
Structure holding configuration of a line request.
Definition: gpiod.h:435
int gpiod_line_request_output(struct gpiod_line *line, const char *consumer, bool active_low, int default_val) GPIOD_API
Reserve a single line, set the direction to output.
const char * gpiod_version_string(void) GPIOD_API
Get the version of the library as a human-readable string.
int gpiod_line_request_input(struct gpiod_line *line, const char *consumer, bool active_low) GPIOD_API
Reserve a single line, set the direction to input.
int gpiod_line_event_read_fd(int fd, struct gpiod_line_event *event) GPIOD_API
Read the last GPIO event directly from a file descriptor.
struct gpiod_line * gpiod_line_iter_next(struct gpiod_line_iter *iter) GPIOD_API
Get the next GPIO line handle.
int gpiod_simple_event_loop(const char *consumer, const char *device, unsigned int offset, bool active_low, const struct timespec *timeout, gpiod_event_cb callback, void *cbdata) GPIOD_API
Wait for events on a single GPIO line.
Structure holding configuration of a line event request.
Definition: gpiod.h:638
int active_state
GPIO line active state.
Definition: gpiod.h:643
int gpiod_line_request(struct gpiod_line *line, const struct gpiod_line_request_config *config, int default_val) GPIOD_API
Reserve a single line.
static int gpiod_simple_set_value(const char *consumer, const char *device, unsigned int offset, int value, bool active_low, gpiod_set_value_cb cb, void *data)
Set value of a single GPIO line.
Definition: gpiod.h:198
void gpiod_chip_iter_free_noclose(struct gpiod_chip_iter *iter) GPIOD_API
Release all resources allocated for the gpiochip iterator but don&#39;t close the most recently opened gp...
int gpiod_errno(void) GPIOD_API
Return last error.
The line is an open-drain port.
Definition: gpiod.h:291
struct gpiod_chip * gpiod_chip_iter_next(struct gpiod_chip_iter *iter) GPIOD_API
Get the next gpiochip handle.
unsigned int gpiod_chip_num_lines(struct gpiod_chip *chip) GPIOD_API
Get the number of GPIO lines exposed by this chip.