1

What is the best way to check at run time if a device tree overlay is loaded?

I've found info about checking individual GPIO pin status, and info about how to load the overlay (via config.txt), but I'm not finding info about how to check if the actual device tree overlay is loaded. I am specifically interested in knowing if the dpi24 overlay is active.

EDIT: There are 2 reasons I asked this question:

  1. I have an OpenGL program that runs on a RPi, and it needs to display differently depending on whether video is going directly to a monitor or it has been redirected to the GPIO pins (via the dpi24 overlay). Sure, I could add a command line switch or some other type of config parameter, but that violates the DRY principle, as well as introducing the possibility of the user choosing the wrong answer and then there is an inconsistency to resolve.

  2. I searched and read thru a bunch of info and didn't find the answer. It should be possible to do this, but appears to be undocumented (or not easy to find). So in addition to the DRY reason, I'm now also curious about it.

  • 1
    Smells like an XY problem. – goldilocks Mar 6 '17 at 7:38
  • question edited to explain the reasons. – djulien Mar 7 '17 at 1:56
  • I'd dig into sysfs; all or most hardware is represented in there somewhere somehow. A simple way to check it out would be to boot a pi with the overlay on, then save the output of sudo ls -R /sys to a file. Reboot it without the overlay applied, do the same thing, diff the files. This should at least give you a starting point for poking around. If you figure it out and have time, please leave an answer of your own. – goldilocks Mar 9 '17 at 10:14
  • I suppose you could check if the compatible statement has loaded the specified module. – PaulF8080 Mar 11 '17 at 18:18
0

The output of sudo ls -R /sys contains a reference to dpi24_pins when it is loaded, so that will solve the problem - I can check it with a script. Thanks goldilocks!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.