Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to update this code with more sensors? #35

Open
larryqiann opened this issue Feb 13, 2018 · 4 comments
Open

Any way to update this code with more sensors? #35

larryqiann opened this issue Feb 13, 2018 · 4 comments

Comments

@larryqiann
Copy link

Hi, I'm on a MacBook Pro 13,2 and I'm wondering what the process would be for adding sensors to the list/where to find the four character codes used. Is there any way perhaps to find out? In iStat Menus there are quite a few sensors; I'm not sure how they got it working

Thanks!

@perfaram
Copy link
Contributor

perfaram commented Mar 9, 2018

You have a very complete list there :
https://gist.github.com/perfaram/f886465e65b7851d17c1ba596ba742eb
and there :
https://gist.github.com/perfaram/fa3e374fee799ba370123068ccb08867

And the matching types there :
https://gist.github.com/perfaram/7e96785609164cf238c6a4414d7b1edd

Data was compiled and formatted by myself, but mostly comes from parhelia.ch (+ a couple of other sources).

@larryqiann
Copy link
Author

There are several that aren't in there. Trackpad Actuator (temp) and USBC/MPM In (W) come up off the top of my head.

@perfaram
Copy link
Contributor

perfaram commented Mar 28, 2018

Which app reports these ? I'll take care of the rest.
(And what is your MacBook model ?)

EDIT : Nevermind, iStats Menu.

@perfaram
Copy link
Contributor

perfaram commented Mar 28, 2018

Okay, the FourCC key matching the "Trackpad actuator" is Ts1P. Feel free to make a PR adding this one to the known keys.
I forked SMCKit and added Ts1P here but I'm not sure we should pull this in the main repo. Indeed, as the Ts1P sensor is only present in post-2014 MacBooks (before this the trackpad had no actuator – it just mechanically clicked) it could be misleading to just allow requesting this key on all models. There should be a check or at least a way to check whether the key is supposed to exist...

My suggestion is to keep the current TemperatureSensor struct (maybe add a similar VoltageSensor, etc...), and add a third variable : public let supportedModels: [Model] where Model is simply a typealias (allows for easier, later, expansion) for String, containing the model identifier (eg MacBookPro13_1). Alternatively, an enum could be used for Model, but would require more maintenance and updates.

@beltex, I'm pulling you in the loop since this seems like an important design decision and I don't want to spend time parsing data and inserting it into SMCKit if you don't think it's desirable / appropriate.

As a side note, I think I'm going to create a bot that automatically finds the new keys by reading and parsing the __TEXT segment of various apps that communicate with the SMC 😈
It's not as they could sue me for reverse-engineering data that was itself reverse-engineered, is it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants