Feature Request: Ability to retrieve line by name via libgpiodbus
While implementing the ability for a user-space application to configure GPIO pins via the libgpiodbus library I found myself having to copy/utilize a lot of helper functions from the client code in order to be able to retrieve a line via name
"get_line_obj_by_name" is the entry point I used to retrieve a "GpiodbusLine *line" object. This requires copying/implementing many other helper functions (get_chip_objs, get_line_obj_by_name_for_chip, get_object_manager_client)
It would be nice if there was a "gpiodbus_get_line_obj_by_name" API that would abstract all of this
libgpiodbus is entirely dynamically generated by gdbus-codegen. I suggest you create a library of such helpers and we can discuss making it part of libgpiod as a separate entity linking against libgpiodbus.
Would my utils.c library (https://github.com/Maru006/contrib/blob/master/dht11/utils.c) help you somehow?
It abstracts requesting a line as output or as an input.
@Maru006 Thanks for providing your repo as an example on how to request a line via API provided by libgpiod.
@brgl Most, if not all, of the helper functions that I have utilized are directly from https://github.com/brgl/libgpiod/blob/master/dbus/client/common.c It feels a bit counterproductive to implement yet another library that provides the same functionality
I think I'm in a similar situation. Since gpiochip names are dynamic in newer kernels, everyone needs to use the --by-name option provided by the command line tools. However, it would be nice if there were a gpiod_request_line_by_name() in the library. Unless I'm missing something, and there is a way to do this.
I'm in the process of extracting the line resolver code from tools-common.c now.
@brgl Most, if not all, of the helper functions that I have utilized are directly from https://github.com/brgl/libgpiod/blob/master/dbus/client/common.c It feels a bit counterproductive to implement yet another library that provides the same functionality
Fait enough but I personally will most likely not have the time nor motivation to do it. The project is open-source though, so if you find the time to create a separate library of helpers, let's call it libgpiocli or something, create a set of common helpers with a nice API and make gpiocli use it instead of keeping that code in common.c, then I'm more than willing to make it part of libgpiod! Just please use a common prefix for public symbols and follow the coding convention established for the rest of the project.