I was given some resource list to get value of them programmatically in C. Although I know these are too specific and is not really important or generic, still due to my intelligent boss, I just wanted to have opinion about the list. Remember it may run in any type of Linux based device , may be desktop, laptop even in embedded devices like rpi or edison, gallileo
SERIAL_NO /*vendor specific*/
BATTERY_LEVEL /*not generic*/
HEAP /*only program specific*/
CPU_FREQUENCY /*vendor specific register*/
PROCESSOR_TYPE /*vendor specific register*/
PROCESSOR_SPEED /*vendor specific register*/
STORAGE /*I am not really sure*/
MODEL /*vendor specific register*/
IMEI /*vendor specific driver, not generic*/
DEVICE_TYPE /*vendor specific register*/
ALTITUDE /*vendor specific sensor, not generic*/
SPEED /*vendor specific sensor*/
BEARING /*vendor specific*/
If anyone have any suggestion, be it technical or strategic, please advice me. Tired of such illogical requirements. Sorry if anyway I violated SO rules.
Some suggestions:
Find tools that dump/use the info you are looking for and strace
them to get an idea on where to look for this info
Find opensource tools that dump/use the info you are looking for and read the code
Look into /proc, for example cpuinfo
It also depends on what are the types of the devices you're interesting (network adaptor, block device etc). For many of them the usual way to get some info can be the sysctl which provides you a native C API which means the solution is supposed to be portable between all platforms supporting this device. So, what you may do is to search what exact driver handles your device and see what sysctls it supports. For this you need either read its header file[s], or its implementation or its doc if present. man sysctl for reference. However I don't know any kind of a "generic" way to get info of a random device.