permanently set ADC pins

hey guys,

I’m trying to read some voltages from ADC pins.
I have been using this code to set the pins. echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots
It works, but whenever I restart my BBB, I have to type this code again.

Can I set it permanently?

well I tried this from my c++ code.

#include

#include

#include<unistd.h>

using namespace std;

int main() {

system(“echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots”);

return 0;

}

but it doesnt work

modified uEnv.txt file located in /boot/uboot

optargs=capemgr.enable_partno=BB-UART1,BB-UART4,cape-bone-iio

didnt work

I am not sure if this helps, but i had a similar requirement to update the slots file after boot and this is how I achieved it:

  1. wrote a .sh script
  2. call the .sh script from cron at reboot.

Contents of hkgpiotest1cape.sh
#!/bin/sh -
echo HK-GPIO-Test1 > /sys/devices/bone_capemgr.8/slots

Contents of cron:

root@beaglebone:~# crontab -l
@reboot /home/root/hkgpiotest1cape.sh

Thanks,
Hitesh