STRUCT IIO_CHAN_SPEC(9)
β¨ struct iio_chan_spec(9) β¨
okay bestie, so this is the Kernel API Manual entry for struct iio_chan_spec and it's literally the blueprint for one single IIO channel β like, the whole personality of a channel lives in this struct π
πΈ NAME πΈ
struct iio_chan_spec β specification of a single channel
π¦ SYNOPSIS π¦
struct iio_chan_spec {
enum iio_chan_type type;
int channel;
int channel2;
unsigned long address;
int scan_index;
union {
struct iio_scan_type scan_type;
struct {
const struct iio_scan_type *ext_scan_type;
unsigned int num_ext_scan_type;
};
};
unsigned long info_mask_separate;
unsigned long info_mask_separate_available;
unsigned long info_mask_shared_by_type;
unsigned long info_mask_shared_by_type_available;
unsigned long info_mask_shared_by_dir;
unsigned long info_mask_shared_by_dir_available;
unsigned long info_mask_shared_by_all;
unsigned long info_mask_shared_by_all_available;
const struct iio_event_spec *event_spec;
unsigned int num_event_specs;
const struct iio_chan_spec_ext_info *ext_info;
const char *extend_name;
const char *datasheet_name;
unsigned int modified:1;
unsigned int indexed:1;
unsigned int output:1;
unsigned int differential:1;
unsigned int has_ext_scan_type:1;
};
π Members π
ok so let's go field by field, no skips, we're doing the whole thing π«Ά
typeβ tells you what kind of measurement this channel is doing. the whole vibe check of the channel basically πchannelβ the number we wanna assign to this channel, like its little name tag πchannel2β if a differential channel has a second number, this is where it goes. and ifmodifiedis set, the value in here is the modifier, iykyk β¨addressβ a driver-specific identifier. lowkey just a lil fingerprint for the driver πscan_indexβ a monotonic index that gives ordering in scans when you're reading from a buffer. it's giving "line order but make it silicon" π{unnamed_union}β anonymous. no name, all mystery πscan_typeβ a struct describing the scan type β and heads up bestie, this is mutually exclusive withext_scan_typeβ οΈ{unnamed_struct}β anonymous. again. mysterious icon behavior π§ext_scan_typeβ used in the rare cases where there's more than one scan format for a channel. when you use this, thehas_ext_scan_typeflag must be set, and the driver must implementget_current_scan_typeinstruct iio_info. no cap, both requirements fr fr π₯num_ext_scan_typeβ number of elements inext_scan_typeinfo_mask_separateβ what information gets exported that's specific to this channel πinfo_mask_separate_availableβ what availability information gets exported that's specific to this channelinfo_mask_shared_by_typeβ what information gets exported that's shared by all channels of the same typeinfo_mask_shared_by_type_availableβ what availability information gets exported that's shared by all channels of the same typeinfo_mask_shared_by_dirβ what information gets exported that's shared by all channels of the same directioninfo_mask_shared_by_dir_availableβ what availability information gets exported that's shared by all channels of the same directioninfo_mask_shared_by_allβ what information gets exported that's shared by all channels, periodt πinfo_mask_shared_by_all_availableβ what availability information gets exported that's shared by all channelsevent_specβ array of events that should be registered for this channel πnum_event_specsβ size of theevent_specarrayext_infoβ array of extended info attributes for this channel. the array isNULLterminated, so the last element should have itsnamefield set toNULLβ don't forget or it's gonna be a whole situation πextend_nameβ lets you label channel attributes with an informative name. note this has no effect on codes etc, unlike modifiers. this field is deprecated in favour of providingiio_info->read_labelto override the label β which, unlikeextend_name, does not affect sysfs filenames. so yeah, it's giving "old but still here" πdatasheet_nameβ a name used in in-kernel mapping of channels. it should correspond to the first name the channel is referred to by in the datasheet (e.g.IND), or the nearest possible compound name (e.g.IND-INC). literally just match the datasheet bestie πmodifiedβ does a modifier apply to this channel? what those are depends on the channel type. the modifier is set inchannel2. examples areIIO_MOD_Xfor axial sensors about the 'x' axis π«indexedβ specifies the channel has a numerical index. if not, the channel index number will be suppressed for sysfs attributes β but not for event codes π«Άoutputβ channel is outputdifferentialβ channel is differentialhas_ext_scan_typeβtrueifext_scan_typeis used instead ofscan_typeβ
π SEE ALSO π
you might also vibe with these icons β¨
Kernel file ./include/linux/iio/iio.h struct iio_chan_spec_ext_info(9), struct iio_enum(9), IIO_ENUM(9), IIO_ENUM_AVAILABLE(9), struct iio_mount_matrix(9), IIO_MOUNT_MATRIX(9), struct iio_event_spec(9), IIO_SCAN_FORMAT_SIGNED_INT(9), IIO_SCAN_FORMAT_UNSIGNED_INT(9), IIO_SCAN_FORMAT_FLOAT(9), struct iio_scan_type(9), iio_channel_has_info(9), iio_channel_has_available(9), struct iio_info(9), struct iio_buffer_setup_ops(9), struct iio_dev(9), iio_device_register(9), devm_iio_device_register(9), iio_device_claim_direct(9), iio_device_release_direct(9), iio_device_try_claim_buffer_mode(9), iio_device_release_buffer_mode(9), IIO_DEV_ACQUIRE_DIRECT_MODE(9), IIO_DEV_ACQUIRE_FAILED(9), IIO_DEV_GUARD_CURRENT_MODE(9), iio_device_put(9), dev_to_iio_dev(9), iio_device_get(9), iio_device_set_parent(9), iio_device_set_drvdata(9), iio_device_get_drvdata(9), IIO_DECLARE_BUFFER_WITH_TS(9), IIO_DECLARE_DMA_BUFFER_WITH_TS(9), IIO_DECLARE_QUATERNION(9), iio_get_debugfs_dentry(9), iio_device_suspend_triggering(9), iio_device_resume_triggering(9), iio_get_current_scan_type(9), iio_get_masklength(9), iio_for_each_active_channel(9), IIO_DEGREE_TO_RAD(9), IIO_RAD_TO_DEGREE(9), IIO_G_TO_M_S_2(9), IIO_M_S_2_TO_G(9)
and that's the whole thing bestie, slay π this gem right here comes from the kernel API manual, sourced from ./include/linux/iio, dated October 2026 β so yeah, future iconic behavior, we love to see it πΈβ¨
π¦ 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