iio_convert_...to_processed(9)
β¨ iio_convert_...to_processed(9) β¨
okay bestie, so this one's from the Kernel API Manual and it's lowkey one of the most useful little gremlins in the IIO toolbox π it's called iio_convert_raw_to_processed and it does exactly what it says on the tin β no cap, fr fr.
πΈ NAME πΈ
iio_convert_raw_to_processed β bestie, it converts a raw value to a processed value. that's the whole gig. iconic behaviour only. π
π¦ SYNOPSIS π¦
int iio_convert_raw_to_processed (struct iio_channel *chan , int raw ,
int *processed , unsigned int scale );
look at that signature, she's gorgeous ππ«Ά
π ARGUMENTS π
chanβ the channel you're querying, like "hey girl what's your deal"rawβ the raw IIO value you wanna convert (the feral device-flavoured number)processedβ where the converted result lands, a.k.a. the glow-up β¨scaleβ the scale factor you apply during the conversion, i.e. how much extra precision you're asking for π
π DESCRIPTION π
So. It returns an error code or 0. that's it, that's the return. 0 = we ate, error code = we did not π
Now, the actual tea: this function converts a raw value to a processed value for a specific channel. And here's the distinction that you literally need to know β
A raw value is the device internal representation of a sample, and it's also the value returned by iio_read_channel_raw. so the unit of that value is, and I cannot stress this enough, device depended π (yes, that's how the original says it, we're quoting the vibe).
A processed value, on the other hand, is a value that has a normed unit according with the IIO specification. she has standards. she has a defined unit. main character energy fr fr π
And the scale factor? it lets you increase the precession of the returned value π§ (yes, "precession" β that's the source, we don't fix it, we respect it π ).
So like, for a scale factor of 1 the function will return the result in the normal IIO unit for the channel type β e.g. millivolt for voltage channels. But if you want nanovolts instead? pass 1000000 as the scale factor. slay. π
π bestie warning: don't guess at the units β the raw one is device-depended, remember? read the spec, know the channel type, stay safe out there.
β SEE ALSO β
these are the siblings, the whole family tree, and ngl it's giving "big Italian family at dinner" ππ β they all live in the Kernel file ./include/linux/iio/consumer.h:
struct iio_channel(9)iio_channel_get(9)iio_channel_release(9)devm_iio_channel_get(9)iio_channel_get_all(9)iio_channel_release_all(9)devm_iio_channel_get_all(9)fwnode_iio_channel_get_by_name(9)devm_fwnode_iio_channel_get_by_name(9)iio_channel_get_all_cb(9)iio_channel_cb_set_buffer_watermark(9)iio_channel_release_all_cb(9)iio_channel_start_all_cb(9)iio_channel_stop_all_cb(9)iio_channel_cb_get_channels(9)iio_channel_cb_get_iio_dev(9)iio_read_channel_raw(9)iio_read_channel_average_raw(9)iio_read_channel_processed(9)iio_read_channel_processed_scale(9)iio_write_channel_attribute(9)iio_read_channel_attribute(9)iio_write_channel_raw(9)iio_read_max_channel_raw(9)iio_read_min_channel_raw(9)iio_read_avail_channel_raw(9)iio_read_avail_channel_attribute(9)iio_get_channel_type(9)iio_read_channel_offset(9)iio_read_channel_scale(9)iio_multiply_value(9)iio_get_channel_ext_info_count(9)iio_read_channel_ext_info(9)iio_write_channel_ext_info(9)iio_read_channel_label(9)
and that's the whole page, bestie β go forth and convert responsibly πβ¨
sign-off tea: this one's from ./include/linux/iio, dated October 2026, and the page itself is iio_convert_...to_processed(9). mwah. π«Ά
π¦ 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