STRUCT GPIO_MOUSE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ struct gpio_mouse(9) πŸ¦‹

okay bestie, welcome to the Kernel API Manual β€” we're doing struct gpio_mouse today and honestly? it's giving "small struct, big responsibility" ✨


🌸 NAME 🌸

struct gpio_mouse β€” (that's it, that's the name, the original page literally leaves the description blank and honestly? iconic. no notes. πŸ’…)


✨ SYNOPSIS ✨

struct gpio_mouse {
    u32 scan_ms;
    struct gpio_desc *up;
    struct gpio_desc *down;
    struct gpio_desc *left;
    struct gpio_desc *right;
    struct gpio_desc *bleft;
    struct gpio_desc *bmiddle;
    struct gpio_desc *bright;
 };

like, look at her. seven pointers and a u32. she's perfect 🫢


πŸŽ€ Members πŸŽ€

so bestie, here's the roster, one by one, no skips:

  • scan_ms β€” the scan interval in milliseconds. yes, the only member that isn't a pointer. she's the main character here ngl πŸ‘‘
  • up β€” GPIO line for the up value. ⬆️
  • down β€” GPIO line for the down value. ⬇️
  • left β€” GPIO line for the left value. ⬅️
  • right β€” GPIO line for the right value. ➑️
  • bleft β€” GPIO line for the left button. (the b is for button, iykyk πŸ–±οΈ)
  • bmiddle β€” GPIO line for the middle button. πŸ–±οΈ
  • bright β€” GPIO line for the right button. (and not "bright" like the light, it's b + right, don't let the name jump-scare you fr fr 😭)
vibe check: four of these are directions, three are buttons, and one is a millisecond number. memorize the difference and you're slaying.

πŸ’œ Description πŸ’œ

so here's the tea β˜• β€” this struct must be added to the platform_device in the board code. like, not optional, not "if you feel like it", it must be there.

and what's it for? it's used by the gpio_mouse driver to do two things:

  1. setup GPIO lines
  2. calculate mouse movement

that's the whole job. she sets up the lines, she does the math on the movement, she goes home. periodt. πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./drivers/input/mouse/gpio_mouse.c β€” go read the source, bestie, it's right there, it's free, it's educational 🌈

and that's the whole page!! go forth and build your tiny GPIO mouse, you absolute icon πŸ§šπŸ’–

mwah πŸ’‹ β€” this little dispatch came to you from ./drivers/input/mouse, dated October 2026, and yes she's still serving struct gpio_mouse(9) realness. byeee πŸŽ€βœ¨

πŸ“¦ where this page comes from