Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Commit

Permalink
Fix FakeSMC, FakeSMCKeyStore matching and linking
Browse files Browse the repository at this point in the history
  • Loading branch information
CozmoNate committed Nov 8, 2013
1 parent ab46eda commit c378c8d
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 60 deletions.
6 changes: 4 additions & 2 deletions ACPISensors/ACPISensors-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<string>ACPISENSORS_BUNDLE</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kpi.mach</key>
<string>10.0.0</string>
<key>FAKESMCKEYSTORE_BUNDLE</key>
<string>FAKESMCKEYSTORE_COMPATIBLE</string>
<key>com.apple.iokit.IOACPIFamily</key>
<string>1.0.0b1</string>
<key>com.apple.kpi.mach</key>
<string>10.0.0</string>
<key>com.apple.kpi.libkern</key>
<string>10.0.0</string>
<key>com.apple.kpi.iokit</key>
Expand Down
2 changes: 2 additions & 0 deletions CPUSensors/CPUSensors-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
<string>Copyright © HWSENSORS_LASTYEAR Natan Zalkin &lt;natan.zalkin@me.com&gt;. All rights reserved.</string>
<key>OSBundleLibraries</key>
<dict>
<key>FAKESMCKEYSTORE_BUNDLE</key>
<string>FAKESMCKEYSTORE_COMPATIBLE</string>
<key>com.apple.kpi.iokit</key>
<string>10.0.0</string>
<key>com.apple.kpi.libkern</key>
Expand Down
4 changes: 2 additions & 2 deletions FakeSMC/FakeSMC-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © HWSENSORS_LASTYEAR netkas. All rights reserved.</string>
<key>OSBundleCompatibleVersion</key>
<string>FAKESMC_COMPATIBLE</string>
<key>OSBundleLibraries</key>
<dict>
<key>FAKESMCKEYSTORE_BUNDLE</key>
<string>FAKESMCKEYSTORE_COMPATIBLE</string>
<key>com.apple.iokit.IOACPIFamily</key>
<string>1.0.0d1</string>
<key>com.apple.kpi.bsd</key>
Expand Down
47 changes: 24 additions & 23 deletions FakeSMC/FakeSMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,32 @@ bool FakeSMC::start(IOService *provider)
if (!super::start(provider))
return false;

if (IOService *resources = waitForMatchingService(serviceMatching("IOResources"), 0))
this->attach(resources);

OSDictionary *configuration = OSDynamicCast(OSDictionary, getProperty("Configuration"));

if (!(keyStore = OSDynamicCast(FakeSMCKeyStore, waitForMatchingService(serviceMatching(kFakeSMCKeyStoreService), 0)))) {

HWSensorsDebugLog("creating FakeSMCKeyStore");

if (!(keyStore = new FakeSMCKeyStore)) {
HWSensorsInfoLog("failed to create FakeSMCKeyStore");
return false;
}
if (!(keyStore = OSDynamicCast(FakeSMCKeyStore, waitForMatchingService(serviceMatching(kFakeSMCKeyStoreService), kFakeSMCDefaultWaitTimeout)))) {
HWSensorsInfoLog("still waiting for FakeSMCKeyStore...");
return false;
// HWSensorsDebugLog("creating FakeSMCKeyStore");
//
// if (!(keyStore = new FakeSMCKeyStore)) {
// HWSensorsInfoLog("failed to create FakeSMCKeyStore");
// return false;
// }
//
// HWSensorsDebugLog("initializing FakeSMCKeyStore");
//
// if (keyStore->initAndStart(this, configuration)) {
// keyStore->setProperty("IOUserClientClass", "FakeSMCKeyStoreUserClient");
// }
// else {
// keyStore->release();
// HWSensorsFatalLog("failed to initialize FakeSMCKeyStore device");
// return false;
// }
}

HWSensorsDebugLog("initializing FakeSMCKeyStore");
// if (IOService *resources = waitForMatchingService(serviceMatching("IOResources"), 0))
// this->attach(resources);

if (keyStore->initAndStart(this, configuration)) {
keyStore->setProperty("IOUserClientClass", "FakeSMCKeyStoreUserClient");
}
else {
keyStore->release();
HWSensorsFatalLog("failed to initialize FakeSMCKeyStore device");
return false;
}
}
OSDictionary *configuration = OSDynamicCast(OSDictionary, getProperty("Configuration"));

// Load preconfigured keys
HWSensorsDebugLog("loading keys...");
Expand Down
2 changes: 1 addition & 1 deletion FakeSMC/FakeSMCDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ bool FakeSMCDevice::initAndStart(IOService *platform, IOService *provider)
return false;

