reading ADC by IIO

Dear Sirs

I’m running 3.8.13-bone70 and I want to read from the ADC at a reasonably high speed with from a userspace C program.

Now, I can read the values both from “/sys/bus/iio/devices/iio:device0/in_voltage*_raw” and from “/sys/devices/ocp./helper./AIN*” just fine so I know the proper modules and the cape are loaded.

It seems that a commonly mentioned example how to do what I’m trying to do is “drivers/staging/iio/Documentation/generic_buffer.c” but it fails for me when its code is trying to determine which channels are enabled. I checked the source and this happens precisely because the library is looking for “in_voltageX_en” files in the “…/devices/iio:device0/scan_elements” directory. It cannot find any because the “scan_elements” directory is missing and I cannot create it manually because it’s in /sys. Similarly the “…/devices/iio:device0/buffer” is not there and I see it mentioned in some examples.

So am I missing a kernel module or am I not further enabling the driver somewhere so that this directory is not created automatically? Maybe my approach is completely wrong and there are other good ways to read ADC? I guess I could just read the values from the filesystem but I fear there would be much overhead that way and also frankly I just want to learn how the IIO works…