linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Hummrich, Tobias" <T.Hummrich@eckelmann.de>
To: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: [libgpiod 1.6.3] Do different lines have to be in the same scope?
Date: Mon, 14 Feb 2022 14:01:29 +0000	[thread overview]
Message-ID: <17c74834c56e4345ac2611b92c301e2f@eckelmann.de> (raw)

Hi,

last week I ported part of our gpio related code from sysfs to libgpiod. I use the C++ bindings. I had some problems polling two different lines on different gpio chips and finally realized that all was OK if both lines were defined in the same scope. Out of curiosity I'm asking: Is that really the case in version 1.6.3 and was this intended?

The problem was this: When I declared lines locally in a method and called this method to get the file descriptor, the file descriptor was the same for both lines. Like:

int MyClass::getFiledescriptor(const std::string &linename)
{
    auto currentLine = gpiod::find_line(linename);
    return currentLine.event_get_fd();
}

... returned 23 for both parameters "in1" and "in2" while gpioinfo told me that these names where unique.

It is OK for me now, the two lines I'm polling are members of one class now, it works as intended, and I'm fine with that. But still I wonder if I misunderstood something or just did it wrong.

Is a new version of libgpiod published soon? Then this whole text may be obsolete.

Kind regards
Tobias


             reply	other threads:[~2022-02-14 14:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 14:01 Hummrich, Tobias [this message]
2022-02-15  4:11 ` [libgpiod 1.6.3] Do different lines have to be in the same scope? Kent Gibson
2022-02-18 18:33   ` Bartosz Golaszewski
2022-02-18 23:53     ` 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=17c74834c56e4345ac2611b92c301e2f@eckelmann.de \
    --to=t.hummrich@eckelmann.de \
    --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 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).