beltex / libsmc Goto Github PK
View Code? Open in Web Editor NEWApple SMC library in C
License: GNU General Public License v2.0
Apple SMC library in C
License: GNU General Public License v2.0
AuthorizationExecuteWithPrivileges()
for convenience as it still seems to be available via CIn smc.c, write_smc() function, this code:
// Set data to write
memcpy(outputStruct.bytes, result_smc->data, sizeof(result_smc->data));
should actually be:
memcpy(inputStruct.bytes, result_smc->data, sizeof(result_smc->data));
Otherwise, you're always writing 0.
In the Swift version, there's an uint16_t padding between keyInfo and result: https://github.com/beltex/SMCKit/blob/v0.0.13/SMCKit/SMC.swift#L473-L475
That seems to be missing in the C version:
https://github.com/beltex/libsmc/blob/master/src/smc.c#L193-L194
I believe a shift sign has been inverted rendering the conversion incorrect.
static unsigned int from_fpe2(uint8_t data[32])
{
unsigned int ans = 0;
// Data type for fan calls - fpe2
// This is assumend to mean floating point, with 2 exponent bits
// http://stackoverflow.com/questions/22160746/fpe2-and-sp78-data-types
ans += data[0] << 6;
ans += data[1] << 2;
return ans;
}
Should be:
ans += data[1] >> 2;
(+ typo "assumend" -> "assumed")
Can do a tiny PR if it helps.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.