STRUCT GPIO_V2_LINE_REQUEST(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… NAME ๐Ÿ’…

struct gpio_v2_line_request โ€” okay bestie, this is literally the struct that holds all the info about you asking the kernel for some GPIO lines. It's giving "application form for pins" energy โœจ

(also hi, this is the struct gpio_v2_line_request(9) page from the Kernel API Manual, welcome ๐Ÿซถ)


โœจ SYNOPSIS โœจ

struct gpio_v2_line_request {
    __u32 offsets[GPIO_V2_LINES_MAX];
    char consumer[GPIO_MAX_NAME_SIZE];
    struct gpio_v2_line_config config;
    __u32 num_lines;
    __u32 event_buffer_size;
    __u32 padding[5];
    __s32 fd;
 };

๐ŸŽ€ Members ๐ŸŽ€

okay so let's go field by field, no skipping, we're doing this properly ๐Ÿ’–

  • offsets โ€” an array of the lines you want, each one specified by its offset index for the GPIO chip it belongs to. It's the GPIO_V2_LINES_MAX-sized guest list ๐ŸŽŸ๏ธ
  • consumer โ€” the consumer label you want for the lines you picked, like "my-bitbanged-relay". This is your ~aesthetic~ name tag so everyone knows who's using the pins, iconic ๐Ÿ’…
  • config โ€” the configuration you're requesting for the lines
  • num_lines โ€” how many lines you're actually requesting in this request, i.e. the number of valid fields in those GPIO_V2_LINES_MAX-sized arrays. Set it to 1 if you only want a single line, lowkey minimal of you ๐ŸŒธ
  • event_buffer_size โ€” a suggested minimum number of line events the kernel should buffer for you. Heads up: this only matters if edge detection is enabled in the configuration. And note โ€” it's only a suggestion, bestie ๐Ÿ˜ญ the kernel may allocate a larger buffer, or cap the size of the buffer. If this field is zero then the buffer size defaults to a minimum of num_lines * 16. Not me doing math at 2am ๐Ÿงฎ
  • padding โ€” reserved for future use and it must be zero filled. fr fr, zero it out ๐Ÿ™ˆ
  • fd โ€” after a successful GPIO_V2_GET_LINE_IOCTL operation, this contains a valid anonymous file descriptor representing the request. That's the payoff, the main character moment ๐Ÿ‘‘

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

Kernel file ./include/uapi/linux/gpio.h, plus the whole friend group: 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_config(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). periodt ๐Ÿ’œ


ngl the whole squad is listed above, go say hi, they're all in ./include/uapi/linux ๐Ÿ’€

okay that's the page!! this one came from ./include/uapi/linux, dated October 2026 โ€” slay, go request some lines bestie, you got this ๐ŸŒˆโญ๐ŸŽ€

๐Ÿ“ฆ where this page comes from