STRUCT GPIO_V2_LINE_REQUEST(9)
๐ 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 theGPIO_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 linesnum_linesโ how many lines you're actually requesting in this request, i.e. the number of valid fields in thoseGPIO_V2_LINES_MAX-sized arrays. Set it to1if 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 ofnum_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 successfulGPIO_V2_GET_LINE_IOCTLoperation, 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
- nixpkgs unstable: linux-manual 7.3.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms