notro wrote:With Device Tree a new gpio driver is used: pinctrl-bcm2835.
When you unexport, the pin is set back as input. If you want to keep it, don't unexport it.
Unexporting tells Linux that you don't use the pin anymore.
To some extent this behaviour is what I thought "ought to happen" but didn't (and thus now "breaks" some of my 'C' demo. (G)LCD display programs which used wiringPi's variant of the export process, unexporting all used pins on closure - ie. backlights turned on via an exported pin now turn off shortly after exit). So that leads to two questions:
1) Is it O.K. to re-request a pin to be exported that hasn't been unexported previously (as opposed to one that's never been exported)?
2) If not, is there a "robust" or "preferred" way of testing whether a pin has previously been exported (and still is)?
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm