config-pin for gpio output

In the day I did:

config-pin P9_11 out

to make it a gpio output. Now it appears I have to do:

config-pin P9_11 gpio

But how do I make it an output? Must I do:

echo out > /sys/class/gpio/gpio30/direction ?


The concept of out/in is not currently supported in the c based
re-write of config-pin used in Buster..


So is,
echo out > /sys/class/gpio/gpio30/direction

The proper way to set it to output?


The proper way is to use libgpiod tools such as gpioset :wink:

sudo gpioset gpiochip0 30=1

But that old way still woks.


Well, my solution, for now, was to write a wrapper[1] for config-pin that uses gpioinfo when ‘in’ or ‘out’ are used.



The proper way is to use libpruio and do pinmuxing single source in the code :wink:

pruio_gpio_setValue(io, P9_11, [0,1]);


How does the library change the pinmux during runtime?

Does it use /sys/devices/platform/ocp/ocp:P9_11_pinmux/state? (which
is created by bone-pinmux-helper)


The GPIO utils in FPP use a combination of /sys/devices/platform/ocp/ocp:%s_pinmux/state and /sys/class/gpio/gpio%u/ locations to configure the pin in various ways. See:

Some of it is a bit complex as some pins may need to boot up in i2c mode but then be flipped to gpio/out.

The idea of using libgpiod is “ok” but doesn’t allow configuring the internal pull ups for the input (at least until kernel 5.4 and a newer version of libgpiod)


It contains a LKM (loadable kernel module) that can set any pin configuration (ie. PRU-GPIO with pull-[up,down] at SD card slot) at run-time. All members of system group “pruio” have pinmuxing access from user space. This concept saves lots of kernel memory and more than six seconds boot-time.

Check out the documentation.