sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.74k stars 311 forks source link

Apple Silicon M1 compatibility #453

Closed sebhildebrandt closed 3 years ago

sebhildebrandt commented 3 years ago

New Apple silicon hardware (M1) just arrived πŸ‘ I already checked compatibility and made first fixes. Here I provide a list, what is already working and what still needs to be fixed.

All tests are done with native nodejs installation

Installation

System

CPU

Memory

Battery

Graphics

Operating System

Processes and Services

File System

Network / Wifi

Docker

Testet with Tech Preview of Docker Desktop for M1 (Dec. 16, 2020)

Virtual Box

Current status of System Information version 4.31.0

2911quocanh commented 3 years ago

Hh

2911quocanh commented 3 years ago

New Apple silicon hardware (M1) just arrived πŸ‘

I already checked compatibility and made first fixes. Here I provide a list, what is already working and what still needs to be fixed.

All tests are done with native nodejs installation

  • node -v : v15.4.0

  • os.platform(): 'darwin'

  • os.arch(): 'arm64'

Installation

  • [x] Installation

System

  • [x] system

  • [x] bios

  • [x] baseboard

  • [x] chassis

CPU

  • [x] cpu -- detects M1 chip but speed was shown ... fixed

  • [x] cpuFlags ... no flags shown which is ok.

  • [x] cpuCache

  • [x] cpuCurrentSpeed ⚠️ always showed 0.03 ... fixed (but always returns fixed values)

  • [ ] cpuTemperature πŸ›‘ not working. osx-temperature-sensor package does not return correct values. Needs further investigation

Memory

  • [x] mem

  • [x] memLayout -- was empty ... fixed

Battery

  • [x] battery

Graphics

  • [x] graphics: !improvement possible: detects Apple M1 chip but vramDynamic should be true ... fixed

  • [x] displays

Operating System

  • [x] osInfo

  • [x] uuid

  • [x] versions

  • [x] shell

  • [x] users

Processes and Services

  • [x] currentLoad

  • [x] fullLoad

  • [x] processes

  • [x] services

File System

  • [x] diskLayout

  • [x] blockDevices

  • [x] disksIO

  • [x] fsSize

  • [x] fsOpenFiles

  • [x] fsStats

Network / Wifi

  • [x] networkInterfaces

  • [x] networkInterfaceDefault

  • [x] networkGatewayDefault

  • [x] networkStats

  • [x] networkConnections

  • [x] inetChecksite

  • [x] inetLatency

  • [x] wifiNetworks

Docker

Testet with Tech Preview of Docker Desktop for M1 (Dec. 16, 2020)

  • [x] dockerInfo

  • [x] dockerContainers

  • [x] dockerContainerProcesses

  • [x] dockerAll

Virtual Box

  • [ ] vboxInfo πŸ›‘ Virtual Box is currently not available for Apple Silicon M1 ARM platform. Not expecting to be able to test this soon.

Current status of System Information version 4.31.0

LeeCheneler commented 3 years ago

You're right osx-temperature-sensor doesn't seem to support M1 temperature sensors. This is because it uses SMC to obtain the values and SMC is not on M1 as its an Intel thing I believe.

I could obtain them using this https://github.com/fermion-star/apple_sensors. You need to compile and run it and then It returns the values of all temperature sensors as a stream to stdout. Looking at the implementation (2 files) might be useful in supporting M1 CPU temps.

dehydratedpotato commented 3 years ago

@LeeCheneler @sebhildebrandt Here's an easy way it can be done with a binary...

const path = require("path")
const binary = path.join(__dirname, '/path/to/binary')
const { exec } = require("child_process");

 // containing binary call in string in case your binary needs args, like the above linked one. It's args are v (for values) and n (for names), no hyphens.
exec(`${binary}`, (error, stdout, stderr) => {
        if (stdout) {
                console.log(stdout)  //  log the stdout here or do whatever formatting you need to apply to the output
        } else {
                console.log(stderr)
                console.log(error)
        }
})

The binary from this repo is a pretty good one. It uses a modified fermion-star/apple_sensors.

Just be aware that if you want to split the binary's dirty output into an array, say using (stdout).split("_"), the last item in the array will be NaN due to a side effect from a while loop containing printf("\n"); in the source code; so if you do format your output, you'll probably want to pop() the array.

πŸ‘

dehydratedpotato commented 3 years ago

Also, in the osx-temperature-sensor module -- if you want to keep pulling from SMC for Intels but use a different method for Apple Silicon, you could have an if statement to check the system arch using os.arch(). If it returns x64, use the traditional SMC method. Otherwise, if it gives arm64, we know it's Apple Silicon, so then use whatever other method to grab the temp sensor values.

bubez81 commented 7 months ago

hello! any news about the temperature problem in M1 or M2?