From 763193df158ff0432fb67b37589f910b93c84c17 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Tue, 5 Dec 2006 13:58:07 +0000 Subject: add new files --- lib/driver/misc_options.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 lib/driver/misc_options.cpp (limited to 'lib/driver/misc_options.cpp') diff --git a/lib/driver/misc_options.cpp b/lib/driver/misc_options.cpp new file mode 100644 index 00000000..ecb7bdb1 --- /dev/null +++ b/lib/driver/misc_options.cpp @@ -0,0 +1,48 @@ +#include + +#include +#include +#include + +#include +#include +#include + +Misc_Options *Misc_Options::instance = 0; + +Misc_Options::Misc_Options() + :m_12V_output_state(-1) +{ + ASSERT(!instance); + instance = this; +} + +int Misc_Options::set_12V_output(int state) +{ + if (state == m_12V_output_state) + return 0; + int fd = open("/proc/stb/misc/12V_output", O_WRONLY); + if (fd < 0) + { + eDebug("couldn't open /proc/stb/misc/12V_output"); + return -1; + } + const char *str=0; + if (state == 0) + str = "off"; + else if (state == 1) + str = "on"; + if (str) + write(fd, str, strlen(str)); + m_12V_output_state = state; + close(fd); + return 0; +} + +Misc_Options *Misc_Options::getInstance() +{ + return instance; +} + +//FIXME: correct "run/startlevel" +eAutoInitP0 init_misc_options(eAutoInitNumbers::rc, "misc options"); -- cgit v1.2.3