Skip to content

Commit

Permalink
Do not override CPU proximity SMC key in SMCDellSensors, clear activi…
Browse files Browse the repository at this point in the history
…ty counter in timer
  • Loading branch information
lvs1974 committed Nov 19, 2021
1 parent 6da45d0 commit 3df3e11
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
VirtualSMC Changelog
====================
#### v1.2.8
- Do not override CPU proximity SMC key in SMCDellSensors + minor fixes in logic

#### v1.2.7
- Fixed build settings for 32-bit
- Improved EC fan monitoring instructions, thx all the contributors
Expand Down
6 changes: 0 additions & 6 deletions Sensors/SMCDellSensors/KeyImplementations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ SMC_RESULT FS__::update(const SMC_DATA *src) {
return SmcSuccess;
}

SMC_RESULT TC0P::readAccess() {
auto val = SMIMonitor::getShared()->state.tempInfo[index].temp;
*reinterpret_cast<uint16_t *>(data) = VirtualSMCAPI::encodeIntSp(SmcKeyTypeSp78, val);
return SmcSuccess;
}

SMC_RESULT TG0P::readAccess() {
auto val = SMIMonitor::getShared()->state.tempInfo[index].temp;
*reinterpret_cast<uint16_t *>(data) = VirtualSMCAPI::encodeIntSp(SmcKeyTypeSp78, val);
Expand Down
3 changes: 1 addition & 2 deletions Sensors/SMCDellSensors/SMCDellSensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ IOService *SMCDellSensors::probe(IOService *provider, SInt32 *score) {
switch (type)
{
case TempInfo::CPU:
VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TC0P(i),
SMC_KEY_ATTRIBUTE_WRITE|SMC_KEY_ATTRIBUTE_READ));
DBGLOG("sdell", "CPU Proximity sensor is handled by SMCProcessor plugin");
break;
case TempInfo::GPU:
VirtualSMCAPI::addKey(KeyTG0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TG0P(i),
Expand Down
1 change: 0 additions & 1 deletion Sensors/SMCDellSensors/SMCDellSensors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class EXPORT SMCDellSensors : public IOService {
// the following constant defines smc key 'FS! '
static constexpr SMC_KEY KeyFS__ = SMC_MAKE_IDENTIFIER('F','S','!',' ');

static constexpr SMC_KEY KeyTC0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'P'); }
static constexpr SMC_KEY KeyTG0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','G',KeyIndexes[i],'P'); }
static constexpr SMC_KEY KeyTm0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','m',KeyIndexes[i],'P'); }
static constexpr SMC_KEY KeyTN0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','N',KeyIndexes[i],'P'); }
Expand Down
3 changes: 2 additions & 1 deletion Sensors/SMCDellSensors/kern_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void KERNELHOOKS::deinit()

void KERNELHOOKS::activateTimer(UInt32 delay)
{
callbackKERNELHOOKS->eventTimer->cancelTimeout();
callbackKERNELHOOKS->eventTimer->setTimeoutMS(delay);
}

Expand Down Expand Up @@ -184,7 +185,7 @@ void KERNELHOOKS::processKext(KernelPatcher &patcher, size_t index, mach_vm_addr
if (workLoop) {
eventTimer = IOTimerEventSource::timerEventSource(workLoop,
[](OSObject *owner, IOTimerEventSource *) {
if (atomic_load_explicit(&KERNELHOOKS::active_output, memory_order_acquire))
while (atomic_load_explicit(&KERNELHOOKS::active_output, memory_order_acquire))
atomic_fetch_sub_explicit(&active_output, 1, memory_order_release);
});

Expand Down

0 comments on commit 3df3e11

Please sign in to comment.