/sys/class/gpio/export will unexport a pin if accessed twice. Is this a bug?

$ echo 13 > /sys/class/gpio/export
$ ls /sys/class/gpio/gpio13
active_low  device  direction  edge  label  power  subsystem  uevent  value
$ echo 13 > /sys/class/gpio/export
-bash: echo: write error: Operation not permitted
$ ls /sys/class/gpio/gpio13
ls: cannot access '/sys/class/gpio/gpio13': No such file or directory

Expected behavior: gpio13 should still be there after the second export.
Observed behavior: gpio13 disappears after the second export.

This is with the latest Debian kernel (4.14.71-ti-r80).

Is there a recommended way to export a gpio pin if it may already exist? I 
want to write a script to set up the pins. I could check if each pin 
already exists, but that's a recipe for race conditions as well as being 
inconvenient.

Ken

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/62a49479-026b-455b-bd02-312065a78bc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to