linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>
Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [libgpiod][RFC] helper functions for basic use cases
Date: Tue, 14 May 2024 06:31:39 -0700	[thread overview]
Message-ID: <CAMRc=MftXh6SV_jNVDaUOwww21gH5gFeb8zGSVBLv=jMP_mFKQ@mail.gmail.com> (raw)
In-Reply-To: <20240513101331.GB89686@rigel>

On Mon, 13 May 2024 12:13:31 +0200, Kent Gibson <warthog618@gmail.com> 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.

>> We'd keep the clear distinction between the low-level, core C library wrapping
>> the kernel uAPI and the user-friendly C API. Though the user-friendly API in my
>> book could be the GLib library but I understand not everyone wants to use GLib
>> nor is familiar with GObject.
>>
>
> Sorry, still haven't had a chance to look at the GLib API.
> But if it involves any additional overhead or learning curve then it
> wont be well received.
>

Yes, unfortunately GLib & GObject are quite different from most of the regular
C programming.

Bart

  reply	other threads:[~2024-05-14 13:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  2:21 [libgpiod][RFC] helper functions for basic use cases Kent Gibson
2024-05-10 18:37 ` Bartosz Golaszewski
2024-05-11  1:11   ` Kent Gibson
2024-05-13  8:28     ` Bartosz Golaszewski
2024-05-13 10:13       ` Kent Gibson
2024-05-14 13:31         ` Bartosz Golaszewski [this message]
2024-05-14 13:38           ` Kent Gibson
2024-05-15  8:26             ` Bartosz Golaszewski
2024-05-15  9:18               ` Kent Gibson
2024-05-15 13:37                 ` Kent Gibson
2024-05-15 13:54                 ` Bartosz Golaszewski
2024-05-15 14:14                   ` Kent Gibson
2024-05-16  0:19                     ` Kent Gibson
2024-05-16 13:55                     ` Kent Gibson
2024-05-17 10:53                     ` Bartosz Golaszewski
2024-05-17 12:37                       ` Kent Gibson
2024-05-22 10:59                         ` Bartosz Golaszewski
2024-05-22 12:41                           ` Kent Gibson
2024-05-24 14:20                             ` Bartosz Golaszewski
2024-05-15  7:06       ` Martin Hundebøll
2024-05-15  9:32         ` Kent Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMRc=MftXh6SV_jNVDaUOwww21gH5gFeb8zGSVBLv=jMP_mFKQ@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).