/**
* @brief Set values of a set of 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 set.
* @param values An array of integers containing new values.
* @param data User data that will be passed to the callback function.
* @return 0 if the operation succeeds, -1 on error.
*/
-int gpiod_simple_set_value_multiple(const char *device, unsigned int *offsets,
- int *values, unsigned int num_lines,
- bool active_low, gpiod_set_value_cb cb,
+int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
+ unsigned int *offsets, int *values,
+ unsigned int num_lines, bool active_low,
+ gpiod_set_value_cb cb,
void *data) GPIOD_API;
/**
* @brief Set value of 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 value New value.
* @param data User data that will be passed to the callback function.
* @return 0 if the operation succeeds, -1 on error.
*/
-static inline int gpiod_simple_set_value(const char *device,
+static inline 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)
{
- return gpiod_simple_set_value_multiple(device, &offset, &value, 1,
- active_low, cb, data);
+ return gpiod_simple_set_value_multiple(consumer, device, &offset,
+ &value, 1, active_low,
+ cb, data);
}
/**
return status;
}
-int gpiod_simple_set_value_multiple(const char *device, unsigned int *offsets,
- int *values, unsigned int num_lines,
- bool active_low, gpiod_set_value_cb cb,
- void *data)
+int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
+ unsigned int *offsets, int *values,
+ unsigned int num_lines, bool active_low,
+ gpiod_set_value_cb cb, void *data)
{
struct gpiod_line_bulk bulk;
struct gpiod_chip *chip;
gpiod_line_bulk_add(&bulk, line);
}
- status = gpiod_line_request_bulk_output(&bulk, libgpiod_consumer,
+ status = gpiod_line_request_bulk_output(&bulk, consumer,
active_low, values);
if (status < 0) {
gpiod_chip_close(chip);
die("invalid offset: %s", argv[i + 1]);
}
- status = gpiod_simple_set_value_multiple(device, offsets, values,
- num_lines, active_low,
+ status = gpiod_simple_set_value_multiple("gpioset", device, offsets,
+ values, num_lines, active_low,
mode->callback, &cbdata);
if (status < 0)
die_perror("error setting the GPIO line values");