mirror of
https://github.com/hholtmann/smcFanControl.git
synced 2025-11-04 19:49:16 +01:00
Testing different temperature readout method
This commit is contained in:
@ -155,6 +155,7 @@ NSUserDefaults *defaults;
|
|||||||
[NSNumber numberWithInt:0],@"selac",
|
[NSNumber numberWithInt:0],@"selac",
|
||||||
[NSNumber numberWithInt:0],@"selload",
|
[NSNumber numberWithInt:0],@"selload",
|
||||||
[NSNumber numberWithInt:0],@"MenuBar",
|
[NSNumber numberWithInt:0],@"MenuBar",
|
||||||
|
@"TC0D",@"TSensor",
|
||||||
feedURL,@"SUFeedURL",
|
feedURL,@"SUFeedURL",
|
||||||
[NSArchiver archivedDataWithRootObject:[NSColor blackColor]],@"MenuColor",
|
[NSArchiver archivedDataWithRootObject:[NSColor blackColor]],@"MenuColor",
|
||||||
favorites,@"Favorites",
|
favorites,@"Favorites",
|
||||||
|
|||||||
@ -26,14 +26,15 @@
|
|||||||
|
|
||||||
//TODO: This is the smcFanControl 2.4 checksum, it needs to be updated for the next release.
|
//TODO: This is the smcFanControl 2.4 checksum, it needs to be updated for the next release.
|
||||||
NSString * const smc_checksum=@"2ea544babe8a58dccc1364c920d473c8";
|
NSString * const smc_checksum=@"2ea544babe8a58dccc1364c920d473c8";
|
||||||
static NSDictionary *tsensors = nil;
|
static NSArray *allSensors = nil;
|
||||||
|
|
||||||
|
|
||||||
@implementation smcWrapper
|
@implementation smcWrapper
|
||||||
io_connect_t conn;
|
io_connect_t conn;
|
||||||
|
|
||||||
+(void)init{
|
+(void)init{
|
||||||
SMCOpen(&conn);
|
SMCOpen(&conn);
|
||||||
tsensors = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tsensors" ofType:@"plist"]];
|
allSensors = [[NSArray alloc] initWithObjects:@"TC0D",@"TC0H",@"TC0F",@"TCAH",@"TCBH",@"TC0P",nil];
|
||||||
}
|
}
|
||||||
+(void)cleanUp{
|
+(void)cleanUp{
|
||||||
SMCClose(conn);
|
SMCClose(conn);
|
||||||
@ -41,34 +42,24 @@ static NSDictionary *tsensors = nil;
|
|||||||
|
|
||||||
+(float) get_maintemp{
|
+(float) get_maintemp{
|
||||||
float c_temp;
|
float c_temp;
|
||||||
|
|
||||||
NSRange range_pro=[[MachineDefaults computerModel] rangeOfString:@"MacPro"];
|
SMCVal_t val;
|
||||||
if (range_pro.length > 0) {
|
NSString *sensor = [[NSUserDefaults standardUserDefaults] objectForKey:@"TSensor"];
|
||||||
//special readout for MacPro
|
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
|
||||||
c_temp=[smcWrapper get_mptemp];
|
c_temp= ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
||||||
} else {
|
|
||||||
SMCVal_t val;
|
if (c_temp<=0) {
|
||||||
NSString *foundKey = [tsensors objectForKey:[MachineDefaults computerModel]];
|
for (NSString *sensor in allSensors) {
|
||||||
if (foundKey !=nil) {
|
SMCReadKey2((char*)[sensor UTF8String], &val,conn);
|
||||||
foundKey = [MachineDefaults computerModel];
|
c_temp= ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
||||||
} else {
|
if (c_temp>0) {
|
||||||
foundKey = @"standard";
|
[[NSUserDefaults standardUserDefaults] setObject:sensor forKey:@"TSensor"];
|
||||||
}
|
break;
|
||||||
SMCReadKey2((char*)[[tsensors objectForKey:foundKey] UTF8String], &val,conn);
|
|
||||||
c_temp= ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
|
||||||
|
|
||||||
if (c_temp<=0) {
|
|
||||||
NSArray *allTSensors = [tsensors allKeys];
|
|
||||||
for (NSString *key in allTSensors) {
|
|
||||||
if (![key isEqualToString:foundKey]) {
|
|
||||||
SMCReadKey2((char*)[[tsensors objectForKey:key] UTF8String], &val,conn);
|
|
||||||
c_temp= ((val.bytes[0] * 256 + val.bytes[1]) >> 2)/64;
|
|
||||||
if (c_temp>0) break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return c_temp;
|
return c_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>smcFanControl</string>
|
<string>smcFanControl</string>
|
||||||
<key>CFBundleGetInfoString</key>
|
<key>CFBundleGetInfoString</key>
|
||||||
<string>smcFanControl 2.4, Hendrik Holtmann (GPL)</string>
|
<string>smcFanControl 2.5, Hendrik Holtmann (GPL)</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>smcfancontrol_v2</string>
|
<string>smcfancontrol_v2</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
@ -19,11 +19,11 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.4</string>
|
<string>2.5</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>2.4</string>
|
<string>2.5</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>standard</key>
|
|
||||||
<string>TC0D</string>
|
|
||||||
<key>lastAlternative</key>
|
|
||||||
<string>TCAH</string>
|
|
||||||
<key>MacBookPro10,1</key>
|
|
||||||
<string>TC0F</string>
|
|
||||||
<key>iMac12,2</key>
|
|
||||||
<string>TC0H</string>
|
|
||||||
<key>iMac12,1</key>
|
|
||||||
<string>TC0H</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@ -27,7 +27,6 @@
|
|||||||
89949E8D0AEEA37700077E93 /* Power.m in Sources */ = {isa = PBXBuildFile; fileRef = 89949E8C0AEEA37700077E93 /* Power.m */; };
|
89949E8D0AEEA37700077E93 /* Power.m in Sources */ = {isa = PBXBuildFile; fileRef = 89949E8C0AEEA37700077E93 /* Power.m */; };
|
||||||
899D59DC15E1CF60003E322D /* smc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8924ECEE15AC96E70031730C /* smc */; };
|
899D59DC15E1CF60003E322D /* smc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8924ECEE15AC96E70031730C /* smc */; };
|
||||||
899D59DD15E1CFFF003E322D /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 895BDA390B8F8F42003CD894 /* Sparkle.framework */; };
|
899D59DD15E1CFFF003E322D /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 895BDA390B8F8F42003CD894 /* Sparkle.framework */; };
|
||||||
899D59E315E228DF003E322D /* tsensors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 899D59E215E228DF003E322D /* tsensors.plist */; };
|
|
||||||
89B243200B7E351000CAD103 /* smcfancontrol_v2.icns in Resources */ = {isa = PBXBuildFile; fileRef = 89B2431F0B7E351000CAD103 /* smcfancontrol_v2.icns */; };
|
89B243200B7E351000CAD103 /* smcfancontrol_v2.icns in Resources */ = {isa = PBXBuildFile; fileRef = 89B2431F0B7E351000CAD103 /* smcfancontrol_v2.icns */; };
|
||||||
89C053BE0ADAB7630037CA16 /* smc.c in Sources */ = {isa = PBXBuildFile; fileRef = 89C053BC0ADAB7630037CA16 /* smc.c */; };
|
89C053BE0ADAB7630037CA16 /* smc.c in Sources */ = {isa = PBXBuildFile; fileRef = 89C053BC0ADAB7630037CA16 /* smc.c */; };
|
||||||
89E7D3650ADE819B000F67AB /* Machines.plist in Resources */ = {isa = PBXBuildFile; fileRef = 89E7D3640ADE819B000F67AB /* Machines.plist */; };
|
89E7D3650ADE819B000F67AB /* Machines.plist in Resources */ = {isa = PBXBuildFile; fileRef = 89E7D3640ADE819B000F67AB /* Machines.plist */; };
|
||||||
@ -110,7 +109,6 @@
|
|||||||
8987FBD00B878B3900A5ED8E /* smc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = smc.png; sourceTree = "<group>"; };
|
8987FBD00B878B3900A5ED8E /* smc.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = smc.png; sourceTree = "<group>"; };
|
||||||
89949E8B0AEEA37700077E93 /* Power.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Power.h; sourceTree = "<group>"; };
|
89949E8B0AEEA37700077E93 /* Power.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Power.h; sourceTree = "<group>"; };
|
||||||
89949E8C0AEEA37700077E93 /* Power.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Power.m; sourceTree = "<group>"; };
|
89949E8C0AEEA37700077E93 /* Power.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Power.m; sourceTree = "<group>"; };
|
||||||
899D59E215E228DF003E322D /* tsensors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = tsensors.plist; sourceTree = "<group>"; };
|
|
||||||
89B2431F0B7E351000CAD103 /* smcfancontrol_v2.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = smcfancontrol_v2.icns; sourceTree = "<group>"; };
|
89B2431F0B7E351000CAD103 /* smcfancontrol_v2.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = smcfancontrol_v2.icns; sourceTree = "<group>"; };
|
||||||
89C053BC0ADAB7630037CA16 /* smc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = smc.c; sourceTree = "<group>"; };
|
89C053BC0ADAB7630037CA16 /* smc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = smc.c; sourceTree = "<group>"; };
|
||||||
89C053BD0ADAB7630037CA16 /* smc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = smc.h; sourceTree = "<group>"; };
|
89C053BD0ADAB7630037CA16 /* smc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = smc.h; sourceTree = "<group>"; };
|
||||||
@ -231,7 +229,6 @@
|
|||||||
89B2431F0B7E351000CAD103 /* smcfancontrol_v2.icns */,
|
89B2431F0B7E351000CAD103 /* smcfancontrol_v2.icns */,
|
||||||
8917FB850ADEECAD00443DA1 /* paypal.gif */,
|
8917FB850ADEECAD00443DA1 /* paypal.gif */,
|
||||||
89E7D3640ADE819B000F67AB /* Machines.plist */,
|
89E7D3640ADE819B000F67AB /* Machines.plist */,
|
||||||
899D59E215E228DF003E322D /* tsensors.plist */,
|
|
||||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||||
893506170B440255001BFBA5 /* Localizable.strings */,
|
893506170B440255001BFBA5 /* Localizable.strings */,
|
||||||
89FE24050B7F4C2B00D2713C /* paypal.gif */,
|
89FE24050B7F4C2B00D2713C /* paypal.gif */,
|
||||||
@ -344,7 +341,6 @@
|
|||||||
89033CA70B80E1EB00FDAF43 /* F.A.Q.rtf in Resources */,
|
89033CA70B80E1EB00FDAF43 /* F.A.Q.rtf in Resources */,
|
||||||
8987FBD20B878B3900A5ED8E /* smc.png in Resources */,
|
8987FBD20B878B3900A5ED8E /* smc.png in Resources */,
|
||||||
89559A840BAC338500DBA37E /* smcover.png in Resources */,
|
89559A840BAC338500DBA37E /* smcover.png in Resources */,
|
||||||
899D59E315E228DF003E322D /* tsensors.plist in Resources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user