STRUCT COMEDI_CHANINFO(9)
β¨ 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_listmember must beNULLunless theSDF_MAXDATAsubdevice flag is set. - The
flaglistmember must beNULLunless theSDF_FLAGSsubdevice flag is set. - The
rangelistmember must beNULLunless theSDF_RANGETYPEsubdevice 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms