From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org, Adam Tofilski <rotofils@cyf-kr.edu.pl>
Subject: Re: libgpiod - bufor problem
Date: Sat, 27 Aug 2022 09:37:47 +0800 [thread overview]
Message-ID: <Ywl1aw447YBhB9Oc@sol> (raw)
In-Reply-To: <001901d8b95d$359a2060$a0ce6120$@edu.pl>
On Fri, Aug 26, 2022 at 05:04:58PM +0200, Adam Tofilski wrote:
> Dear Bartosz
> First of all thank you for gpiomon software.
>
> I try to use if for data acquisition from an optical sensor. It works fine
> from command line but when I try to run it as QProcess in QT (GUI) there is
> a problem with buffering. The output is transferred occasionally in large
> pieces. What I need is to get output immediately after each line. I plan to
> distribute my software as open source.
>
> As I understand this problem can be solved by adding to your code
> setbuf(stdout, NULL);
> or
> fflush(stdout)
> after each line.
>
My proposed tool changes for libgpiod v2[1] include the fflush after
each line for the same reason. I had issues with the setbuf approach,
though I don't recall the specifics, so went with the fflush.
Maybe do the same for v1?
Though I note that the target audience for that is cheap and cheerful
scripts, not apps.
Adam, the appropriate solution for you would be to use libgpiod directly
rather than wrapping gpiomon. The tools like gpiomon are just that -
tools. The output of gpiomon is not part of the stable ABI, so
getting the events directly from libgpiod is the way to go.
Apps should use the C library directly, or the C++ or Python bindings
as appropriate.
Cheers,
Kent.
[1] https://lore.kernel.org/linux-gpio/20220708120626.89844-1-warthog618@gmail.com/
> I hope you will be able to help me with this.
> Best wishes
> Adam
>
> Adam Tofilski
> Department of Zoology and Animal Welfare
> Agricultural University
> 29 Listopada 56
> 31-425 Krakow
> Poland
> rotofils@cyf-kr.edu.pl
> tel: +48 12 6625069
>
>
prev parent reply other threads:[~2022-08-27 1:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 15:04 libgpiod - bufor problem Adam Tofilski
2022-08-27 1:37 ` Kent Gibson [this message]
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=Ywl1aw447YBhB9Oc@sol \
--to=warthog618@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linux-gpio@vger.kernel.org \
--cc=rotofils@cyf-kr.edu.pl \
/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).