mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
neutrino: use proc_put() to write to procfs
Origin commit data
------------------
Commit: b428762509
Author: vanhofen <vanhofen@gmx.de>
Date: 2019-12-29 (Sun, 29 Dec 2019)
Origin message was:
------------------
- neutrino: use proc_put() to write to procfs
This commit is contained in:
@@ -124,6 +124,7 @@
|
|||||||
#include <system/setting_helpers.h>
|
#include <system/setting_helpers.h>
|
||||||
#include <system/settings.h>
|
#include <system/settings.h>
|
||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
|
#include <system/proc_tools.h>
|
||||||
#include <system/sysload.h>
|
#include <system/sysload.h>
|
||||||
|
|
||||||
#include <timerdclient/timerdclient.h>
|
#include <timerdclient/timerdclient.h>
|
||||||
@@ -4439,8 +4440,6 @@ void CNeutrinoApp::ExitRun(int exit_code)
|
|||||||
#endif
|
#endif
|
||||||
if (exit_code != CNeutrinoApp::EXIT_REBOOT)
|
if (exit_code != CNeutrinoApp::EXIT_REBOOT)
|
||||||
{
|
{
|
||||||
FILE *f;
|
|
||||||
|
|
||||||
if (timer_minutes)
|
if (timer_minutes)
|
||||||
{
|
{
|
||||||
/* prioritize proc filesystem */
|
/* prioritize proc filesystem */
|
||||||
@@ -4451,56 +4450,24 @@ void CNeutrinoApp::ExitRun(int exit_code)
|
|||||||
strftime(date, sizeof(date), "%c", lt);
|
strftime(date, sizeof(date), "%c", lt);
|
||||||
printf("wakeup time : %s (%ld)\n", date, timer_minutes * 60);
|
printf("wakeup time : %s (%ld)\n", date, timer_minutes * 60);
|
||||||
|
|
||||||
// FIXME: use proc_put()
|
proc_put("/proc/stb/fp/wakeup_time", timer_minutes * 60);
|
||||||
|
|
||||||
if (access("/proc/stb/fp/wakeup_time", F_OK) == 0)
|
|
||||||
{
|
|
||||||
f = fopen("/proc/stb/fp/wakeup_time","w");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
fprintf(f, "%ld\n", timer_minutes * 60);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
perror("fopen /proc/stb/fp/wakeup_time");
|
|
||||||
}
|
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
lt = localtime(&t);
|
lt = localtime(&t);
|
||||||
strftime(date, sizeof(date), "%c", lt);
|
strftime(date, sizeof(date), "%c", lt);
|
||||||
printf("current time: %s (%ld)\n", date, t);
|
printf("current time: %s (%ld)\n", date, t);
|
||||||
|
|
||||||
if (access("/proc/stb/fp/rtc", F_OK) == 0)
|
proc_put("/proc/stb/fp/rtc", t);
|
||||||
{
|
|
||||||
f = fopen("/proc/stb/fp/rtc","w");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
fprintf(f, "%ld\n", t);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
perror("fopen /proc/stb/fp/rtc");
|
|
||||||
}
|
|
||||||
|
|
||||||
struct tm *gt = gmtime(&t);
|
struct tm *gt = gmtime(&t);
|
||||||
int offset = (lt->tm_hour - gt->tm_hour) * 3600;
|
int offset = (lt->tm_hour - gt->tm_hour) * 3600;
|
||||||
printf("rtc_offset : %d\n", offset);
|
printf("rtc_offset : %d\n", offset);
|
||||||
|
|
||||||
if (access("/proc/stb/fp/rtc_offset", F_OK) == 0)
|
proc_put("/proc/stb/fp/rtc_offset", offset);
|
||||||
{
|
|
||||||
f = fopen("/proc/stb/fp/rtc_offset","w");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
fprintf(f, "%d\n", offset);
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
perror("fopen /proc/stb/fp/rtc_offset");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not platform specific */
|
/* not platform specific */
|
||||||
f = fopen("/tmp/.timer", "w");
|
FILE *f = fopen("/tmp/.timer", "w");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
fprintf(f, "%ld\n", timer_minutes ? timer_minutes * 60 : 0);
|
fprintf(f, "%ld\n", timer_minutes ? timer_minutes * 60 : 0);
|
||||||
|
Reference in New Issue
Block a user