Re: [libgpiod v2][PATCH v2] treewide: rework line configuration

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

 



On Wed, Sep 14, 2022 at 12:13 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Tue, Sep 13, 2022 at 06:14:07PM +0200, Bartosz Golaszewski wrote:
> > This tries to get rid of the concept of defaults and overrides for line
> > properties from the library (or rather hide them from the users). While
> > this makes the C API a bit more complex, it allows for a more elegant
> > high-level interface.
> >
> > This patch is pretty big but I'll just give an overview here. I don't
> > expect a detailed review of every line.
> >
> > Low-level data structure model (as seen in the C API):
> >
> > We're adding a new structure - line_settings. It's a basic data class
> > that stores a set of line properties. The line_config object is simplified
> > and becomes a storage for the mappings between offsets and line_settings.
> >
> > We no longer require the user to store the offsets array in the
> > request_config. The offsets to request are simply those for which the
> > user explicitly added settings to the line_config. Subsequently, the
> > request_config structure becomes optional for the request.
> >
> > In C++ bindings this allows us to implement an elegant interface with
> > rust-like chained mutators. To that end, we're also introducing a new
> > intermediate class called request_builder that's returned by the chip's
> > prepare_request() method which exposes routines for storing the line
> > and request configs for the request we're making. For examples of
> > usage - see C++ tests and samples.
>
> It's a huge change and my knowledge of C++ is a bare minimum from dozen of
> years ago, can you point out to the file with an example how this APIs (which
> are suggested by a new code) look like for developer in practice? Some test
> cases or simple example? This can help to understand the prettiness of the
> API.
>

Yeah I know it's big but we simply need to get all this code in somehow.

You can apply this patch and go to bindings/cxx/examples and
bindings/cxx/tests for code samples.

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