diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-12-05 13:58:07 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-12-05 13:58:07 +0000 |
| commit | 763193df158ff0432fb67b37589f910b93c84c17 (patch) | |
| tree | e63ae14a1a18bd933505b2cf21cc5556a8921d51 /lib | |
| parent | 200f092160951622fbe7c3d0c207dccfab72a4be (diff) | |
| download | enigma2-763193df158ff0432fb67b37589f910b93c84c17.tar.gz enigma2-763193df158ff0432fb67b37589f910b93c84c17.zip | |
add new files
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/driver/misc_options.cpp | 48 | ||||
| -rw-r--r-- | lib/driver/misc_options.h | 20 |
2 files changed, 68 insertions, 0 deletions
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 <lib/driver/misc_options.h> + +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> + +#include <lib/base/init.h> +#include <lib/base/init_num.h> +#include <lib/base/eerror.h> + +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<Misc_Options> init_misc_options(eAutoInitNumbers::rc, "misc options"); diff --git a/lib/driver/misc_options.h b/lib/driver/misc_options.h new file mode 100644 index 00000000..6baf2cf2 --- /dev/null +++ b/lib/driver/misc_options.h @@ -0,0 +1,20 @@ +#ifndef __misc_options_h +#define __misc_options_h + +class Misc_Options +{ + static Misc_Options *instance; + int m_12V_output_state; +#ifdef SWIG + Misc_Options(); +#endif +public: +#ifndef SWIG + Misc_Options(); +#endif + static Misc_Options *getInstance(); + int set_12V_output(int val); + int get_12V_output() { return m_12V_output_state; } +}; + +#endif // __misc_options_h |
