hd51: fix wakeup from standby

Origin commit data
------------------
Commit: c4a59375b3
Author: TangoCash <eric@loxat.de>
Date: 2017-11-09 (Thu, 09 Nov 2017)
This commit is contained in:
TangoCash
2017-11-09 20:02:20 +01:00
committed by Thilo Graf
parent 47be7fdb01
commit d3e1d344c5

View File

@@ -2153,6 +2153,18 @@ void wake_up(bool &wakeup)
} }
printf("[timerd] wakeup from standby: %s\n", wakeup ? "yes" : "no"); printf("[timerd] wakeup from standby: %s\n", wakeup ? "yes" : "no");
#endif #endif
#if HAVE_ARM_HARDWARE
FILE *f = fopen("/proc/stb/fp/was_timer_wakeup", "r");
if (f)
{
unsigned int tmp;
if (fscanf(f, "%u", &tmp) != 1)
printf("[neutrino] read /proc/stb/fp/was_timer_wakeup failed: %m\n");
else
wakeup = (tmp > 0);
fclose(f);
}
#endif // HAVE_ARM_HARDWARE
/* not platform specific - this is created by the init process */ /* not platform specific - this is created by the init process */
if (access("/tmp/.timer_wakeup", F_OK) == 0) { if (access("/tmp/.timer_wakeup", F_OK) == 0) {
wakeup = 1; wakeup = 1;
@@ -3886,6 +3898,21 @@ void CNeutrinoApp::ExitRun(int can_shutdown)
#endif #endif
if (timer_minutes || leds) if (timer_minutes || leds)
{ {
#if HAVE_ARM_HARDWARE
FILE *f = fopen("/proc/stb/fp/wakeup_time","w");
if (f)
{
time_t t = timer_minutes * 60;
struct tm *tm = localtime(&t);
char date[30];
strftime(date, sizeof(date), "%c", tm);
fprintf(stderr, "timer_wakeup: %s (%ld)\n", date, timer_minutes * 60);
fprintf(f, "%ld\n", timer_minutes * 60);
fclose(f);
}
else
perror("fopen /proc/stb/fp/wakeup_time");
#else
FILE *f = fopen("/tmp/.timer", "w"); FILE *f = fopen("/tmp/.timer", "w");
if (f) if (f)
{ {
@@ -3897,6 +3924,7 @@ void CNeutrinoApp::ExitRun(int can_shutdown)
} }
else else
perror("fopen /tmp/.timer"); perror("fopen /tmp/.timer");
#endif
} }
delete g_RCInput; delete g_RCInput;