m1_temperature_sensor/readme.md

46 lines
1.5 KiB
Markdown
Raw Normal View History

2021-02-27 22:46:31 +00:00
# Temperature Sensor Monitor for Apple Silicon M1
2020-11-28 05:15:40 +00:00
2021-02-27 22:46:31 +00:00
- `temp_sensor.m`: modified on the Objective-C [code](https://github.com/freedomtan/sensors/blob/master/sensors/sensors.m) for iOS sensor by [freedomtan](https://github.com/freedomtan);
2020-11-28 05:15:40 +00:00
2021-02-27 22:46:31 +00:00
- `monitor.py`: a wrapper for `temp_sensor.m` output for monitoring temperature in the terminal.
2020-11-28 05:15:40 +00:00
## Usage
2021-02-27 22:46:31 +00:00
Compile `temp_sensor.m` (by `clang -Wall -v temp_sensor.m -framework IOKit -framework Foundation -o temp_sensor`, Xcode on M1 mac needed). Then
2020-11-28 05:15:40 +00:00
2021-02-27 22:46:31 +00:00
`./temp_sensor | ./monitor.py` or `./temp_sensor`
2020-11-30 00:00:23 +00:00
2021-02-27 22:46:31 +00:00
Only test with my Macbook air with M1. Please check your mac's `ioreg -lfx` output to make changes in `temp_sensor.m` if needed.
2020-11-28 05:15:40 +00:00
## References
2021-02-27 22:46:31 +00:00
For **better names** (e.g. what is `PMU TP3w` ?) for the sensors, please refer to
2020-11-28 05:15:40 +00:00
https://github.com/exelban/stats/blob/master/Modules/Sensors/values.swift
https://github.com/acidanthera/VirtualSMC/blob/master/Docs/SMCSensorKeys.txt
2020-11-28 05:32:25 +00:00
Here is a similar code in swift for getting sensor values using IOKit (for intel Mac)
2020-11-28 05:15:40 +00:00
https://github.com/exelban/stats/blob/master/Modules/Sensors/values.swift
2020-11-28 05:32:25 +00:00
For intel Mac, an easier way to get sensor infomation:
`sudo powermetrics`
2020-11-28 05:15:40 +00:00
2020-11-28 17:04:58 +00:00
## Demo: screen shot and screen record
- screen record : screen_record.mp4[1.4MB] or
2021-02-27 22:46:31 +00:00
![screen record](https://raw.githubusercontent.com/fermion-star/apple_sensors/master/demo/screen_record.low.gif)
2020-11-28 05:15:40 +00:00
2021-02-27 22:46:31 +00:00
- screen shot
![screen shot](https://raw.githubusercontent.com/fermion-star/apple_sensors/master/demo/screen_shot.png)
2020-11-28 05:23:17 +00:00
<!---
2020-11-28 15:10:19 +00:00
![screen record](screen_record.mp4)
2020-11-28 05:15:40 +00:00
2021-02-27 22:46:31 +00:00
![screen shot](screen_shot.png)
2020-11-28 05:23:17 +00:00
--->
2020-11-28 05:15:40 +00:00