if (!(keyStore = OSDynamicCast(FakeSMCKeyStore, waitForMatchingService(serviceMatching(kFakeSMCKeyStoreService), kFakeSMCDefaultWaitTimeout)))) {
HWSensorsFatalLog("failed to locate FakeSMCKeyStore service!");
HWSensorsFatalLog("still waiting for FakeSMCKeyStore...");
return false;
}

Expand Down
8 changes: 5 additions & 3 deletions FakeSMCKeyStore/FakeSMCKeyStore-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.hwsensors.${PRODUCT_NAME}</string>
<string>FAKESMCKEYSTORE_BUNDLE</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -25,7 +25,7 @@
<key>FakeSMCKeyStore</key>
<dict>
<key>CFBundleIdentifier</key>
<string>org.hwsensors.${PRODUCT_NAME}</string>
<string>FAKESMCKEYSTORE_BUNDLE</string>
<key>IOClass</key>
<string>FakeSMCKeyStore</string>
<key>IOMatchCategory</key>
Expand All @@ -35,11 +35,13 @@
<key>IOUserClientClass</key>
<string>FakeSMCKeyStoreUserClient</string>
<key>IOResourceMatch</key>
<string>ACPI</string>
<string>IOKit</string>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © HWSENSORS_LASTYEAR Natan Zalkin &lt;natan.zalkin@me.com&gt;. All rights reserved.</string>
<key>OSBundleCompatibleVersion</key>
<string>FAKESMCKEYSTORE_COMPATIBLE</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kpi.bsd</key>
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions GPUSensors/GPUSensors-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
<string>6.0</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kpi.mach</key>
<string>10.0.0</string>
<key>FAKESMCKEYSTORE_BUNDLE</key>
<string>FAKESMCKEYSTORE_COMPATIBLE</string>
<key>com.apple.iokit.IOACPIFamily</key>
<string>1.0.0d1</string>
<key>com.apple.kpi.libkern</key>
<string>10.0.0</string>
<key>com.apple.iokit.IOPCIFamily</key>
<string>1.0.0b1</string>
<key>com.apple.kpi.mach</key>
<string>10.0.0</string>
<key>com.apple.kpi.libkern</key>
<string>10.0.0</string>
<key>com.apple.kpi.iokit</key>
<string>10.0.0</string>
<key>com.apple.kpi.unsupported</key>
Expand Down
47 changes: 23 additions & 24 deletions HWSensors.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
6A2B4E44152179700093A217 /* SuperIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A2B4E38152179700093A217 /* SuperIO.cpp */; };
6A2B4E46152179700093A217 /* LPCSensors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A2B4E3A152179700093A217 /* LPCSensors.cpp */; };
6A2B4E48152179700093A217 /* W836xxSensors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A2B4E3C152179700093A217 /* W836xxSensors.cpp */; };
6A9C468D14E657EE0083E5E6 /* FakeSMCPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A9C468914E657EE0083E5E6 /* FakeSMCPlugin.cpp */; };
6AA172CB150B415200A77CF2 /* FakeSMCDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6AA172C4150B415200A77CF2 /* FakeSMCDevice.cpp */; };
6AA2D0D4150B4B99004757C5 /* FakeSMC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6AA2D0D2150B4B99004757C5 /* FakeSMC.cpp */; };
7E003635182D078900847C4E /* FakeSMCKeyStore.kext in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7EFF9525182AD5C200C637C8 /* FakeSMCKeyStore.kext */; };
7E012DAC182D064500D5CD21 /* FakeSMCPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E012DAA182D064500D5CD21 /* FakeSMCPlugin.cpp */; };
7E0EB891169A9A9A000DF2B1 /* evergreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E0EB890169A9A9A000DF2B1 /* evergreen.cpp */; };
7E0EB897169A9D3C000DF2B1 /* r600.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E0EB895169A9D3C000DF2B1 /* r600.cpp */; };
7E0EB89B169A9DBE000DF2B1 /* rv770.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E0EB899169A9DBE000DF2B1 /* rv770.cpp */; };
Expand Down Expand Up @@ -61,16 +62,25 @@
7EB1366C169C2CE800B42023 /* atom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EB1366A169C2CE700B42023 /* atom.cpp */; };
7EB73CFA1791BCBC007D93D4 /* OEMInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EB73CF81791BCBC007D93D4 /* OEMInfo.cpp */; };
7EBEB1DB17B1754D00C114B5 /* GPUSensors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EBEB1D917B1754D00C114B5 /* GPUSensors.cpp */; };
7EFF951B182AD44700C637C8 /* FakeSMCKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9513182AD44700C637C8 /* FakeSMCKey.cpp */; };
7EFF951C182AD44700C637C8 /* FakeSMCKeyHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9515182AD44700C637C8 /* FakeSMCKeyHandler.cpp */; };
7EFF951D182AD44700C637C8 /* FakeSMCKeyStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9517182AD44700C637C8 /* FakeSMCKeyStore.cpp */; };
7EFF951E182AD44700C637C8 /* FakeSMCKeyStoreUserClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9519182AD44700C637C8 /* FakeSMCKeyStoreUserClient.cpp */; };
7EFF9534182AD69D00C637C8 /* FakeSMCKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9513182AD44700C637C8 /* FakeSMCKey.cpp */; };
7EFF9535182AD69D00C637C8 /* FakeSMCKeyHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9515182AD44700C637C8 /* FakeSMCKeyHandler.cpp */; };
7EFF9536182AD69D00C637C8 /* FakeSMCKeyStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9517182AD44700C637C8 /* FakeSMCKeyStore.cpp */; };
7EFF9537182AD69D00C637C8 /* FakeSMCKeyStoreUserClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EFF9519182AD44700C637C8 /* FakeSMCKeyStoreUserClient.cpp */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
7E003634182D077A00847C4E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
7E003635182D078900847C4E /* FakeSMCKeyStore.kext in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
1D05ABE413ED0DAD00EADBF6 /* FakeSMC.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FakeSMC.kext; sourceTree = BUILT_PRODUCTS_DIR; };
1D05AC0513ED0E8D00EADBF6 /* FakeSMC-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "FakeSMC-Prefix.pch"; sourceTree = "<group>"; };
Expand All @@ -94,14 +104,14 @@
6A4E4739152178A00038C5DE /* LPCSensors.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LPCSensors.kext; sourceTree = BUILT_PRODUCTS_DIR; };
6A4E4743152178A00038C5DE /* SuperIOSensors-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SuperIOSensors-Prefix.pch"; sourceTree = "<group>"; };
6A9955C214EFAEE50052C702 /* cpuid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpuid.h; sourceTree = "<group>"; };
6A9C468914E657EE0083E5E6 /* FakeSMCPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FakeSMCPlugin.cpp; sourceTree = "<group>"; };
6A9C468A14E657EE0083E5E6 /* FakeSMCPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeSMCPlugin.h; sourceTree = "<group>"; };
6A9F7268150A23C600279E79 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = System/Library/Frameworks/Kernel.framework; sourceTree = SDKROOT; };
6AA172C4150B415200A77CF2 /* FakeSMCDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FakeSMCDevice.cpp; sourceTree = "<group>"; };
6AA172C5150B415200A77CF2 /* FakeSMCDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeSMCDevice.h; sourceTree = "<group>"; };
6AA2D0D2150B4B99004757C5 /* FakeSMC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FakeSMC.cpp; sourceTree = "<group>"; };
6AA2D0D3150B4B99004757C5 /* FakeSMC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeSMC.h; sourceTree = "<group>"; };
6AA710B9152B7D180006E62C /* SMBIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMBIOS.h; sourceTree = "<group>"; };
7E012DAA182D064500D5CD21 /* FakeSMCPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FakeSMCPlugin.cpp; path = FakeSMCKeyStore/FakeSMCPlugin.cpp; sourceTree = SOURCE_ROOT; };
7E012DAB182D064500D5CD21 /* FakeSMCPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FakeSMCPlugin.h; path = FakeSMCKeyStore/FakeSMCPlugin.h; sourceTree = SOURCE_ROOT; };
7E0EB890169A9A9A000DF2B1 /* evergreen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = evergreen.cpp; sourceTree = "<group>"; };
7E0EB893169A9C4D000DF2B1 /* evergreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = evergreen.h; sourceTree = "<group>"; };
7E0EB895169A9D3C000DF2B1 /* r600.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = r600.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -315,12 +325,11 @@
1D05ABE913ED0DAD00EADBF6 /* FakeSMC */ = {
isa = PBXGroup;
children = (
7E5A8CB51605EA7300FF0099 /* OEMInfo */,
6AA172C5150B415200A77CF2 /* FakeSMCDevice.h */,
6AA172C4150B415200A77CF2 /* FakeSMCDevice.cpp */,
6AA2D0D3150B4B99004757C5 /* FakeSMC.h */,
6AA2D0D2150B4B99004757C5 /* FakeSMC.cpp */,
7E5A8CB51605EA7300FF0099 /* OEMInfo */,
7EF546971828660C00E295B1 /* FakeSMCPlugin */,
1D05ABEA13ED0DAD00EADBF6 /* Supporting Files */,
);
path = FakeSMC;
Expand Down Expand Up @@ -499,6 +508,8 @@
7EFF9517182AD44700C637C8 /* FakeSMCKeyStore.cpp */,
7EFF951A182AD44700C637C8 /* FakeSMCKeyStoreUserClient.h */,
7EFF9519182AD44700C637C8 /* FakeSMCKeyStoreUserClient.cpp */,
7E012DAB182D064500D5CD21 /* FakeSMCPlugin.h */,
7E012DAA182D064500D5CD21 /* FakeSMCPlugin.cpp */,
7EFF9529182AD5C200C637C8 /* Supporting Files */,
);
name = FakeSMCKeyStore;
Expand Down Expand Up @@ -718,15 +729,6 @@
name = Kernel;
sourceTree = "<group>";
};
7EF546971828660C00E295B1 /* FakeSMCPlugin */ = {
isa = PBXGroup;
children = (
6A9C468A14E657EE0083E5E6 /* FakeSMCPlugin.h */,
6A9C468914E657EE0083E5E6 /* FakeSMCPlugin.cpp */,
);
name = FakeSMCPlugin;
sourceTree = "<group>";
};
7EFF9526182AD5C200C637C8 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -755,6 +757,7 @@
1D05ABDE13ED0DAD00EADBF6 /* Sources */,
1D05ABDF13ED0DAD00EADBF6 /* Frameworks */,
1D05ABE113ED0DAD00EADBF6 /* Resources */,
7E003634182D077A00847C4E /* CopyFiles */,
);
buildRules = (
);
Expand Down Expand Up @@ -935,13 +938,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7EFF951B182AD44700C637C8 /* FakeSMCKey.cpp in Sources */,
7EFF951C182AD44700C637C8 /* FakeSMCKeyHandler.cpp in Sources */,
7EFF951D182AD44700C637C8 /* FakeSMCKeyStore.cpp in Sources */,
7EFF951E182AD44700C637C8 /* FakeSMCKeyStoreUserClient.cpp in Sources */,
6AA172CB150B415200A77CF2 /* FakeSMCDevice.cpp in Sources */,
6AA2D0D4150B4B99004757C5 /* FakeSMC.cpp in Sources */,
6A9C468D14E657EE0083E5E6 /* FakeSMCPlugin.cpp in Sources */,
7EB73CFA1791BCBC007D93D4 /* OEMInfo.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1028,10 +1026,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7EFF9537182AD69D00C637C8 /* FakeSMCKeyStoreUserClient.cpp in Sources */,
7EFF9534182AD69D00C637C8 /* FakeSMCKey.cpp in Sources */,
7EFF9535182AD69D00C637C8 /* FakeSMCKeyHandler.cpp in Sources */,
7EFF9536182AD69D00C637C8 /* FakeSMCKeyStore.cpp in Sources */,
7EFF9537182AD69D00C637C8 /* FakeSMCKeyStoreUserClient.cpp in Sources */,
7E012DAC182D064500D5CD21 /* FakeSMCPlugin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 2 additions & 1 deletion Shared/HWSensorsVersion.pch
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

#define HWSENSORS_LASTYEAR 2013

#define FAKESMCKEYSTORE_BUNDLE org.hwsensors.driver.FakeSMCKeyStore
#define FAKESMC_BUNDLE org.netkas.driver.FakeSMC
#define ACPISENSORS_BUNDLE org.hwsensors.driver.ACPISensors
#define CPUSENSORS_BUNDLE org.hwsensors.driver.CPUSensors
#define LPCSENSORS_BUNDLE org.hwsensors.driver.LPCSensors
#define GPUSENSORS_BUNDLE org.hwsensors.driver.GPUSensors

#define FAKESMC_COMPATIBLE 915
#define FAKESMCKEYSTORE_COMPATIBLE 935
#define LPCSENSORS_COMPATIBLE 735
2 changes: 2 additions & 0 deletions SuperIOSensors/LPCSensors-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4475,6 +4475,8 @@
<string>LPCSENSORS_COMPATIBLE</string>
<key>OSBundleLibraries</key>
<dict>
<key>FAKESMCKEYSTORE_BUNDLE</key>
<string>FAKESMCKEYSTORE_COMPATIBLE</string>
<key>com.apple.iokit.IOPCIFamily</key>
<string>1.0.0b1</string>
<key>com.apple.kpi.iokit</key>
Expand Down

0 comments on commit c378c8d

Please sign in to comment.