gpioctl(8)

gpioctl8

Gpio control utility

Usage

gpioctl [-f ctldev] -l [-v]

gpioctl [-f ctldev] [-pN] -t pin

gpioctl [-f ctldev] [-pN] -c pin flag [flag ...]

gpioctl [-f ctldev] [-pN] -n pin pin-name

gpioctl [-f ctldev] [-pN] pin [{0 | 1}]

Overview

The gpioctl utility could be used to manage GPIO pins from userland and list available pins.

The pin argument can either be a pin-number or a pin-name. If it is a number and a pin has this number as its name and you did not use -N or -p , then gpioctl exits.

The options are as follows:

-c pin flag [flag ...]

Configure pin by setting provided flags. The following flags are currently defined:

IN

Input pin

OUT

Output pin

OD

Open drain pin

PP

Push pull pin

TS

Tristate pin

PU

Pull-up pin

PD

Pull-down pin

II

Inverted input pin

IO

Inverted output pin

-f ctldev

GPIO controller device to use If not specified, defaults to /dev/gpioc0

-l

list available pins

-n pin pin-name

set the name used to describe the pin

-t pin

toggle value of provided pin

-v

be verbose: for each listed pin print current configuration

-p

Force pin to be interpreted as a pin number

-N

Force pin to be interpreted as a pin name

Examples

  • List pins available on GPIO controller defined by device /dev/gpioc0

    gpioctl -f /dev/gpioc0 -l

  • Set the value of pin 12 to 1

    gpioctl -f /dev/gpioc0 12 1

  • Configure pin 12 to be input pin

    gpioctl -f /dev/gpioc0 -c 12 IN

  • Set the name of pin 12 to test

    gpioctl -f /dev/gpioc0 -n 12 test

  • Toggle the value the pin named test

    gpioctl -f /dev/gpioc0 -t test

  • Toggle the value of pin number 12 even if another pin has the name 12

    gpioctl -f /dev/gpioc0 -pt 12

Releases

34 releases since FreeBSD 9.0-RELEASE; the text changed 21 times.

  1. 9.0
  2. 9.1
  3. 9.2
  4. 9.3
  5. 10.0
  6. 10.1
  7. 10.2
  8. 10.3
  9. 10.4
  10. 11.0
  11. 11.1
  12. 11.2
  13. 11.3
  14. 11.4
  15. 12.0
  16. 12.1
  17. 12.2
  18. 12.3
  19. 12.4
  20. 13.0–13.2
  21. 13.3–15.1
  22. 16.0

-N since FreeBSD 11.0-RELEASE; -p since FreeBSD 11.0-RELEASE.

History

The gpioctl utility appeared in FreeBSD 9.0.

Authors

The gpioctl utility and this manual page were written by Oleksandr Tymoshenko ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.