Functions for retrieving kernel information about both requested and free lines.
More...
Functions for retrieving kernel information about both requested and free lines.
Line info object contains an immutable snapshot of a line's status.
The line info contains all the publicly available information about a line, which does not include the line value. The line must be requested to access the line value.
Some accessor methods return pointers. Those pointers refer to internal fields. The lifetimes of those fields are tied to the lifetime of the containing line info object. Such pointers remain valid until gpiod_line_info_free is called on the containing line info object. They must not be freed by the caller.
◆ gpiod_line_info_copy()
Copy a line info object.
- Parameters
-
- Returns
- Copy of the line info or NULL on error. The returned object must be freed by the caller using :gpiod_line_info_free.
◆ gpiod_line_info_free()
Free a line info object and release all associated resources.
- Parameters
-
info | GPIO line info object to free. |
◆ gpiod_line_info_get_bias()
◆ gpiod_line_info_get_consumer()
Get the name of the consumer of the line.
- Parameters
-
info | GPIO line info object. |
- Returns
- Name of the GPIO consumer as it is represented in the kernel. This function returns a valid pointer to a null-terminated string or NULL if the consumer name is not set. The string lifetime is tied to the line info object so the pointer must not be freed.
◆ gpiod_line_info_get_debounce_period_us()
unsigned long gpiod_line_info_get_debounce_period_us |
( |
struct gpiod_line_info * |
info | ) |
|
Get the debounce period of the line, in microseconds.
- Parameters
-
info | GPIO line info object. |
- Returns
- Debounce period in microseconds. 0 if the line is not debounced.
◆ gpiod_line_info_get_direction()
◆ gpiod_line_info_get_drive()
◆ gpiod_line_info_get_edge_detection()
◆ gpiod_line_info_get_event_clock()
◆ gpiod_line_info_get_name()
Get the name of the line.
- Parameters
-
info | GPIO line info object. |
- Returns
- Name of the GPIO line as it is represented in the kernel. This function returns a valid pointer to a null-terminated string or NULL if the line is unnamed. The string lifetime is tied to the line info object so the pointer must not be freed.
◆ gpiod_line_info_get_offset()
Get the offset of the line.
- Parameters
-
info | GPIO line info object. |
- Returns
- Offset of the line within the parent chip.
The offset uniquely identifies the line on the chip. The combination of the chip and offset uniquely identifies the line within the system.
◆ gpiod_line_info_is_active_low()
Check if the logical value of the line is inverted compared to the physical.
- Parameters
-
- Returns
- True if the line is "active-low", false otherwise.
◆ gpiod_line_info_is_debounced()
Check if the line is debounced (either by hardware or by the kernel software debouncer).
- Parameters
-
info | GPIO line info object. |
- Returns
- True if the line is debounced, false otherwise.
◆ gpiod_line_info_is_used()
Check if the line is in use.
- Parameters
-
- Returns
- True if the line is in use, false otherwise.
The exact reason a line is busy cannot be determined from user space. It may have been requested by another process or hogged by the kernel. It only matters that the line is used and can't be requested until released by the existing consumer.