STRUCT COMEDI_KRANGE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct comedi_krange(9) β€” the Kernel API Manual glow-up

okay bestie so this is a page straight outta the Kernel API Manual, and it's all about struct comedi_krange πŸŽ€ β€” no cap, it's the little struct that "describes a range in a range table." that's the whole vibe. let's get into it πŸ’–


✨ SYNOPSIS ✨

like, here's the literal shape of it, copy it exactly ok don't freestyle πŸ’…

struct comedi_krange {
    int min;
    int max;
    unsigned int flags;
};

🫢 Members 🫢

  • min β€” the minimum value, but make it micro: it's in millionths (1e-6) of a unit. tiny numbers, big energy ✨
  • max β€” same deal, the maximum value in millionths (1e-6) of a unit 🌸
  • flags β€” this icon holds the units in bits 7:0, OR'ed together with any optional flags. so it's giving two-jobs-at-once πŸ’€

🌈 Description 🌈

okay so picture this: a range table is associated with a single channel, OR with all the channels in a subdevice, and it holds a list of one or more ranges. a struct comedi_krange is the lil guy that describes the physical range of units for each one of those ranges πŸ‘‘

here's the tea: sample values in COMEDI are unsigned, running from 0 all the way up to some 'maxdata' value. and the mapping from sample values to physical units is assumed to be nominally linear (for the purpose of describing the range, bestie, don't come for me) β€” with sample value 0 mapping to min, and the 'maxdata' sample value mapping to max. literally a straight line, slay πŸ“ˆ

the units that are currently defined are:

  • UNIT_volt (0)
  • UNIT_mA (1)
  • UNIT_none (2)

and the min and max values are the physical range multiplied by 1e6, so a max value of 1000000 (with UNIT_volt) represents a maximal value of 1 volt. yes bestie, a whole volt, we love to see it ⚑

the only defined flag value is RF_EXTERNAL (0x100), and it means the range needs to be multiplied by an external reference. iykyk πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, they're all in the kernel file ./include/uapi/linux/comedi.h, and honestly? iconic lineup:

  • 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_chaninfo(9)
  • struct comedi_rangeinfo(9)
  • struct comedi_subdinfo(9)
  • struct comedi_devinfo(9)
  • struct comedi_devconfig(9)
  • struct comedi_bufconfig(9)
  • struct comedi_bufinfo(9)

one last vibe check bestie: this page lives in ./include/uapi/linux, it's dated October 2026, and its title is struct comedi_krange(9). that's the whole sign-off, periodt πŸ’œ ✨ πŸŽ€
πŸ“¦ where this page comes from