diff options
author | Adam Jackson <ajax@theobromine.nwnk.net> | 2006-07-17 13:50:38 -0400 |
---|---|---|
committer | Adam Jackson <ajax@theobromine.nwnk.net> | 2006-07-17 13:50:38 -0400 |
commit | 881953813c7307f2aac4057b48d233e5f4a574cd (patch) | |
tree | 71e670db48b97281ff9afd61c11e7efa8b870cf5 | |
parent | f029e9a32dcaa95b84e08ec173a0cc78fd92bdbf (diff) |
Fix the Linux ACPI reopen code to use a repeating timer, rather than a
one-shot sleep-and-reopen attempt.
-rw-r--r-- | hw/xfree86/os-support/linux/lnx_acpi.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/hw/xfree86/os-support/linux/lnx_acpi.c b/hw/xfree86/os-support/linux/lnx_acpi.c index 6712c090f..eca76dbf3 100644 --- a/hw/xfree86/os-support/linux/lnx_acpi.c +++ b/hw/xfree86/os-support/linux/lnx_acpi.c @@ -36,6 +36,20 @@ static void lnxCloseACPI(void); static pointer ACPIihPtr = NULL; 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 static int @@ -52,8 +66,7 @@ lnxACPIGetEventFromOs(int fd, pmEvent *events, int num) if (n <= 0) { lnxCloseACPI(); - sleep(1); - lnxACPIOpen(); + TimerSet(NULL, 0, ACPI_REOPEN_DELAY, lnxACPIReopen, NULL); return 0; } @@ -171,4 +184,3 @@ lnxCloseACPI(void) ACPIihPtr = NULL; } } - |