enqueue_events(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… enqueue_events(9) β€” the kernel API manual, bestie edition

Okay so real talk: this is enqueue_events from the Kernel API Manual, section 9, and it's the lil function that takes EC events and drops them in the queue so userspace can finally read them. She's a middle man. She's a vibe courier. Let's get into it. πŸŽ€


✨ NAME ✨

enqueue_events β€” place EC events in queue to be read by userspace.

Yep, that's the whole job. She puts the events in the queue. Userspace reads them later. Slay, honestly. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int enqueue_events (struct device *dev , const u8 *buf , u32 length );

Three args, one int coming back at you. That's the whole signature, no notes. ✨


🌸 ARGUMENTS 🌸

  • dev β€” the device the events came from. Gotta know who's calling, right? 🫢
  • buf β€” the buffer of event data. This is where the actual events are chilling.
  • length β€” the length of the event data buffer. She needs to know how much buf there is, that's just math bestie.

🧚 DESCRIPTION 🧚

Okay so here's the tea. β˜•

buf contains a number of ec_event's, packed one after the other. Like sardines. Like besties in a photobooth. πŸŽ€

Each ec_event is of variable length β€” so no, you can't just assume they're all the same size and vibe-check your way through, that's not how this works.

The algorithm, in order,ε› δΈΊε₯Ή's thorough:

  1. Start with the first event.
  2. Copy it into a persistent ec_event.
  3. Store that entry in the queue.
  4. Move on to the next ec_event in buf.
  5. Repeat.

Copy, store, next, repeat. Copy, store, next, repeat. It's giving "loop with main character energy." πŸ”₯

The "persistent" part is doing a LOT of work there ngl β€” the event gets copied out so it survives, because buf is not gonna be around forever. πŸ™ˆ


🌈 RETURN 🌈

  • 0 β€” on success πŸŽ‰
  • negative error code β€” on failure 😭 (yeah she can fail, and when she does she reports back with a negative number, periodt)

πŸ‘‘ SEE ALSO πŸ‘‘

The kernel file ./drivers/platform/chrome/wilco_ec/event.c β€” that's the neighborhood this whole thing lives in, go say hi. 🏑

And the rest of the squad:

iykyk πŸ’œ


And that's the page, bestie! 🫢 Cute lil sign-off time: this one comes to you from ./drivers/platform/chrome/wilc... (yes it got cut off in the original, tragic, RIP) and it's dated October 2026. Live laugh love, and may your ec_events always be correctly parcelled out. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from