Controlling gpio using LIBIIO


I am using ADRV 9361- z7035 eb. Running the analog devices Linux kernel in it and iio oscilloscope in the remote system. I am trying to create a new plugin to the iio - oscilloscope for my test purpose. I need to control the gpio LEDs from that plug in. I was able to create a plugin with already available options.

Now i want to add the LED control functionality to it. How can i do it.

i was able to turn on and off the LED by echoing 1 and 0 to the file from the board itself.

echo 966 > /sys/class/gpio/export 
echo out > /sys/class/gpio/gpio966/direction
echo 1 > /sys/class/gpio/gpio966/value

Is there a way that i will be able to control this gpio led from the plugin.

How to create a sysfs file for that. How to add it to a channel. Any suggestions will be helpful.

Thank you.