From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-gpio@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [libgpiod][PATCH 2/2] bindings: cxx: examples: fix potential glitch in gpiosetcxx
Date: Mon, 12 Jun 2023 16:56:53 +0200 [thread overview]
Message-ID: <20230612145653.138615-3-brgl@bgdev.pl> (raw)
In-Reply-To: <20230612145653.138615-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
gpiosetcxx requests lines without setting their output value, and so
sets them all inactive, and subsequently sets them to their requested
value. This can result in glitches on lines which were active and
are set active.
As this is example code, it is also important to demonstrate that the
output value can be set by the request itself.
Request the lines with the correct output values set in the request
itself.
Suggested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/cxx/examples/gpiosetcxx.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/bindings/cxx/examples/gpiosetcxx.cpp b/bindings/cxx/examples/gpiosetcxx.cpp
index dde5379..f46cb85 100644
--- a/bindings/cxx/examples/gpiosetcxx.cpp
+++ b/bindings/cxx/examples/gpiosetcxx.cpp
@@ -44,10 +44,9 @@ int main(int argc, char **argv)
::gpiod::line_settings()
.set_direction(::gpiod::line::direction::OUTPUT)
)
+ .set_output_values(values)
.do_request();
- request.set_values(values);
-
::std::cin.get();
return EXIT_SUCCESS;
--
2.39.2
next prev parent reply other threads:[~2023-06-12 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 14:56 [libgpiod][PATCH 0/2] bindings: cxx: fix potential glitch in gpiosetcxx Bartosz Golaszewski
2023-06-12 14:56 ` [libgpiod][PATCH 1/2] bindings: cxx: provide request_builder::set_output_values() Bartosz Golaszewski
2023-06-12 14:56 ` Bartosz Golaszewski [this message]
2023-06-12 15:06 ` [libgpiod][PATCH 0/2] bindings: cxx: fix potential glitch in gpiosetcxx Kent Gibson
-- strict thread matches above, loose matches on Subject: below --
2023-06-09 15:36 [libgpiod][PATCH 0/2] fix potential glitches in bindings example gpiosets Kent Gibson
2023-06-09 15:36 ` [libgpiod][PATCH 2/2] bindings: cxx: examples: fix potential glitch in gpiosetcxx Kent Gibson
2023-06-09 20:19 ` andy.shevchenko
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=20230612145653.138615-3-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=viresh.kumar@linaro.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).