Re: [libgpiod v2][PATCH v2 5/5] bindings: python: add the implementation for v2 API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 8, 2022 at 12:56 PM Kent Gibson <warthog618@xxxxxxxxx> wrote:
>

[snip]

> >
> > The limitation of the uAPI is what keeps us from making it true in
> > user-space (that each line can have its own config). As it is, only up
> > to 9-10 lines can have distinct configs and making the API look and
> > behave as if it wasn't the case is more confusing (E2BIG errors) than
> > simply admitting we have the concept of defaults and overrides (to
> > which the interface is greatly simplified in the high-level
> > libraries). The idea about making the most common config attributes
> > become the defaults is simply bad. It would require the user to
> > anticipate how the library will behave for every attribute and lead to
>
> It requires nothing from the user.  They are not even aware of the
> concept of "defaults" or "overrides".  They just set config on lines.
> If that is too complicated, which is quite unlikely, then they get
> E2BIG and they need to repartition their lines into multiple requests.
>
> Anyway, that horse is dead.
>

For a python user, this:

lc = gpiod.LineConfig()
lc.set_props(offsets=[2, 3], direction=Direction.OUTPUT)
req = gpiod.request_lines("/dev/gpiochip0", line_cfg=lc)

is pretty much as simple as it gets. They still don't need to be aware
of the underlying split into defaults and overrides. I believe it's
GoodEnough™.

I imagine in Rust bindings we'll be able to chain set_props() as is
customary and we'll get a one-liner out of that.

Bart




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux