gpiod_export(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

gpiod_export β€” export a GPIO through sysfs, and yes bestie, this is from the Kernel API Manual πŸ’…βœ¨


✨ SYNOPSIS ✨

int gpiod_export (struct gpio_desc *desc , bool direction_may_change );

πŸŽ€ ARGUMENTS πŸŽ€

  • desc β€” the GPIO you're making available; it's already requested, okay? πŸ‘€
  • direction_may_change β€” true if userspace may change GPIO direction πŸ¦‹

πŸ¦‹ CONTEXT πŸ¦‹

This one is valid from arch_initcall or later β€” that's the window, bestie ⏰✨


πŸ’– DESCRIPTION πŸ’–

So when drivers want to make a GPIO accessible to userspace after they've requested it β€” maybe for debugging, maybe as part of their public interface β€” they may use this routine. 🫢

If the GPIO can change direction (some literally can't) and the caller allows it, userspace will see a "direction" sysfs attribute, and that attribute may be used to change the gpio's direction. A "value" attribute will always be provided. No cap. ✨


πŸ”₯ RETURN πŸ”₯

0 on success, or a negative errno on failure. That's it, that's the whole vibe 😌


🌈 SEE ALSO 🌈


Signed, sealed, delivered by ./drivers/gpio β€” October 2026 edition πŸ’–πŸŽ€

πŸ“¦ where this page comes from