STRUCT GPIO_V2_LINE_CONFIG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

struct gpio_v2_line_config β€” the glow-up config object for your GPIO lines, bestie πŸ’…

Like, it's the struct you fill out when you wanna tell the kernel exactly how you want your lines to behave. Keep reading, it's giving "important" and honestly it is. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct gpio_v2_line_config {
    __aligned_u64 flags;
    __u32 num_attrs;
    __u32 padding[5];
    struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
};

That's the whole vibe. Four fields. No notes. 🌸


πŸ’– MEMBERS πŸ’–

Ok so let's meet the cast, one by one, because each of them matters, no cap:

  • flags β€” the flags for the GPIO lines, and you get the values from enum gpio_v2_line_flag, like GPIO_V2_LINE_FLAG_ACTIVE_LOW, GPIO_V2_LINE_FLAG_OUTPUT etc β€” and you literally add them together. This is the default for all the requested lines, but bestie listen: it can be overridden for particular lines using attrs. So it's a default, not a forever-decision. 🫢
  • num_attrs β€” the number of attributes in attrs. Just a count. That's it. She's simple, she's iconic. ⭐
  • padding β€” reserved for future use and must be zero filled. Not "should", not "if you feel like it" β€” must. Zero-fill it or the vibe check fails, fr fr. 🚨
  • attrs β€” the configuration attributes associated with the requested lines. Big important rule incoming: any attribute should only be associated with a particular line once. And if an attribute is associated with a line multiple times, then the first occurrence (i.e. lowest index) has precedence. So the earliest one wins. First come, first served, periodt. πŸ‘‘
Real talk: that padding field is the one everyone forgets and then wonders why stuff breaks. Zero-fill it. I'm begging. 😭

🌈 SEE ALSO 🌈

Go read these next, they're all in the group chat together:

  • Kernel file ./include/uapi/linux/gpio.h
  • struct gpiochip_info(9)
  • enum gpio_v2_line_flag(9)
  • struct gpio_v2_line_values(9)
  • enum gpio_v2_line_attr_id(9)
  • struct gpio_v2_line_attribute(9)
  • struct gpio_v2_line_config_attribute(9)
  • struct gpio_v2_line_request(9)
  • struct gpio_v2_line_info(9)
  • enum gpio_v2_line_changed_type(9)
  • struct gpio_v2_line_info_changed(9)
  • enum gpio_v2_line_event_id(9)
  • struct gpio_v2_line_event(9)
  • struct gpioline_info(9)
  • struct gpioline_info_changed(9)
  • struct gpiohandle_request(9)
  • struct gpiohandle_config(9)
  • struct gpiohandle_data(9)
  • struct gpioevent_request(9)
  • struct gpioevent_data(9)

And that's the whole page, bestie!! ✨ This one came straight out of the source at ./include/uapi/linux, dated October 2026, and the header situation is Kernel API Manual β€” struct gpio_v2_line_config(9) and friends. Mwah. Go configure some lines, you've got this πŸ’œπŸ’–πŸŽ€

πŸ“¦ where this page comes from