Fix the Linux ACPI reopen code to use a repeating timer, rather than a

one-shot sleep-and-reopen attempt.
This commit is contained in:
Adam Jackson 2006-07-17 13:50:38 -04:00
parent f029e9a32d
commit 881953813c

View File

@ -36,6 +36,20 @@ static void lnxCloseACPI(void);
static pointer ACPIihPtr = NULL; static pointer ACPIihPtr = NULL;
PMClose lnxACPIOpen(void); PMClose lnxACPIOpen(void);
/* in milliseconds */
#define ACPI_REOPEN_DELAY 1000
static CARD32
lnxACPIReopen(OsTimerPtr timer, CARD32 time, pointer arg)
{
if (lnxACPIOpen()) {
TimerFree(timer);
return 0;
}
return ACPI_REOPEN_DELAY;
}
#define LINE_LENGTH 80 #define LINE_LENGTH 80
static int static int
@ -52,8 +66,7 @@ lnxACPIGetEventFromOs(int fd, pmEvent *events, int num)
if (n <= 0) { if (n <= 0) {
lnxCloseACPI(); lnxCloseACPI();
sleep(1); TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL);
lnxACPIOpen();
return 0; return 0;
} }
@ -171,4 +184,3 @@ lnxCloseACPI(void)
ACPIihPtr = NULL; ACPIihPtr = NULL;
} }
} }