mirror of
https://github.com/hholtmann/smcFanControl.git
synced 2025-11-04 19:49:16 +01:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de3988463a | |||
| 6d6a6e8df5 | |||
| 8dd7096e96 | |||
| 65071b3bda | |||
| df1fdde5a1 | |||
| d1dff0106f | |||
| 2c8c9ce9b0 | |||
| e4257f547f | |||
| 37d3f97221 | |||
| 8bac767ee2 | |||
| ebe1cb6db6 | |||
| e35ada4887 | |||
| c37ad48839 | |||
| cbe7057bb2 | |||
| 757dd0083f | |||
| 679e6c659c | |||
| 11c0565924 | |||
| 2308d9b194 | |||
| 6f41bb6552 | |||
| 9536827e73 |
@ -23,11 +23,11 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "NSFileManager+DirectoryLocations.h"
|
||||
#import <smc.h>
|
||||
#import <smcWrapper.h>
|
||||
#import <MachineDefaults.h>
|
||||
#import "smc.h"
|
||||
#import "smcWrapper.h"
|
||||
#import "MachineDefaults.h"
|
||||
|
||||
#import <Power.h>
|
||||
#import "Power.h"
|
||||
#include <mach/mach_port.h>
|
||||
#include <mach/mach_interface.h>
|
||||
#include <mach/mach_init.h>
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
// Number of fans reported by the hardware.
|
||||
int g_numFans = 0;
|
||||
|
||||
|
||||
NSUserDefaults *defaults;
|
||||
|
||||
#pragma mark **Init-Methods**
|
||||
@ -538,9 +539,22 @@ NSUserDefaults *defaults;
|
||||
int i;
|
||||
[FanControl setRights];
|
||||
[FavoritesController setSelectionIndex:cIndex];
|
||||
for (i=0;i<[[FavoritesController arrangedObjects][cIndex][PREF_FAN_ARRAY] count];i++) {
|
||||
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMn",i] value:[[FanController arrangedObjects][i][PREF_FAN_SELSPEED] tohex]];
|
||||
}
|
||||
|
||||
if ([[MachineDefaults computerModel] rangeOfString:@"MacBookPro15"].location != NSNotFound) {
|
||||
for (i=0;i<[[FavoritesController arrangedObjects][cIndex][PREF_FAN_ARRAY] count];i++) {
|
||||
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMd",i] value:@"01"];
|
||||
float f_val = [[FanController arrangedObjects][i][PREF_FAN_SELSPEED] floatValue];
|
||||
uint8 *vals = (uint8*)&f_val;
|
||||
//NSString str_val = ;
|
||||
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dTg",i] value:[NSString stringWithFormat:@"%02x%02x%02x%02x",vals[0],vals[1],vals[2],vals[3]]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (i=0;i<[[FavoritesController arrangedObjects][cIndex][PREF_FAN_ARRAY] count];i++) {
|
||||
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMn",i] value:[[FanController arrangedObjects][i][PREF_FAN_SELSPEED] tohex]];
|
||||
}
|
||||
}
|
||||
|
||||
NSMenu *submenu = [[NSMenu alloc] init];
|
||||
|
||||
for(i=0;i<[[FavoritesController arrangedObjects] count];i++){
|
||||
@ -659,6 +673,11 @@ NSUserDefaults *defaults;
|
||||
NSLog(@"Error deleting %@",machinesPath);
|
||||
}
|
||||
error = nil;
|
||||
if ([[MachineDefaults computerModel] rangeOfString:@"MacBookPro15"].location != NSNotFound) {
|
||||
for (int i=0;i<[[FavoritesController arrangedObjects][0][PREF_FAN_ARRAY] count];i++) {
|
||||
[smcWrapper setKey_external:[NSString stringWithFormat:@"F%dMd",i] value:@"00"];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *domainName = [[NSBundle mainBundle] bundleIdentifier];
|
||||
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:domainName];
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <smcWrapper.h>
|
||||
#import "smcWrapper.h"
|
||||
|
||||
|
||||
@interface MachineDefaults : NSObject {
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <smc.h>
|
||||
#import <MachineDefaults.h>
|
||||
#import "smc.h"
|
||||
#import "MachineDefaults.h"
|
||||
#import "Constants.h"
|
||||
|
||||
@interface smcWrapper : NSObject {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
#import "smcWrapper.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
NSString * const smc_checksum=@"b8e7e0f50c1d837cedd91d9af54b167f";
|
||||
NSString * const smc_checksum=@"4fc00a0979970ee8b55f078a0c793c4d";
|
||||
|
||||
NSArray *allSensors;
|
||||
|
||||
@ -37,18 +37,44 @@ NSArray *allSensors;
|
||||
SMCClose(conn);
|
||||
}
|
||||
|
||||
+(int)convertToNumber:(SMCVal_t) val
|
||||
{
|
||||
float fval = -1.0f;
|
||||
|
||||
if (strcmp(val.dataType, DATATYPE_FLT) == 0 && val.dataSize == 4) {
|
||||
memcpy(&fval,val.bytes,sizeof(float));
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_FPE2) == 0 && val.dataSize == 2) {
|
||||
fval = _strtof(val.bytes, val.dataSize, 2);
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_UINT16) == 0 && val.dataSize == 2) {
|
||||
fval = (float)_strtoul((char *)val.bytes, val.dataSize, 10);
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_UINT8) == 0 && val.dataSize == 1) {
|
||||
fval = (float)val.bytes[0];
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_SP78) == 0 && val.dataSize == 2) {
|
||||
fval = ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
||||
}
|
||||
else {
|
||||
NSLog(@"%@", [NSString stringWithFormat:@"Unknown val:%s size-%d",val.dataType,val.dataSize]);
|
||||
}
|
||||
|
||||
return (int)fval;
|
||||
}
|
||||
|
||||
+(float)readTempSensors
|
||||
{
|
||||
float retValue;
|
||||
SMCVal_t val;
|
||||
NSString *sensor = [[NSUserDefaults standardUserDefaults] objectForKey:PREF_TEMPERATURE_SENSOR];
|
||||
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
|
||||
retValue= ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
||||
retValue = [self convertToNumber:val];
|
||||
allSensors = [NSArray arrayWithObjects:@"TC0D",@"TC0P",@"TCAD",@"TC0H",@"TC0F",@"TCAH",@"TCBH",nil];
|
||||
if (retValue<=0 || floor(retValue) == 129 ) { //workaround for some iMac Models
|
||||
for (NSString *sensor in allSensors) {
|
||||
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
|
||||
retValue= ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
||||
retValue= [self convertToNumber:val];
|
||||
if (retValue>0 && floor(retValue) != 129 ) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:sensor forKey:PREF_TEMPERATURE_SENSOR];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
@ -86,8 +112,8 @@ NSArray *allSensors;
|
||||
SMCReadKey2(keyA, &valA,conn);
|
||||
sprintf(keyB, "TCBH");
|
||||
SMCReadKey2(keyB, &valB,conn);
|
||||
float c_tempA= ((valA.bytes[0] * 256 + valA.bytes[1]) >> 2)/64.0;
|
||||
float c_tempB= ((valB.bytes[0] * 256 + valB.bytes[1]) >> 2)/64.0;
|
||||
float c_tempA= [self convertToNumber:valA];
|
||||
float c_tempB= [self convertToNumber:valB];
|
||||
int i_tempA, i_tempB;
|
||||
if (c_tempA < c_tempB)
|
||||
{
|
||||
@ -107,7 +133,7 @@ NSArray *allSensors;
|
||||
//kern_return_t result;
|
||||
sprintf(key, "F%dAc", fan_number);
|
||||
SMCReadKey2(key, &val,conn);
|
||||
int running= _strtof(val.bytes, val.dataSize, 2);
|
||||
int running= [self convertToNumber:val];
|
||||
return running;
|
||||
}
|
||||
|
||||
@ -116,7 +142,7 @@ NSArray *allSensors;
|
||||
SMCVal_t val;
|
||||
int totalFans;
|
||||
SMCReadKey2("FNum", &val,conn);
|
||||
totalFans = _strtoul((char *)val.bytes, val.dataSize, 10);
|
||||
totalFans = [self convertToNumber:val];
|
||||
return totalFans;
|
||||
}
|
||||
|
||||
@ -126,17 +152,24 @@ NSArray *allSensors;
|
||||
SMCVal_t val;
|
||||
//kern_return_t result;
|
||||
NSMutableString *desc;
|
||||
// desc=[[NSMutableString alloc] initWithFormat:@"Fan #%d: ",fan_number+1];
|
||||
desc=[[NSMutableString alloc]init];
|
||||
sprintf(key, "F%dID", fan_number);
|
||||
SMCReadKey2(key, &val,conn);
|
||||
int i;
|
||||
for (i = 0; i < val.dataSize; i++) {
|
||||
if ((int)val.bytes[i]>32) {
|
||||
temp=(unsigned char)val.bytes[i];
|
||||
[desc appendFormat:@"%c",temp];
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(key, "F%dID", fan_number);
|
||||
SMCReadKey2(key, &val,conn);
|
||||
|
||||
if(val.dataSize>0){
|
||||
desc=[[NSMutableString alloc]init];
|
||||
int i;
|
||||
for (i = 0; i < val.dataSize; i++) {
|
||||
if ((int)val.bytes[i]>32) {
|
||||
temp=(unsigned char)val.bytes[i];
|
||||
[desc appendFormat:@"%c",temp];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//On MacBookPro 15.1 descriptions aren't available
|
||||
desc=[[NSMutableString alloc] initWithFormat:@"Fan #%d: ",fan_number+1];
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
@ -147,7 +180,7 @@ NSArray *allSensors;
|
||||
//kern_return_t result;
|
||||
sprintf(key, "F%dMn", fan_number);
|
||||
SMCReadKey2(key, &val,conn);
|
||||
int min= _strtof(val.bytes, val.dataSize, 2);
|
||||
int min= [self convertToNumber:val];
|
||||
return min;
|
||||
}
|
||||
|
||||
@ -157,7 +190,7 @@ NSArray *allSensors;
|
||||
//kern_return_t result;
|
||||
sprintf(key, "F%dMx", fan_number);
|
||||
SMCReadKey2(key, &val,conn);
|
||||
int max= _strtof(val.bytes, val.dataSize, 2);
|
||||
int max= [self convertToNumber:val];
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.6</string>
|
||||
<string>2.6.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.6</string>
|
||||
<string>2.6.1</string>
|
||||
<key>LSUIElement</key>
|
||||
<string>1</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
10
Readme.md
10
Readme.md
@ -2,12 +2,12 @@
|
||||
|
||||
smcFanControl lets the user set a minimum speed for built-in fans. It allows you to increase your minimum fan speed to make your Intel Mac run cooler. In order to not damage your machine, smcFanControl does not let you set a minimum speed to a value below Apple's defaults.
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Installing it using Homebrew & Cask
|
||||
|
||||
Make sure you have both [Homebrew](http://brew.sh/) and [Cask](http://caskroom.io/) installed. You'll find intructions to install both tools on their respective websites.
|
||||
Make sure you have both [Homebrew](http://brew.sh/) and [Cask](https://caskroom.github.io/) installed. You'll find intructions to install both tools on their respective websites.
|
||||
|
||||
After installing Homebrew and Cask, run:
|
||||
|
||||
@ -15,13 +15,13 @@ After installing Homebrew and Cask, run:
|
||||
$ brew cask install smcfancontrol
|
||||
```
|
||||
|
||||
After that you'll be able to use Spotilight to launch smcFanControl normally. :-)
|
||||
After that you'll be able to use Spotlight to launch smcFanControl normally. :-)
|
||||
|
||||
|
||||
Requirements: Intel Mac / OS X 10.6 or higher
|
||||
Requirements: Intel Mac / OS X 10.7 or higher
|
||||
|
||||
|
||||
Compiled version: http://www.eidac.de/smcfancontrol/smcfancontrol_2_5_2.zip
|
||||
Compiled version: https://www.eidac.de/smcfancontrol/smcfancontrol_2_6.zip
|
||||
|
||||
FAQ / More info: Found in project under "Ressources/*.lproj/F.A.Q.rtf" or included in above .zip
|
||||
|
||||
|
||||
5952
Ressources/Dutch.lproj/MainMenu.nib/designable.nib
generated
5952
Ressources/Dutch.lproj/MainMenu.nib/designable.nib
generated
File diff suppressed because it is too large
Load Diff
BIN
Ressources/Dutch.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
Ressources/Dutch.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
@ -463,7 +463,7 @@
|
||||
<string>FanData</string>
|
||||
</declaredKeys>
|
||||
</arrayController>
|
||||
<window title="GPL Lizenz" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="373" userLabel="GPL License" customClass="StatusItemWindow">
|
||||
<window title="GPL License" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="373" userLabel="GPL License" customClass="StatusItemWindow">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="394" y="138" width="575" height="603"/>
|
||||
|
||||
6088
Ressources/French.lproj/MainMenu.nib/designable.nib
generated
6088
Ressources/French.lproj/MainMenu.nib/designable.nib
generated
File diff suppressed because it is too large
Load Diff
BIN
Ressources/French.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
Ressources/French.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
5790
Ressources/German.lproj/MainMenu.nib/designable.nib
generated
5790
Ressources/German.lproj/MainMenu.nib/designable.nib
generated
File diff suppressed because it is too large
Load Diff
BIN
Ressources/German.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
Ressources/German.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
5748
Ressources/Spanish.lproj/MainMenu.nib/designable.nib
generated
5748
Ressources/Spanish.lproj/MainMenu.nib/designable.nib
generated
File diff suppressed because it is too large
Load Diff
BIN
Ressources/Spanish.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
Ressources/Spanish.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
CC = gcc
|
||||
CFLAGS = -mmacosx-version-min=10.4 -Wall -g -framework IOKit
|
||||
CPPFLAGS = -DCMD_TOOL_BUILD
|
||||
|
||||
all: smc
|
||||
|
||||
@ -7,7 +8,7 @@ smc: smc.o
|
||||
$(CC) $(CFLAGS) -o smc smc.o
|
||||
|
||||
smc.o: smc.h smc.c
|
||||
$(CC) -c smc.c
|
||||
$(CC) $(CPPFLAGS) -c smc.c
|
||||
|
||||
clean:
|
||||
-rm -f smc smc.o
|
||||
|
||||
@ -83,6 +83,12 @@ float _strtof(unsigned char *str, int size, int e)
|
||||
return total;
|
||||
}
|
||||
|
||||
void printFLT(SMCVal_t val)
|
||||
{
|
||||
float fval;
|
||||
memcpy(&fval,val.bytes,sizeof(float));
|
||||
printf("%.0f ", fval);
|
||||
}
|
||||
|
||||
void printFP1F(SMCVal_t val)
|
||||
{
|
||||
@ -199,6 +205,7 @@ void printPWM(SMCVal_t val)
|
||||
printf("%.1f%% ", ntohs(*(UInt16*)val.bytes) * 100 / 65536.0);
|
||||
}
|
||||
|
||||
|
||||
void printBytesHex(SMCVal_t val)
|
||||
{
|
||||
int i;
|
||||
@ -218,6 +225,8 @@ void printVal(SMCVal_t val)
|
||||
(strcmp(val.dataType, DATATYPE_UINT16) == 0) ||
|
||||
(strcmp(val.dataType, DATATYPE_UINT32) == 0))
|
||||
printUInt(val);
|
||||
else if (strcmp(val.dataType, DATATYPE_FLT) == 0 && val.dataSize == 4)
|
||||
printFLT(val);
|
||||
else if (strcmp(val.dataType, DATATYPE_FP1F) == 0 && val.dataSize == 2)
|
||||
printFP1F(val);
|
||||
else if (strcmp(val.dataType, DATATYPE_FP4C) == 0 && val.dataSize == 2)
|
||||
@ -262,6 +271,8 @@ void printVal(SMCVal_t val)
|
||||
printSI16(val);
|
||||
else if (strcmp(val.dataType, DATATYPE_PWM) == 0 && val.dataSize == 2)
|
||||
printPWM(val);
|
||||
else if (strcmp(val.dataType, DATATYPE_FLT) == 0 && val.dataSize == 4)
|
||||
printFLT(val);
|
||||
|
||||
printBytesHex(val);
|
||||
}
|
||||
@ -504,6 +515,31 @@ kern_return_t SMCPrintAll(void)
|
||||
return kIOReturnSuccess;
|
||||
}
|
||||
|
||||
|
||||
//Fix me with other types
|
||||
float getFloatFromVal(SMCVal_t val)
|
||||
{
|
||||
float fval = -1.0f;
|
||||
|
||||
if (val.dataSize > 0)
|
||||
{
|
||||
if (strcmp(val.dataType, DATATYPE_FLT) == 0 && val.dataSize == 4) {
|
||||
memcpy(&fval,val.bytes,sizeof(float));
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_FPE2) == 0 && val.dataSize == 2) {
|
||||
fval = _strtof(val.bytes, val.dataSize, 2);
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_UINT16) == 0 && val.dataSize == 2) {
|
||||
fval = (float)_strtoul((char *)val.bytes, val.dataSize, 10);
|
||||
}
|
||||
else if (strcmp(val.dataType, DATATYPE_UINT8) == 0 && val.dataSize == 1) {
|
||||
fval = (float)_strtoul((char *)val.bytes, val.dataSize, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return fval;
|
||||
}
|
||||
|
||||
kern_return_t SMCPrintFans(void)
|
||||
{
|
||||
kern_return_t result;
|
||||
@ -523,27 +559,79 @@ kern_return_t SMCPrintFans(void)
|
||||
printf("\nFan #%d:\n", i);
|
||||
sprintf(key, "F%dID", i);
|
||||
SMCReadKey(key, &val);
|
||||
printf(" Fan ID : %s\n", val.bytes+4);
|
||||
if(val.dataSize > 0) {
|
||||
printf(" Fan ID : %s\n", val.bytes+4);
|
||||
}
|
||||
sprintf(key, "F%dAc", i);
|
||||
SMCReadKey(key, &val);
|
||||
printf(" Actual speed : %.0f\n", _strtof(val.bytes, val.dataSize, 2));
|
||||
printf(" Actual speed : %.0f\n", getFloatFromVal(val));
|
||||
sprintf(key, "F%dMn", i);
|
||||
SMCReadKey(key, &val);
|
||||
printf(" Minimum speed: %.0f\n", _strtof(val.bytes, val.dataSize, 2));
|
||||
printf(" Minimum speed: %.0f\n", getFloatFromVal(val));
|
||||
sprintf(key, "F%dMx", i);
|
||||
SMCReadKey(key, &val);
|
||||
printf(" Maximum speed: %.0f\n", _strtof(val.bytes, val.dataSize, 2));
|
||||
printf(" Maximum speed: %.0f\n", getFloatFromVal(val));
|
||||
sprintf(key, "F%dSf", i);
|
||||
SMCReadKey(key, &val);
|
||||
printf(" Safe speed : %.0f\n", _strtof(val.bytes, val.dataSize, 2));
|
||||
printf(" Safe speed : %.0f\n", getFloatFromVal(val));
|
||||
sprintf(key, "F%dTg", i);
|
||||
SMCReadKey(key, &val);
|
||||
printf(" Target speed : %.0f\n", _strtof(val.bytes, val.dataSize, 2));
|
||||
printf(" Target speed : %.0f\n", getFloatFromVal(val));
|
||||
SMCReadKey("FS! ", &val);
|
||||
if ((_strtoul((char *)val.bytes, 2, 16) & (1 << i)) == 0)
|
||||
printf(" Mode : auto\n");
|
||||
else
|
||||
printf(" Mode : forced\n");
|
||||
if(val.dataSize > 0) {
|
||||
if ((_strtoul((char *)val.bytes, 2, 16) & (1 << i)) == 0)
|
||||
printf(" Mode : auto\n");
|
||||
else
|
||||
printf(" Mode : forced\n");
|
||||
}
|
||||
else {
|
||||
sprintf(key, "F%dMd", i);
|
||||
SMCReadKey(key, &val);
|
||||
if (getFloatFromVal(val))
|
||||
printf(" Mode : forced\n");
|
||||
else
|
||||
printf(" Mode : auto\n");
|
||||
}
|
||||
}
|
||||
|
||||
return kIOReturnSuccess;
|
||||
}
|
||||
|
||||
kern_return_t SMCPrintTemps(void)
|
||||
{
|
||||
kern_return_t result;
|
||||
SMCKeyData_t inputStructure;
|
||||
SMCKeyData_t outputStructure;
|
||||
|
||||
int totalKeys, i;
|
||||
UInt32Char_t key;
|
||||
SMCVal_t val;
|
||||
|
||||
totalKeys = SMCReadIndexCount();
|
||||
for (i = 0; i < totalKeys; i++)
|
||||
{
|
||||
memset(&inputStructure, 0, sizeof(SMCKeyData_t));
|
||||
memset(&outputStructure, 0, sizeof(SMCKeyData_t));
|
||||
memset(&val, 0, sizeof(SMCVal_t));
|
||||
|
||||
inputStructure.data8 = SMC_CMD_READ_INDEX;
|
||||
inputStructure.data32 = i;
|
||||
|
||||
result = SMCCall(KERNEL_INDEX_SMC, &inputStructure, &outputStructure);
|
||||
if (result != kIOReturnSuccess)
|
||||
continue;
|
||||
|
||||
_ultostr(key, outputStructure.key);
|
||||
if ( key[0] != 'T' )
|
||||
continue;
|
||||
|
||||
SMCReadKey(key, &val);
|
||||
//printVal(val);
|
||||
if (strcmp(val.dataType, DATATYPE_SP78) == 0 && val.dataSize == 2) {
|
||||
printf("%-4s ", val.key);
|
||||
printSP78(val);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
return kIOReturnSuccess;
|
||||
@ -555,6 +643,7 @@ void usage(char* prog)
|
||||
printf("Usage:\n");
|
||||
printf("%s [options]\n", prog);
|
||||
printf(" -f : fan info decoded\n");
|
||||
printf(" -t : list all temperatures\n");
|
||||
printf(" -h : help\n");
|
||||
printf(" -k <key> : key to manipulate\n");
|
||||
printf(" -l : list all keys and values\n");
|
||||
@ -595,13 +684,16 @@ int main(int argc, char *argv[])
|
||||
UInt32Char_t key = { 0 };
|
||||
SMCVal_t val;
|
||||
|
||||
while ((c = getopt(argc, argv, "fhk:lrw:v")) != -1)
|
||||
while ((c = getopt(argc, argv, "fthk:lrw:v")) != -1)
|
||||
{
|
||||
switch(c)
|
||||
{
|
||||
case 'f':
|
||||
op = OP_READ_FAN;
|
||||
break;
|
||||
case 't':
|
||||
op = OP_READ_TEMPS;
|
||||
break;
|
||||
case 'k':
|
||||
strncpy(key, optarg, sizeof(key)); //fix for buffer overflow
|
||||
key[sizeof(key) - 1] = '\0';
|
||||
@ -675,6 +767,11 @@ int main(int argc, char *argv[])
|
||||
if (result != kIOReturnSuccess)
|
||||
printf("Error: SMCPrintFans() = %08x\n", result);
|
||||
break;
|
||||
case OP_READ_TEMPS:
|
||||
result = SMCPrintTemps();
|
||||
if (result != kIOReturnSuccess)
|
||||
printf("Error: SMCPrintFans() = %08x\n", result);
|
||||
break;
|
||||
case OP_WRITE:
|
||||
if (strlen(key) > 0)
|
||||
{
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#define OP_READ 2
|
||||
#define OP_READ_FAN 3
|
||||
#define OP_WRITE 4
|
||||
#define OP_READ_TEMPS 5
|
||||
|
||||
#define KERNEL_INDEX_SMC 2
|
||||
|
||||
@ -40,6 +41,7 @@
|
||||
#define SMC_CMD_READ_PLIMIT 11
|
||||
#define SMC_CMD_READ_VERS 12
|
||||
|
||||
#define DATATYPE_FLT "flt "
|
||||
#define DATATYPE_FP1F "fp1f"
|
||||
#define DATATYPE_FP4C "fp4c"
|
||||
#define DATATYPE_FP5B "fp5b"
|
||||
@ -68,6 +70,8 @@
|
||||
#define DATATYPE_SI8 "si8 "
|
||||
#define DATATYPE_SI16 "si16"
|
||||
|
||||
#define DATATYPE_FLT "flt "
|
||||
|
||||
#define DATATYPE_PWM "{pwm"
|
||||
|
||||
typedef struct {
|
||||
|
||||
@ -305,7 +305,7 @@
|
||||
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0800;
|
||||
LastUpgradeCheck = 1000;
|
||||
TargetAttributes = {
|
||||
8924ECED15AC96E70031730C = {
|
||||
DevelopmentTeam = H4G85G26BP;
|
||||
@ -441,8 +441,9 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "Developer ID Application";
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEVELOPMENT_TEAM = H4G85G26BP;
|
||||
@ -469,8 +470,9 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "Developer ID Application";
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
@ -522,6 +524,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.eidac.smcFanControl2;
|
||||
PRODUCT_NAME = smcFanControl;
|
||||
PROVISIONING_PROFILE = "";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = YES;
|
||||
@ -555,12 +558,14 @@
|
||||
"\"$(SDKROOT)/usr/lib/system\"",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OBJROOT = "$(HOME)/builds";
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
OTHER_CODE_SIGN_FLAGS = "--deep";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.eidac.smcFanControl2;
|
||||
PRODUCT_NAME = smcFanControl;
|
||||
PROVISIONING_PROFILE = "";
|
||||
SDKROOT = macosx;
|
||||
SYMROOT = "$(HOME)/builds";
|
||||
VALID_ARCHS = "i386 x86_64";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
@ -570,7 +575,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
@ -588,7 +593,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CODE_SIGN_IDENTITY = "Developer ID Application: Hendrik Holtmann";
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
|
||||
Binary file not shown.
@ -37,5 +37,21 @@
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Classes/smcWrapper.m"
|
||||
timestampString = "555720499.446066"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "60"
|
||||
endingLineNumber = "60"
|
||||
landmarkName = "+convertToNumber:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0800"
|
||||
LastUpgradeVersion = "1000"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -42,16 +42,16 @@
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = "en"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
language = "en">
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
|
||||
Reference in New Issue
Block a user