2

I need get CPU voltage and temperature from /sys/class/hwmon but need find the CPU ID to find the correct directory, by example:

$ ll /sys/class/hwmon/hwmon2/device
lrwxrwxrwx 1 root root 0 sep  3 13:05 /sys/class/hwmon/hwmon2/device -> ../../../0000:2f:00.0/

How to see what device is 0000:2f:00.0?, i find in /sys/devices/cpu but can not found the hardware id, lspci and lsusb can not show the CPU hardware.

The idea is get values without non native methods in Linux systems like as Ubuntu or Android.

Dave M
  • 4,494
  • 21
  • 30
  • 30
e-info128
  • 159
  • 1
  • 8

1 Answers1

5

Some commands to get hardware(CPU) info(Some need addition package installation and some are dependent on OS type)

  1. sudo dmidecode -t 4 or sudo dmidecode --type processor
  2. cat /proc/cpuinfo
  3. lscpu
  4. cpuid
  5. sudo lshw -C CPU
  6. hwinfo --cpu
  7. nproc
  8. rdmsr
  9. lm_sensors
Tero Kilkanen
  • 34,499
  • 3
  • 38
  • 58
asktyagi
  • 2,401
  • 1
  • 5
  • 19
  • Thanks, but dmidecode require elevated privilegies, cpuinfo has not the voltage or hardware id, lscpu depends to language (spanish in my case) is hard set a grep for filter info and get only relevant data, cpuid work fine but in android is not found the command, the repository of cpuid says "A simple CPUID decoder/dumper for x86/x86_64", not arm or other architectures. I need create a application for view cpu stat using a UI, but need get the voltage of the cpu. – e-info128 Sep 04 '22 at 05:05
  • 1
    I am not sure if we have standard way to pull sensors reading from both system and android because these readings are low level and most of the time platform is different can't do with single command. I added two more commands `rdmsr` and `lm_sensors`. Please check if those can help you by chance. – asktyagi Sep 04 '22 at 06:33
  • Thanks, but the two commands are not available in android :( – e-info128 Sep 04 '22 at 10:25
  • 3
    @e-info128 you said Linux not Android. I don't think Android is even on topic here since it isn't used in professional environments as far as I know. If you are asking about Android, you should probably delete this and ask on either [android.se] or [linux.se] instead. As for the language, you can get anything in English if you run `LC_ALL=C command`, so for example: `LC_ALL=C lscpu`. – terdon Sep 04 '22 at 10:59
  • 3
    @terdon: Android has some professional uses, but not as a server operating system. – John Dallman Sep 04 '22 at 15:35