cros_ec_get_next_event(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cros_ec_get_next_event(9) β€” the Kernel API Manual glow-up πŸ¦‹

okay so bestie, welcome to the cros_ec_get_next_event(9) page from the Kernel API Manual. this is the one that grabs the next event off the ChromeOS EC, and honestly it's giving "small function, big responsibility". let's get into it ✨


🌸 NAME 🌸

cros_ec_get_next_event β€” fetch the next event from the ChromeOS EC. that's it, that's the whole vibe 🫢


✨ SYNOPSIS ✨

int cros_ec_get_next_event (struct cros_ec_device *ec_dev , bool
*wake_event , bool *has_more_events );

like, copy it exactly, don't @ me, the spacing is load-bearing (jk, but also fr don't retype it by hand) 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • ec_dev β€” the device you're fetching the event from. your main character device, basically πŸ‘‘
  • wake_event β€” pointer to a bool that gets set to true on return if the event might be treated as a wake event. lowkey important for power stuff. and if it's null? ignored. literally doesn't care πŸ’€
  • has_more_events β€” pointer to a bool set to true if more than one event is pending. some ECs will set this flag to say "hey, you can call cros_ec_get_next_event multiple times in a row". it's an optimization, periodt β€” it stops you from issuing a EC command for nothing, or from waiting on another interrupt from the EC just to process the next message. also ignored if null πŸ™ˆ
ngl, that has_more_events one is the whole reason this is efficient. respect the flag 🫑

πŸ”₯ RETURN πŸ”₯

  • negative error code on errors 😭
  • 0 for no data 😢
  • or else the number of bytes received β€” i.e. an event was retrieved successfully, slay πŸ’…

on success, event types are written out to ec_dev->event_data.event_type. yes, exactly that path, character for character, don't come for me 🎯


🌈 SEE ALSO 🌈

Kernel file: ./drivers/platform/chrome/cros_ec_proto.c β€” go read the source, it's iconic ⭐

and the whole friend group:


that's the whole page bestie, go forth and fetch those events πŸ’– this came from ./drivers/platform/chrome, dated October 2026, and it's cros_ec_get_next_event(9) forever and always πŸ§šπŸ’œ

πŸ“¦ where this page comes from