Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5827

Advanced users • Is everyone happy with the quality of libgpiod?

$
0
0
Foreword: Not sure this belongs under Advanced Users (apologies if inappropriate choice).

And so, after experimenting briefly with libgpiod and its spawn (the gpiod collection) 18-24 months ago, and reading more frequently about the impending demise of sysfs w linux 6.6 - I decided to take libgpiod out for another spin. And not wanting to invest much time in writing a C app, I used the gpiod collection as a proxy.

So far, my impression is that libgpiod is "lacking". Following are a few simple examples:

From the command line:
1. Apparently the developer still has issues with persistence:
  • $ gpioset gpiochip0 25=1
    $ gpioget gpiochip0 25
    0
    $
    < OK, no surprises here, and I get that not everyone feels that when something is "set", it should remain set until it is cleared. >

2. Let's go on...
  • $ gpioset --background gpiochip0 25=1
    gpioset: can't daemonize in this mode
    < ?? No mention of this in man gpioset, but turns out 'signal' is the correct mode for using 'background' >
    $ gpioset --mode=signal --background gpiochip0 25=1
    $ gpioget gpiochip0 25
    gpioget: error reading GPIO values: Device or resource busy
    < ?? it seems the way this must be done is as follows: >
    $ ps -aux | grep gpioset
    pi 2212 0.0 0.0 1980 84 ? Ss 04:30 0:00 gpioset --mode=signal --background gpiochip0 25=1
    $ kill 2212
    < but of course now, this should be obvious :P >
    $ gpioget gpiochip0 25
    0
    $

3. But it turns out that what seemed to be going on - may not be what's actually happening in the hardware... Let's connect an LED from GPIO24 (pin 18) to GND (pin 20) & see what happens:
  • $ gpioset gpiochip0 24=1
    < LED comes ON, and stays on !! >
    $ gpioget gpiochip0 24
    0
    < LED turns OFF immediately after gpioget command >
    < sorry, but this doesn't quite make sense to me >
    < also fairly sure this is not how it worked last time I tried (~18-24 mos ago) >

    $ gpioset --mode=time --sec=3 gpiochip0 24=1
    < LED comes ON, and stays on indefinitely >


Maybe I'm thick... is there something going on here that I'm missing - or does this behavior seem strange to others?

Statistics: Posted by irishmonk-57 — Mon Dec 18, 2023 7:12 am



Viewing all articles
Browse latest Browse all 5827

Trending Articles