comedi_buf_write_samples(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ comedi_buf_write_samples(9) πŸ‘‘

okay so bestie, welcome to the Kernel API Manual ✨ β€” yes, the actual kernel API manual, and yes, this page is about comedi_buf_write_samples(9) and it's lowkey iconic. Sit down, grab a strawberry πŸ“, let's get into it.


✨ NAME ✨

comedi_buf_write_samples β€” write sample data to the COMEDI buffer πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

unsigned int comedi_buf_write_samples (struct comedi_subdevice *s ,
const void *data , unsigned int nsamples );

like, that's the whole signature, no cap. πŸŽ€


🌸 ARGUMENTS 🌸

  • s β€” the COMEDI subdevice. it's the main character here, honestly πŸ‘‘
  • data β€” pointer to the source samples. this is where the good stuff lives 🫢
  • nsamples β€” number of samples to write. like, how many you wanna send ✨

πŸ’– DESCRIPTION πŸ’–

so here's the vibe: this function writes up to nsamples samples into the COMEDI acquisition data buffer that's associated with the subdevice. it marks the buffer as written, and it updates the acquisition scan progress too. multitasking queen πŸ‘‘

but wait β€” plot twist 😭 β€” if there isn't enough room for the number of samples you asked for, the number of samples actually written gets limited to whatever will fit. and then the COMEDI_CB_OVERFLOW event flag gets set, which causes the acquisition to terminate with an overrun error. it's giving dramatic exit πŸ’€ not a drill, that's literally what happens.

also: set the COMEDI_CB_BLOCK event flag if any samples are written β€” that's what causes waiting tasks to be woken when the event flags are processed. wake up besties, data's here 🌈


⭐ RETURN ⭐

the amount of data written, measured in bytes. that's it, that's the return value πŸŽ€


🧚 SEE ALSO 🧚

kernel file ./drivers/comedi/comedi_buf.c, plus these besties right here:

go read them, iykyk πŸ“šπŸ’œ


fr fr keep the overflow thing in mind β€” that overrun error is real and it will end your acquisition. stay safe out there πŸ’…

and that's the page! πŸ¦‹ big ups to ./drivers/comedi, dated October 2026, for the source/version β€” and the page itself is comedi_buf_write_samples(9), slay, periodt. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from