@@ -989,6 +989,15 @@ unsigned long gpiod_edge_event_get_line_seqno(struct gpiod_edge_event *event);
struct gpiod_edge_event_buffer *
gpiod_edge_event_buffer_new(unsigned int capacity);
+/**
+ * @brief Get the capacity (the max number of events that can be stored) of
+ * the event buffer.
+ * @param buffer Edge event buffer.
+ * @return The capacity of the buffer.
+ */
+unsigned int
+gpiod_edge_event_buffer_get_capacity(struct gpiod_edge_event_buffer *buffer);
+
/**
* @brief Free the edge event buffer and release all associated resources.
* @param buffer Edge event buffer to free.
@@ -109,6 +109,12 @@ gpiod_edge_event_buffer_new(unsigned int capacity)
return buf;
}
+GPIOD_API unsigned int
+gpiod_edge_event_buffer_get_capacity(struct gpiod_edge_event_buffer *buffer)
+{
+ return buffer->capacity;
+}
+
GPIOD_API void
gpiod_edge_event_buffer_free(struct gpiod_edge_event_buffer *buffer)
{
Add a getter for the edge-event buffer capacity property. This is useful if we want to read the maximum number of events that can be stored in a buffer object without externally storing its capacity. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> --- include/gpiod.h | 9 +++++++++ lib/edge-event.c | 6 ++++++ 2 files changed, 15 insertions(+)