linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libgpiod 1.6.3] Do different lines have to be in the same scope?
@ 2022-02-14 14:01 Hummrich, Tobias
  2022-02-15  4:11 ` Kent Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Hummrich, Tobias @ 2022-02-14 14:01 UTC (permalink / raw)
  To: linux-gpio@vger.kernel.org

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-18 23:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-14 14:01 [libgpiod 1.6.3] Do different lines have to be in the same scope? Hummrich, Tobias
2022-02-15  4:11 ` Kent Gibson
2022-02-18 18:33   ` Bartosz Golaszewski
2022-02-18 23:53     ` Kent Gibson

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).