Setting the sample rate for a device isn't a strictly normed operation in IIO. The examples previously relied on the trigger for a device to expose the sampling_frequency attribute that sets the sample frequency. However, this assumption doesn't hold for all sensors in the kernel. Some expose the sampling_frequency attribute on the device itself instead of the trigger.
These patches add some error handling to take care of these cases. If the sampling_frequency attribute can't be found on the device or its respective trigger, an error is thrown.
Looks good for now. I may tweak all the examples to have more control of things at the command line (like being explicit about which device to set the trigger)
Setting the sample rate for a device isn't a strictly normed operation in IIO. The examples previously relied on the trigger for a device to expose the
sampling_frequency
attribute that sets the sample frequency. However, this assumption doesn't hold for all sensors in the kernel. Some expose thesampling_frequency
attribute on the device itself instead of the trigger.These patches add some error handling to take care of these cases. If the
sampling_frequency
attribute can't be found on the device or its respective trigger, an error is thrown.