OpenWrt Forum Archive

Topic: uci c interface

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi All,

I am sure, someone must have explained in past, but I could not figure out from search. Need help on following:

I want to use uci c interface. I could not figure out where to start. Basically, I have two questions on this:

1. On NOR-FLASH addr 0xabcd0000, variable cfg_rom_1 is stored as INT <4 bytes>. Through C-interface I would like to read it.

2. I like to read and write configuration from /etc/config/voltile_config. But using C-interface.
    Shell script should be easy one.

Fundamentally I question may boil down to one : how do we use C-interface. A simple example will do a great favor for me.

<<Being novice, I must have asked question wrong way: sorry if so>>

Regards,
bharat

Hi Yanira,

Thanks a lot for the link.
I have done couple of things using this. Still I am not clear about hierarchy of pkg, section, element. *(&More is LIST).
Can you please give an idea of this:
1+++++++++++++++++++++
config ap testconfig
      option number 123
      option string     string
While reading it reads 123 as string and not number. Simple way is to strtoul. But, is there any elegant way of doing this using uci(map). I think.
2++++++++++++++++++++++
Can I have array. Like I have an array of IP address. How can I manipulate that using UCI.
currently I have done like this....
       option ip1 192.168.1.1
       option ip2 192.168.1.1
       option ip3 192.168.1.1
       option ip4 192.168.1.1
I am sure, this is very wrong approach. Can you please suggest something on this.
Regards,
Bxxt

The discussion might have continued from here.