Skip to content

Commit bd660e2

Browse files
JohnAZoidbergclaude
andcommitted
OnD0Exit: Close EC handle before sleep
Close the EC driver handle during D0 exit to avoid stale handles after wake. The EC driver may restart during sleep, invalidating the handle. The handle will be re-acquired in OnTimerExpire when the device wakes. This fixes the HLK "DF - Sleep with IO during (Reliability)" test failure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9d48c55 commit bd660e2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

FrameworkSensors/Device.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ OnD0Exit(
479479
goto Exit;
480480
}
481481

482+
// Close EC handle before sleep to avoid stale handles after wake.
483+
// The handle will be re-acquired in OnTimerExpire when the device wakes.
484+
if (pDevice->m_CrosEcHandle != INVALID_HANDLE_VALUE) {
485+
CloseHandle(pDevice->m_CrosEcHandle);
486+
pDevice->m_CrosEcHandle = INVALID_HANDLE_VALUE;
487+
}
488+
482489
pDevice->m_PoweredOn = FALSE;
483490
InitPropVariantFromUInt32(SensorState_Idle,
484491
&(pDevice->m_pProperties->List[SENSOR_COMMON_PROPERTY_STATE].Value));

0 commit comments

Comments
 (0)