Re: active_scan_mask
From: Henk Medenblik <hidden>
Date: 2021-05-27 10:06:21
Dear Alexandru,
That should be happening in drivers/iio/industrialio-buffer.c in the iio_enable_buffers() function. The channels get enabled by writing via sysfs in /sys/bus/iiio/devices/iio:deviceX/scan_elements in the _en files. libiio typically does this manipulation of files for you
I thought so too and I can confirm that when I switch back to less channels that the others are disabled. However the scanmask is not updated. See some logging here trying to debug: Session 1, read 8 channels: iio_readdev -b 262144 -s 1024 iio:device0 voltage0 voltage1 voltage2 voltage3 voltage4 voltage5 voltage6 voltage7 > /mnt/test6.bin 8 active channels [ 513.529510] acq_buffer_preenable [ 513.529521] active scan mask: 0x000000FF [ 513.558286] acq_buffer_postenable [ 513.716868] acq_buffer_predisable Session 2, read 16 channels: iio_readdev -b 262144 -s 1024 iio:device0 voltage0 voltage1 voltage2 voltage3 voltage4 voltage5 voltage6 voltage7 voltage8 voltage9 voltage10 voltage11 voltage12 voltage13 voltage14 voltage15 > /mnt/test6.bin 16 active channels [ 523.834056] acq_buffer_preenable [ 523.834067] active scan mask: 0x0000FFFF [ 523.880440] acq_buffer_postenable [ 524.041383] acq_buffer_predisable Session3 , read 8 channels again: iio_readdev -b 262144 -s 1024 iio:device0 voltage0 voltage1 voltage2 voltage3 voltage4 voltage5 voltage6 voltage7 > /mnt/test6.bin 8 active channels [ 532.002019] acq_buffer_preenable [ 532.002030] active scan mask: 0x0000FFFF [ 532.048375] onr_acq_buffer_postenable [ 532.131081] onr_acq_buffer_predisable
so, are you using an Analog Devices kernel? or is this a vanilla mainline kernel? and which version? ADI has some custom patches that deal with this some scanmask manipulation; is this being reproduced purely with libiio? and which version of libiio? steps to reproduce? i'm still not sure if the issue is in kernel or in libiio;
Yes I am using a adi 4.14 kernel, git tag adi-4.14.0 15e1a16477 For iio_readdev I am currently using the v0.21 zerocopy checkout Henk