STRUCT COMEDI_CHANINFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct comedi_chaninfo(9) ✨

okay bestie, so this is a page from the Kernel API Manual and it's literally all about struct comedi_chaninfo β€” the little struct that gets you the per-channel tea for a subdevice. no cap, it's giving "backstage pass to every channel's business" πŸ’…


🌸 NAME 🌸

struct comedi_chaninfo β€” the struct you use to retrieve per-channel information 🫢


πŸŽ€ SYNOPSIS πŸŽ€

struct comedi_chaninfo {
    unsigned int subdev;
    unsigned int __user *maxdata_list;
    unsigned int __user *flaglist;
    unsigned int __user *rangelist;
    unsigned int unused[4];
 };

πŸ¦‹ Members πŸ¦‹

  • subdev β€” the subdevice index. like, which subdevice we're talking about πŸ‘‘
  • maxdata_list β€” an optional pointer to per-channel maximum data values ✨
  • flaglist β€” an optional pointer to per-channel flags 🚩
  • rangelist β€” an optional pointer to per-channel range types 🌈
  • unused β€” reserved for future use. it's just sitting there, minding its business, vibing in the wings πŸ’œ

πŸ’– Description πŸ’–

So here's the situation: this struct gets used with the COMEDI_CHANINFO ioctl to grab per-channel info for the subdevice. lowkey important detail though β€” to use it at all, you need to already know the number of channels and the subdevice flags, and you get those from the COMEDI_SUBDINFO ioctl. so it's a "you need the info to get the info" kind of era πŸ”₯

Now the rules, and bestie listen, these are mandatory, not suggestions:

  • The maxdata_list member must be NULL unless the SDF_MAXDATA subdevice flag is set.
  • The flaglist member must be NULL unless the SDF_FLAGS subdevice flag is set.
  • The rangelist member must be NULL unless the SDF_RANGETYPE subdevice flag is set.

Otherwise β€” as in, when those flags are set β€” the arrays they point to must be at least as long as the number of channels. no cutting corners, the arrays gotta be long enough, periodt πŸ’€

🫢 friendly reminder: those three members are pointers into user space (unsigned int __user *), so be normal about it.

🌟 SEE ALSO 🌟

Kernel file ./include/uapi/linux/comedi.h plus a whole friend group of siblings, iykyk:

  • enum comedi_subdevice_type(9)
  • enum comedi_io_direction(9)
  • enum configuration_ids(9)
  • enum comedi_digital_trig_op(9)
  • enum comedi_support_level(9)
  • enum comedi_counter_status_flags(9)
  • struct comedi_insn(9)
  • struct comedi_insnlist(9)
  • struct comedi_cmd(9)
  • struct comedi_rangeinfo(9)
  • struct comedi_krange(9)
  • struct comedi_subdinfo(9)
  • struct comedi_devinfo(9)
  • struct comedi_devconfig(9)
  • struct comedi_bufconfig(9)
  • struct comedi_bufinfo(9)

and that's the whole page, bestie πŸ§šπŸ’« this iconic little writeup lives in ./include/uapi/linux and it's dated October 2026 β€” go read the siblings next, mwah πŸ’‹ struct comedi_chaninfo(9) 4ever πŸŽ€

πŸ“¦ where this page comes from