Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
Programmatically getting Linux device resource info

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.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Some suggestions:

  1. 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

  2. Find opensource tools that dump/use the info you are looking for and read the code

  3. Look into /proc, for example cpuinfo

over 4 years ago · Santiago Trujillo Report

0

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!