AnsweredAssumed Answered

libiio: How do I set the "test_mode" attribute in a C program?

Question asked by milosoftware on Dec 17, 2015
Latest reply on Dec 18, 2015 by pcercuei

I want to change the "test_mode" of the ADC in a C program to test the board. I create a network context, then a device context.


I tried variations like these, but nothing worked:

iio_device_attr_write(iio_dev, "in_voltage0_test_mode", "pn_short"); // returns -2 (ENOENT)
iio_device_attr_write(iio_dev, "test_mode", "pn_short"); // returns -2 (ENOENT)
iio_channel_attr_write(iio_device_get_channel(iio_dev, 0), "test_mode", "pn_short");  // Sleeps a few seconds, returns -11 (EAGAIN)

What are the incantations required?

I can write these values through sysfs (file name is "in_voltage0_test_mode") without problems. The iio osciloscope's debug program can also write it. Reading data from the device also works fine.