Opened 5 years ago

Closed 17 months ago

#2 closed enhancement (fixed)

acpiDoPowerOff() increase timeout to ensure system switches of reliable

Reported by: Andib Owned by:
Priority: minor Milestone:
Component: component1 Version:
Keywords: Cc:

Description

In \src\startshut\apm.c function VOID acpiDoPowerOff(VOID) line 406 DosSleep(700); has to be used to switch down my system reliable.

I tested this over many years and retested again the latest months. My MSI board needs 700ms instead the 250ms which is in the official sources. Shutdown on this system does not work reliable with values <700ms. Most of the time shutdown works with 250ms and 500ms too. But reliable switching off monitor out and all fans is only guaranteed with 700ms. Here is the relevant part of the code with my comments over the years. As you can see I watch this problem since many years. No clue how many systems out there are do not fully shut down sporadically as mine. But I'm pretty sure my system is not the only one. But probably I'm the only one who observed this problem and tested with different values long enough to assure this is the place where the problem can be fixed.

VOID acpiDoPowerOff(VOID)
{
     ULONG i, ulCpuCount = 1;

     /* Set all CPUs to OffLine, except CPU 1 */
     DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &ulCpuCount, sizeof(ulCpuCount));
     for (i = 2; i <= ulCpuCount; i++)
         DosSetProcessorStatus(i, PROC_OFFLINE);

    DosSleep(700);  // @@changed V1.0.9 (2009-05-29) [shl]: ensure system really has time to go idle
                    // @@changed V1.0.10(2014-04-29) [AB]: test with 500 instead 250
		// @@changed V1.0.10(2014-04-29) [AB]: test with 700 cause sometimes video out (X300) is not switched off
		// @@changed V1.0.13(2020-01-16) [AB]: test with 250 again cause this is in official version from Rich
		// @@changed V1.0.13(2020-02-16) [AB]: back to 500 as 250 definitely does not reliable switch of video out AND fans
		// @@changed V1.0.13(2020-03-01) [AB]: back to 700 as 500 is definitely not reliable too
    acpihGoToSleep(&G_hACPI, ACPI_STATE_S5);
    acpihClose(&G_hACPI);
}

Change History (3)

comment:1 by rlwalsh, 3 years ago

v1.0.15 will introduce an environment variable, "XWP_ACPIDELAY", to allow you to set the delay. Values must be > 0 and < 32768. If not set or invalid, the default will remain at 250ms.

comment:2 by Andib, 3 years ago

I completely forgot about this ticket. I've already implemented this in my branch (branch_AB) with an environment variable.

comment:3 by rlwalsh, 17 months ago

Resolution: fixed
Status: newclosed

Closing old ticket - issue resolved in last release.

Note: See TracTickets for help on using tickets.