ir_mce_kbd_encode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ir_mce_kbd_encode(9)

okay so bestie, welcome to the Kernel API Manual β€” yes, the actual kernel, and yes, this is the page that teaches you how to encode a scancode into a stream of raw IR events. it's giving "i speak fluent infrared" energy and honestly? iconic. πŸ¦‹


✨ NAME ✨

ir_mce_kbd_encode β€” Encode a scancode as a stream of raw events πŸ“‘

like, you hand it a scancode, and it hands you back a whole lil stream of raw events. match made in heaven, fr fr.


🌸 SYNOPSIS 🌸

int ir_mce_kbd_encode (enum rc_proto protocol , u32 scancode , struct
      ir_raw_event *events , unsigned int max );

read it like a recipe, babes β€” four ingredients, one int coming back out the other side. πŸŽ€


πŸŽ€ ARGUMENTS πŸŽ€

  • protocol β€” the protocol to encode. this is the one telling us which flavour of IR we're cooking with πŸ’…
  • scancode β€” the scancode to encode. the star of the show, the main character, the whole point πŸ‘‘
  • events β€” array of raw ir events to write into. this is the lil canvas you're painting on 🎨
  • max β€” maximum size of events. the vibe check on how much room you actually have 🫢

πŸ’€ RETURN πŸ’€

the number of events written. that's it, that's the win. ✨

but if there isn't enough space in the array to fit the encoding, you get -ENOBUFS 😭 β€” and ngl, in that case all max events will have been written, so like… it tried its best, it really did. πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./drivers/media/rc/ir-mce_kbd-decoder.c
  • ir_mce_kbd_decode(9) β€” the decoding counterpart, the other half of the duo, the enemies-to-lovers of kernel IR code πŸ’œ

lowkey a reminder that -ENOBUFS still writes everything up to max β€” so check that return value, bestie, don't just vibe past it πŸ’€

that's the whole page, periodt. 🌈 source vibes come from ./drivers/media/rc, dated October 2026, and the page itself is ir_mce_kbd_encode(9) β€” slay, go forth and encode responsibly πŸ”₯πŸ‘‘

πŸ“¦ where this page comes from