/**
* @brief Read current values from a set of GPIO lines.
+ * @param consumer Name of the consumer.
* @param device Name, path or number of the gpiochip.
* @param offsets An array of offsets of lines whose values should be read.
* @param values A buffer in which the values will be stored.
* @param active_low The active state of the lines - true if low.
* @return 0 if the operation succeeds, -1 on error.
*/
-int gpiod_simple_get_value_multiple(const char *device, unsigned int *offsets,
- int *values, unsigned int num_lines,
+int gpiod_simple_get_value_multiple(const char *consumer, const char *device,
+ unsigned int *offsets, int *values,
+ unsigned int num_lines,
bool active_low) GPIOD_API;
/**
* @brief Read current value from a single GPIO line.
+ * @param consumer Name of the consumer.
* @param device Name, path or number of the gpiochip.
* @param offset GPIO line offset on the chip.
* @param active_low The active state of this line - true if low.
* @return 0 or 1 (GPIO value) if the operation succeeds, -1 on error.
*/
-static inline int gpiod_simple_get_value(const char *device,
+static inline int gpiod_simple_get_value(const char *consumer,
+ const char *device,
unsigned int offset, bool active_low)
{
int value, status;
- status = gpiod_simple_get_value_multiple(device, &offset,
+ status = gpiod_simple_get_value_multiple(consumer, device, &offset,
&value, 1, active_low);
if (status < 0)
return status;
return gpiod_strerror(gpiod_errno());
}
-int gpiod_simple_get_value_multiple(const char *device, unsigned int *offsets,
- int *values, unsigned int num_lines,
- bool active_low)
+int gpiod_simple_get_value_multiple(const char *consumer, const char *device,
+ unsigned int *offsets, int *values,
+ unsigned int num_lines, bool active_low)
{
struct gpiod_line_bulk bulk;
struct gpiod_chip *chip;
gpiod_line_bulk_add(&bulk, line);
}
- status = gpiod_line_request_bulk_input(&bulk,
- libgpiod_consumer, active_low);
+ status = gpiod_line_request_bulk_input(&bulk, consumer, active_low);
if (status < 0) {
gpiod_chip_close(chip);
return -1;
die("invalid GPIO offset: %s", argv[i + 1]);
}
- status = gpiod_simple_get_value_multiple(device, offsets, values,
+ status = gpiod_simple_get_value_multiple("gpioset", device,
+ offsets, values,
num_lines, active_low);
if (status < 0)
die_perror("error reading GPIO values");