On Wed, May 26, 2021 at 11:18 PM Henk <iio-developer@xxxxxxxxxx> wrote: > > Dear all, > > I created a custom IIO device in FPGA which in fact contains a bunch of > ADC channels which I can acquire and stream to disk. I use analog > devices' libiio and specifically their iio_readdev application together > with my custom FPGA design and custom iio kernel driver. > > Question: what mechanism is updating the indio_dev->active_scan_mask field. 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 > > With the iio_readdev application I can add command arguments where I can > activate the channels that I want to retrieve (voltage0 voltage1 > ...etc). When I use 8 channels as command argument in iio_readdev then > the active_scan_mask seems to be updated with the enabled channels. When > adding even more channels the field is extended. However, when trying to > acquire new data and dropping some of the channel arguments then the > active_scan_mask field does not seem to revert back to the less enabled > (or requested) channels. > > So.. I am searching which mechanisms updates that field with the aim to > fix that bug. 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; > > Any help is appreciated. > > Kind regards > > Henk >