On Sat, Jun 04, 2022 at 10:41:31AM +0800, Kent Gibson wrote: > On Fri, Jun 03, 2022 at 08:46:00PM +0800, Kent Gibson wrote: > > On Wed, May 25, 2022 at 04:07:02PM +0200, Bartosz Golaszewski wrote: ... > > The focus of my comments above is to simplify the API for the most common > > case, and to make it a little more Pythonic rather than mirroring the C > > API, in both cases by hiding implementation details that the casual user > > doesn't need to know about. > > > > Further to this, and recalling our discussions on tool changes, it would > be great if the Python API supported identification of line by name, not > just (chip,offset). > > e.g. > with gpiod.request_lines( > lines=("GPIO17", "GPIO18"), > edge_detection=Edge.BOTH, > ) as request: > for event in request.edge_events(): > print(event) > > with the returned event extended to contain the line name if the line > was identified by name in request_lines(). > > The lines kwarg replaces offsets, and could contain names (strings) or > offsets (integers), or a combination. If any offsets are present then > the chip path kwarg must also be provided. If the chip isn't provided, > request_lines() would find the corresponding chip based on the line name. >From Python programmer perspective it's a good idea, but from GPIO (ABI) perspective, it may be confusing. Line name is not unique (globally) and basically not a part of ABI. -- With Best Regards, Andy Shevchenko