hid_map_usage(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… hid_map_usage(9) β€” like, the Kernel API Manual page, bestie ✨

okay so picture this: you're deep in the kernel, you've got a struct hid_input * in one hand and a struct hid_usage * in the other, and you just need somebody to map that usage to the right input bits. that somebody is hid_map_usage. she's the plug. she's iconic. let's get into it πŸŽ€


🌸 NAME 🌸

hid_map_usage β€” map usage input bits (yes literally that's the whole job and she does it flawlessly, no cap)


✨ SYNOPSIS ✨

void hid_map_usage (struct hid_input *hidinput , struct hid_usage *usage
, unsigned long **bit , int *max , __u8 type , unsigned int c );

like, six args, all vibes, all necessary 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • hidinput β€” the hidinput we're interested in πŸ’– like, the one you actually care about, main character energy
  • usage β€” the usage you're gonna fill in, she's getting filled in (with data bestie, with data)
  • bit β€” a pointer to input->{}bit β€” it's an out parameter, so she writes back to you, generous queen
  • max β€” the maximal valid usage->code to consider later β€” also an out parameter, also coming back to you πŸ”₯
  • type β€” the input event type, like EV_KEY, EV_REL, ... you know the drill 🌈
  • c β€” the code that corresponds to this usage and this type, they go together fr fr

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea, and it's important tea:

the value pointed to by bit will be set to NULL if either type is an unhandled event type, or if c is out of range for type. 😭

and that's not a bug bestie, that's the whole point β€” you can literally use that as an error condition. NULL in bit = something went sideways, go handle it. 🚨

🧚 SEE ALSO 🧚

basically the whole HID friend group, go say hi πŸ’…βœ¨


and that's the page!! this one lives in ./include/linux, it's dated October 2026, and the header at the top says hid_map_usage(9) because obviously, it's her page πŸ‘‘ stay hydrated, read your manpages, mwah πŸ“πŸ’–

πŸ“¦ where this page comes from