All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kenneth Sloat <ksloat@designlinxhs.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: GPIO Bulk Request Problem
Date: Fri, 24 Sep 2021 11:57:06 +0200	[thread overview]
Message-ID: <CAMRc=Mewmbqo+y++j4iFEn36NMW3xL7AG9Vd+pLt6-PLE3cn0Q@mail.gmail.com> (raw)
In-Reply-To: <BN8PR17MB3025D723599B15E5AFB208DAA1A29@BN8PR17MB3025.namprd17.prod.outlook.com>

On Wed, Sep 22, 2021 at 6:27 PM Kenneth Sloat <ksloat@designlinxhs.com> wrote:
>
> Hello,
>
> I am using libgpiod v1.4.1 and am having trouble using a bulk request of gpio lines as outputs from a chip. I am using the C++ bindings. I have confirmed that I can individually request lines and set them as expected. However, if I use the bulk request, while I get the expected number of lines (and defaulted value is set correctly), iterating through them (with array operator in this case) and trying to set the values is not working as expected. I find that for every index/position, line 0 is the one being toggled.
>
> A simple example is below:
>
>     gpiod::chip *mychip;
>
>     mychip = new gpiod::chip("1");

Why would you need to allocate it with new?

>
>     gpiod::line_bulk lines = mychip->get_all_lines();
>     lines.request({std::string("gpio-test"),
>         gpiod::line_request::DIRECTION_OUTPUT, 0});
>
>     for (unsigned int i = 0; i < lines.size(); i++) {
>         printf("Set line %d\n", i);
>         lines[i].set_value(1);
>         usleep(1000 * 1000);
>         printf("Clear line %d\n", i);
>         lines[i].set_value(0);
>         usleep(1000 * 1000);
>         printf("\n");
>     }
>
>     return 0;
>
> Not sure if this is a usage problem on my part or an actual issue.
>

I'll see if I can confirm the behavior here but it looks like a bug indeed.

Bart

> Thanks
>
> Sincerely,
> Ken Sloat

  reply	other threads:[~2021-09-24  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 16:26 GPIO Bulk Request Problem Kenneth Sloat
2021-09-24  9:57 ` Bartosz Golaszewski [this message]
2021-09-24 12:25   ` Kenneth Sloat
2021-10-07 19:14     ` Bartosz Golaszewski
2021-10-07 19:22       ` Kenneth Sloat

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=Mewmbqo+y++j4iFEn36NMW3xL7AG9Vd+pLt6-PLE3cn0Q@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=ksloat@designlinxhs.com \
    --cc=linux-gpio@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.