Re: [libgpiod][RFC] helper functions for basic use cases

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

 



On Tue, 14 May 2024 15:38:04 +0200, Kent Gibson <warthog618@xxxxxxxxx> said:
> On Tue, May 14, 2024 at 06:31:39AM -0700, Bartosz Golaszewski wrote:
>> On Mon, 13 May 2024 12:13:31 +0200, Kent Gibson <warthog618@xxxxxxxxx> said:
>> >
>> >> > /**
>> >> >  * @brief Set the bias of requested input line.
>> >> >  * @param olr The request to reconfigure.
>> >> >  * @param bias The new bias to apply to requested input line.
>> >> >  * @return 0 on success, -1 on failure.
>> >> >  */
>> >> > int gpiod_olr_set_bias(struct gpiod_line_request * olr,
>> >> > 		       enum gpiod_line_bias bias);
>> >>
>> >> For this to work, you'd most likely need a new struct wrapping the request
>> >> and also storing the line config. Otherwise - how'd you keep the state of all
>> >> the other line settings?
>> >>
>> >
>> > Yeah, I realised that when I went to implement it :(.
>> >
>> > What I implemented was to read the line info and build the config from that.
>> > So no impact on core.
>> > Not the most efficient, but for this use case I wan't fussed.
>> >
>>
>> I think those simplified requests should wrap the config structures, otherwise
>> we'd have to readback the config from the kernel which would become quite
>> complex for anything including more than one line.
>>
>
> The whole point of the simplified requests is that they only deal with
> a single line.  And the config mutators only deal with a single input.
>

For now anyway. :)

> Wouldn't wrapping break the ability to use all the other
> gpiod_line_request_XXX functions, and so require adding more functions
> to make use of the simplified requests?
>

Not sure why? You need a request for a single line anyway and you need to store
the config for it somewhere as toggling a single property will require a full
gpiod_line_request_reconfigure() anyway.

I don't think it'll be enough to re-use struct gpiod_line_request here, you
need some new structure. Unless you know how to do it. In that case: show me
the code. :)

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