2

I have an existing C++ code that reads periodically from /sys/class/gpio. Since this is depreciated, I want to change it and use libgpiod.

I have got component tests that run independently from the actual hardware. It runs on my dev machine that does not have those gpios. My code reads an environment variable with a different path, then uses the files there instead of /sys/class/gpio. I created simple text files there. I can now change these files to manipulate what my code reads and test its behaviour.

Is there a similar possibility for libgpiod?

taylor.2317
  • 582
  • 1
  • 9
  • 23
kuga
  • 1,483
  • 1
  • 17
  • 38
  • 1
    Does this answer your question? [How to setup virtual Gpio loopback](https://stackoverflow.com/questions/66424148/how-to-setup-virtual-gpio-loopback) – 0andriy Dec 23 '21 at 08:15

1 Answers1

2

There's a GPIO testing driver called gpio-mockup you can load. It creates mock GPIO devices. You need to enable it in your kernel or load it as a module.

micke
  • 899
  • 9
  • 23