beltex / SMCKit

Apple SMC library & tool
https://beltex.github.io/SMCKit
MIT License
473 stars 55 forks source link

Ability to list unknown temperature sensors #17

Closed MichalMMac closed 9 years ago

MichalMMac commented 9 years ago

Feature request

Would it be possible fot smckit to display all SMC registers similiary to smc -l?

perfaram commented 9 years ago

AFAIK, not currently... I'm going to try :+1:

beltex commented 9 years ago

Hi @MichalMMac!

@perfaram is correct, SMCKitTool does not currently do this. It certainly could though, but I’m wondering, what would be the value in having such an option? Or rather, what would you like to use it for?

I saw your comment about wanting to do temperature monitoring. If thats the case, then dshb is the tool you want. SMCKitTool does the same via smckit -t, but of course its a static output (would have to run it in a loop to monitor temperature in a real time fashion).

MichalMMac commented 9 years ago

Hello @beltex My first impression was that smckit -td shows only limited set of temperature sensors.

When I compared that output with my notes on temp sensors 4-letter codes for three different Mac models it seems to me that smckit -td shows only temperature sensors for which we know what 4-letter represents.

dshb is very nice tool but I need output I can parse with a script.

perfaram commented 9 years ago

Okay, so here I am. I started working on it nonetheless, mostly as an introduction to Swift for me. However... how could I cast [UInt8] into a String ?

beltex commented 9 years ago

My first impression was that smckit -td shows only limited set of temperature sensors.

@MichalMMac Your absolutely right, it does only show a fixed set of temperature sensors which we know what hardware they map to more or less.

dshb is very nice tool but I need output I can parse with a script.

Thanks! :)

I see. I had been thinking for a while about iterating through the four character codes (FourCC) for temperature sensors, but I was hesitant to do so since we would not know what they would be for exactly. However, I've gone back and looked at some of my notes on this, and I may just have a solution. I'm going to explore it further, and will get back to you as soon as I can.


how could I cast [UInt8] into a String ?

@perfaram Here's one way of doing it:

let data: [UInt8] = [72, 101, 108, 108, 111, 33]
var str = String()

for value in data {
    str.append(UnicodeScalar(value))
}

print(str)
MichalMMac commented 9 years ago

will get back to you as soon as I can.

@beltex Thank you

My reasoning behind this is that I don't not know what exactly some temperature sensors are but I will check them anyway. If there is value like >100°C there might be some problem worth investigating. I would rather use a tool which is in active development since I don't know if my problem with smc -l is gonna be fixed.

perfaram commented 9 years ago

See my repo. I added a function to get a key by its index, and another that counts the keys, enumerate them using the previous one, then store them in a dictionary, which associates key->(value, type)

perfaram commented 9 years ago

21

beltex commented 9 years ago

My reasoning behind this is that I don't not know what exactly some temperature sensors are but I will check them anyway.

@MichalMMac Indeed. Thus, the focus for this is only on the temperature sensors, with a new option that would be something like -u, --unknown-sensors, with output format the same as the -t option, but these would be marked as Unknown (this is besides the extra lead I mentioned previously on possibly addressing unknown sensors).

If there is value like >100°C there might be some problem worth investigating.

Keep in mind though that #15 will become more prevalent with these extra sensors.

MichalMMac commented 9 years ago

@beltex Sounds good.

Also having all information on single line could be easier for parsing but can manage with current format.

beltex commented 9 years ago

Hi @MichalMMac!

Sorry about the supremely late response, my sincerest apologies! The -u option has now been added. Let me know what you think!

Also having all information on single line could be easier for parsing but can manage with current format.

Agreed! Thats done too.

MichalMMac commented 9 years ago

@beltex Thank you. I am going to test it but I need to install Xcode 7 in VM first.

You don't have to be sorry about anything. I am not your customer and you develop this as free opensource project. I am very grateful you responded to my feature requrest :-)

MichalMMac commented 9 years ago

Work great! Thank you :+1:

Beast.local>> /Volumes/HangarBay/Hangar/Desktop/smckit -udt
-- Temperature --
AMBIENT_AIR_0     (TA0P)  23.0°C 
CPU_0_HEATSINK    (TC0H)  44.0°C 
CPU_0_PROXIMITY   (TC0P)  51.0°C 
GPU_0_DIODE       (TG0D)  73.0°C 
GPU_0_HEATSINK    (TG0H)  65.0°C 
LCD_PROXIMITY     (TL0P)  52.0°C 
MISC_PROXIMITY    (Tm0P)  53.0°C 
ODD_PROXIMITY     (TO0P)  50.0°C 
-- Unknown Temperature Sensors --
Unknown   (TA0V)  23.0°C 
Unknown   (TA0p)  28.0°C 
Unknown   (TC0c)  51.0°C 
Unknown   (TC0h)  44.0°C 
Unknown   (TC0p)  51.0°C 
Unknown   (TC1c)  47.0°C 
Unknown   (TC2c)  51.0°C 
Unknown   (TC3c)  50.0°C 
Unknown   (TCGc)  51.0°C 
Unknown   (TCSc)  49.0°C 
Unknown   (TCXc)  51.0°C 
Unknown   (TG0d)  73.0°C 
Unknown   (TG0h)  65.0°C 
Unknown   (TG0p)  68.0°C 
Unknown   (TH0O)  6.0°C 
Unknown   (TH1O)  6.0°C 
Unknown   (TL0V)  50.0°C 
Unknown   (TL0p)  65.0°C 
Unknown   (TL1P)  57.0°C 
Unknown   (TL1V)  47.0°C 
Unknown   (TL1p)  57.0°C 
Unknown   (TL1v)  47.0°C 
Unknown   (TL2V)  54.0°C 
Unknown   (TLAV)  54.0°C 
Unknown   (TLBV)  53.0°C 
Unknown   (TLCV)  50.0°C 
Unknown   (TO0p)  51.0°C 
Unknown   (TPCD)  61.0°C 
Unknown   (TS0P)  49.0°C 
Unknown   (TS0V)  46.0°C 
Unknown   (TS0p)  49.0°C 
Unknown   (TS2P)  49.0°C 
Unknown   (TS2V)  47.0°C 
Unknown   (TS2p)  49.0°C 
Unknown   (Tm0p)  53.0°C 
Unknown   (Tp1P)  66.0°C 
Unknown   (Tp1p)  66.0°C 
Unknown   (Tp2H)  75.0°C 
Unknown   (Tp2h)  75.0°C 
Unknown   (Tp3H)  64.0°C 
Unknown   (Tp3h)  64.0°C
beltex commented 9 years ago

You don't have to be sorry about anything. I am not your customer and you develop this as free opensource project. I am very grateful you responded to my feature requrest :-)

:)

Work great! Thank you :+1:

Awesome! np!