STRUCT INPUT_KEYMAP_ENTRY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct input_keymap_entry(9) β€” the kernel manual, but make it make sense

okay bestie, so this is a page from the Kernel API Manual, and it's about one lil struct named struct input_keymap_entry that the kernel uses to talk about keymaps. she's not a big celebrity struct, but she's iconic in her own way πŸŽ€


✨ NAME ✨

struct input_keymap_entry β€” the struct that's used by the EVIOCGKEYCODE/EVIOCSKEYCODE ioctls. that's literally her whole job, and she does it flawlessly πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole glow-up, exactly as she appears in the wild:

struct input_keymap_entry {
  #define INPUT_KEYMAP_BY_INDEX   (1 << 0);
    __u8 flags;
    __u8 len;
    __u16 index;
    __u32 keycode;
    __u8 scancode[32];
 };

like, she's serving struct realness. 32 bytes of scancode buffer. no notes. periodt ✨


🌸 Members 🌸

okay so these are the fields, and honestly each one is a lil main character:

  • flags β€” this is where you tell the kernel how she should handle the request. for example, setting the INPUT_KEYMAP_BY_INDEX flag indicates that the kernel should perform the lookup in the keymap by index instead of by scancode. so like, index girlies rise 🫢
  • len β€” the length of the scancode that resides in the scancode buffer. yes, she's literally just telling you how long the thing is. queen of clarity πŸ’…
  • index β€” the index in the keymap. this one may be used instead of scancode. she's the alternative route, the backup plan, the understudy that sometimes gets the lead role 😭
  • keycode β€” the key code assigned to this scancode. this is the whole point of the operation ngl πŸ”₯
  • scancode β€” scancode represented in machine-endian form. not network endian, not vibe endian, machine endian. write that down bestie πŸ“

πŸ’œ Description πŸ’œ

okay so boom β€” this structure is used to retrieve and modify keymap data. that's the tea β˜•

users have the option of performing a lookup either by the scancode itself or by index in the keymap entry. two paths, same destination, choose your fighter ✨

and EVIOCGKEYCODE will also return the scancode or the index β€” depending on which element was used to perform the lookup. so she mirrors your energy right back at you. reciprocal queen πŸ‘‘


🌈 SEE ALSO 🌈

the whole friend group, no cap:

  • Kernel file ./include/uapi/linux/input.h struct input_absinfo(9)
  • EVIOCGMTSLOTS(9)
  • EVIOCGMASK(9)
  • EVIOCSMASK(9)
  • struct ff_replay(9)
  • struct ff_trigger(9)
  • struct ff_envelope(9)
  • struct ff_constant_effect(9)
  • struct ff_ramp_effect(9)
  • struct ff_condition_effect(9)
  • struct ff_periodic_effect(9)
  • struct ff_rumble_effect(9)
  • struct ff_haptic_effect(9)
  • struct ff_effect(9)
ngl go read those too, the lore is deep and the structs are lowkey everything 🧚

and that's the page, bestie!! this one came from ./include/uapi/linux, dated October 2026 β€” so yeah, mark your calendars, screenshot it, send it to the group chat πŸ’Œ stay slay, stay machine-endian πŸ’…βœ¨

πŸ“¦ where this page comes from