GPIOLOCK(4)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸŽ€ GPIOLOCK(4) β€” the kernel interfaces manual page, bestie edition πŸŽ€

okay so real talk, this is a page from the Kernel Interfaces Manual and it's about gpiolock, which is genuinely one of those "wait that's so cool" drivers once you get what it does. buckle up πŸ¦‹


✨ NAME ✨

gpiolock β€” support for multi-position keylocks attached to GPIO pins πŸ’…

like, actual physical keylocks. with keys. attached to pins. iconic.


🌸 SYNOPSIS 🌸

gpiolock* at gpio? offset ? mask ?
gpiolock* at gpio?

both forms are valid, no cap β€” the long one if you're specifying where the pins live, the short one if you're not πŸ’–


πŸ’« DESCRIPTION πŸ’«

The gpiolock driver lets you connect multi-position keylocks over GPIO pins. yes, literally a keylock, like the ones on a server chassis, wired into your kernel πŸ—οΈβœ¨

so here's the vibe: the keylock driver registers with an in-kernel keylock supporting system, and it provides kauth(9) support through an experimental security model. note the word experimental β€” it's giving "we're trying something new, be cool about it" πŸ§ͺ

you can query the keylock state using the hw.keylock sysctl variables. super convenient, lowkey the best part 🫢

important limits, don't skip these:

  • Only locks with 2-4 positions are currently supported. that's the range. 2 to 4. periodt πŸ’€
  • The pin number is specified in the kernel configuration with the offset locator.
  • The mask locator denotes the pins used for the lock β€” minimum 2, maximum 4 pins are used.

and here's the cute part: offset and mask can also be specified when gpiolock is attached at runtime, using the GPIOATTACH ioctl(2) on the gpio(4) device. runtime config, we love to see it 🌈


πŸ”₯ SEE ALSO πŸ”₯

go read those too, they're the supporting cast and they ate πŸ‘‘


🌼 HISTORY 🌼

The gpiolock driver first appeared in NetBSD 6.0. a certified classic, honestly ⭐


πŸ’œ AUTHORS πŸ’œ

The gpiolock driver was written by Marc Balmer <marc@msys.ch> β€” thank you king, we appreciate you πŸ™


bestie reminder: this is an experimental security model, and the lock only supports 2-4 positions with 2-4 mask pins. don't try to make it do more, it's not that kind of driver πŸŽ€

and that's the page! this edition of GPIOLOCK(4) comes from Debian, dated August 21, 2009 β€” mwah, bye bestie, go wire up a keylock πŸ’‹βœ¨

πŸ“¦ where this page comes from