hid_map_usage(9)
π 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β thehidinputwe're interested in π like, the one you actually care about, main character energyusageβ the usage you're gonna fill in, she's getting filled in (with data bestie, with data)bitβ a pointer toinput->{}bitβ it's an out parameter, so she writes back to you, generous queenmaxβ the maximal validusage->codeto consider later β also an out parameter, also coming back to you π₯typeβ the input event type, likeEV_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.NULLinbit= something went sideways, go handle it. π¨
π§ SEE ALSO π§
- Kernel file
./include/linux/hid.hβ the source of truth, the mothership π HID quirks(9)struct hid_battery(9)struct hid_driver(9)struct hid_ll_driver(9)module_hid_driver(9)hid_device_io_start(9)hid_device_io_stop(9)hid_map_usage_clear(9)hid_parse(9)hid_hw_power(9)hid_hw_idle(9)hid_hw_may_wakeup(9)hid_hw_wait(9)hid_report_len(9)
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
- 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