From 9d428b57778747dd4a6ff905e5b21f656100fafe Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 26 Mar 2025 16:18:26 +0800 Subject: [PATCH] OnReleaseHardware: Close EC driver handle Previously the following HLK tests would fail and also uninstalling the device from device manager would trigger a debugger break. Already succesfully tested DF - PNP DIF Remove Device Test (Reliability) DF - PNP Rebalance Fail Restart Device Test (Reliability) Still retesting DF - Reinstall with IO Before and After (Reliability) DF - Sleep and PNP (disable and enable) with IO Before and After (Reliability) Signed-off-by: Daniel Schaefer --- FrameworkSensors/Device.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FrameworkSensors/Device.cpp b/FrameworkSensors/Device.cpp index 4869418..7c56c42 100644 --- a/FrameworkSensors/Device.cpp +++ b/FrameworkSensors/Device.cpp @@ -403,6 +403,12 @@ OnReleaseHardware( pDevice->m_Lock = NULL; } + // Close handle to EC driver + if (pDevice->m_CrosEcHandle && pDevice->m_CrosEcHandle != INVALID_HANDLE_VALUE) { + CloseHandle(pDevice->m_CrosEcHandle); + pDevice->m_CrosEcHandle = INVALID_HANDLE_VALUE; + } + // Delete sensor instance if (NULL != pDevice->m_SensorInstance) {