diff options
| author | Andreas Oberritter <obi@opendreambox.org> | 2010-11-23 14:01:44 +0100 |
|---|---|---|
| committer | Andreas Oberritter <obi@opendreambox.org> | 2010-11-23 14:01:44 +0100 |
| commit | c4d7f98e70694e471409cda6de03d0f3b5816f27 (patch) | |
| tree | 8cae9b3d3b6ee59a5a11da6f8702fc1ee2b1861a /lib | |
| parent | 7b2960a205f3c3e3b421d1664cd38644b3ffb679 (diff) | |
| parent | ed472ea627a958bc8dfb375ca03329624f1aed9c (diff) | |
| download | enigma2-c4d7f98e70694e471409cda6de03d0f3b5816f27.tar.gz enigma2-c4d7f98e70694e471409cda6de03d0f3b5816f27.zip | |
Merge branch 'obi/master'
Diffstat (limited to 'lib')
74 files changed, 1669 insertions, 494 deletions
diff --git a/lib/actions/.gitignore b/lib/actions/.gitignore new file mode 100644 index 00000000..460e43d2 --- /dev/null +++ b/lib/actions/.gitignore @@ -0,0 +1 @@ +actionids.h diff --git a/lib/actions/Makefile.am b/lib/actions/Makefile.am index 8da583f7..eb8327d7 100644 --- a/lib/actions/Makefile.am +++ b/lib/actions/Makefile.am @@ -1,15 +1,27 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h + +EXTRA_DIST = parseactions.py noinst_LIBRARIES = libenigma_actions.a libenigma_actions_a_SOURCES = \ - action.cpp + action.cpp -CLEANFILES = actionids.h +actionsincludedir = $(pkgincludedir)/lib/actions +actionsinclude_HEADERS = \ + action.h -action.cpp: actionids.h +nodist_actionsinclude_HEADERS = \ + actionids.h + +BUILT_SOURCES = actionids.h +CLEANFILES = actionids.h -actionids.h: - python ./parseactions.py include ../gui/*.h > actionids.h - python ./parseactions.py parse ../gui/*.h >> actionids.h +actionids.h: $(srcdir)/parseactions.py $(top_srcdir)/lib/gui/*.h + $(AM_V_GEN)$(PYTHON) $(srcdir)/parseactions.py include $(top_srcdir)/lib/gui/*.h > $@ + $(AM_V_at)$(PYTHON) $(srcdir)/parseactions.py parse $(top_srcdir)/lib/gui/*.h >> $@ diff --git a/lib/actions/action.h b/lib/actions/action.h index cbf5370a..edcfac6f 100644 --- a/lib/actions/action.h +++ b/lib/actions/action.h @@ -3,10 +3,6 @@ #include <lib/base/object.h> - /* avoid warnigs :) */ -#include <features.h> -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200112L #include <lib/python/python.h> #include <string> #include <map> diff --git a/lib/actions/parseactions.py b/lib/actions/parseactions.py index 2462a751..cad432a7 100644 --- a/lib/actions/parseactions.py +++ b/lib/actions/parseactions.py @@ -89,7 +89,7 @@ def do_file(f, mode): if mode == "include": # hack hack hack!! - print "#include <lib" + f[2:] + ">" + print "#include <lib/" + '/'.join(f.split('/')[-2:]) + ">" else: print "\t// " + f diff --git a/lib/base/.gitignore b/lib/base/.gitignore new file mode 100644 index 00000000..aa9ae18f --- /dev/null +++ b/lib/base/.gitignore @@ -0,0 +1 @@ +eenv.cpp diff --git a/lib/base/Makefile.am b/lib/base/Makefile.am index 05085632..7f04abfa 100644 --- a/lib/base/Makefile.am +++ b/lib/base/Makefile.am @@ -1,12 +1,56 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_base.a libenigma_base_a_SOURCES = \ - buffer.cpp ebase.cpp eerror.cpp elock.cpp \ - init.cpp message.cpp thread.cpp \ - smartptr.cpp estring.cpp connection.cpp \ - filepush.cpp encoding.cpp console.cpp rawfile.cpp \ - nconfig.cpp ioprio.cpp etpm.cpp + buffer.cpp \ + connection.cpp \ + console.cpp \ + ebase.cpp \ + eenv.cpp \ + eerror.cpp \ + elock.cpp \ + encoding.cpp \ + estring.cpp \ + etpm.cpp \ + filepush.cpp \ + init.cpp \ + ioprio.cpp \ + message.cpp \ + nconfig.cpp \ + rawfile.cpp \ + smartptr.cpp \ + thread.cpp +EXTRA_DIST = \ + eenv.cpp.in + +baseincludedir = $(pkgincludedir)/lib/base +baseinclude_HEADERS = \ + buffer.h \ + console.h \ + ebase.h \ + eenv.h \ + eerror.h \ + elock.h \ + encoding.h \ + eptrlist.h \ + estring.h \ + etpm.h \ + filepush.h \ + i18n.h \ + idatasource.h \ + init.h \ + init_num.h \ + ioprio.h \ + message.h \ + nconfig.h \ + object.h \ + rawfile.h \ + ringbuffer.h \ + smartptr.h \ + thread.h diff --git a/lib/base/console.h b/lib/base/console.h index e730b40e..60540da0 100644 --- a/lib/base/console.h +++ b/lib/base/console.h @@ -1,7 +1,6 @@ #ifndef __LIB_BASE_CONSOLE_H__ #define __LIB_BASE_CONSOLE_H__ -#include "Python.h" #include <string> #include <lib/base/ebase.h> #include <lib/python/connections.h> diff --git a/lib/base/eenv.cpp.in b/lib/base/eenv.cpp.in new file mode 100644 index 00000000..52c42147 --- /dev/null +++ b/lib/base/eenv.cpp.in @@ -0,0 +1,117 @@ +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <wordexp.h> +#include <lib/base/eenv.h> +#include <lib/base/eerror.h> + +bool eEnv::initialized = false; + +void eEnv::initialize() +{ + static const struct { + std::string name; + std::string value; + } cfgenv[] = { + { "prefix", "@prefix@" }, + { "exec_prefix", "@exec_prefix@" }, + { "bindir", "@bindir@" }, + { "sbindir", "@sbindir@" }, + { "libexecdir", "@libexecdir@" }, + { "datarootdir", "@datarootdir@" }, + { "datadir", "@datadir@" }, + { "sysconfdir", "@sysconfdir@" }, + { "sharedstatedir", "@sharedstatedir@" }, + { "localstatedir", "@localstatedir@" }, + { "libdir", "@libdir@" }, + { "localedir", "@localedir@" }, + }; + size_t i; + + // 1st pass, as generated by configure. + // Variables set by the user will not be overwritten. + for (i = 0; i < (sizeof(cfgenv) / sizeof(*cfgenv)); i++) { + eDebug("setenv('%s', '%s', 0)", cfgenv[i].name.c_str(), cfgenv[i].value.c_str()); + setenv(cfgenv[i].name.c_str(), cfgenv[i].value.c_str(), 0); + } + + // 2nd pass: Resolve directories. + for (i = 0; i < (sizeof(cfgenv) / sizeof(*cfgenv)); i++) { + std::string dest; + eEnv::resolveVar(dest, "${" + cfgenv[i].name + "}"); + eDebug("setenv('%s', '%s', 1)", cfgenv[i].name.c_str(), dest.c_str()); + setenv(cfgenv[i].name.c_str(), dest.c_str(), 1); + } +} + +int eEnv::resolveVar(std::string &dest, const char *src) +{ + size_t i = 0; + int ret; + wordexp_t p; + + ret = wordexp(src, &p, WRDE_NOCMD | WRDE_UNDEF); + if (ret != 0) { + switch (ret) { + case WRDE_BADCHAR: + eDebug("%s: bad character", __func__); + break; + case WRDE_BADVAL: + eDebug("%s: bad value", __func__); + break; + case WRDE_CMDSUB: + eDebug("%s: invalid command substitution", __func__); + break; + case WRDE_NOSPACE: + eDebug("%s: out of memory", __func__); + break; + case WRDE_SYNTAX: + eDebug("%s: syntax error", __func__); + break; + default: + eDebug("%s: unknown error", __func__); + break; + } + + return -1; + } + + while (i < p.we_wordc) { + if (strchr(p.we_wordv[i], '$')) { + ret = eEnv::resolveVar(dest, p.we_wordv[i]); + if (ret < 0) + break; + } else { + dest.append(p.we_wordv[i]); + } + + if (++i < p.we_wordc) + dest.append(" "); + } + + wordfree(&p); + return ret; +} + +int eEnv::resolveVar(std::string &dest, const std::string &src) +{ + return eEnv::resolveVar(dest, src.c_str()); +} + +std::string eEnv::resolve(const std::string &src) +{ + std::string dest; + + if (!initialized) { + eEnv::initialize(); + initialized = true; + } + + eDebug("%s: resolve %s", __func__, src.c_str()); + + eEnv::resolveVar(dest, src); + + eDebug("%s: -> %s", __func__, dest.c_str()); + + return dest; +} diff --git a/lib/base/eenv.h b/lib/base/eenv.h new file mode 100644 index 00000000..3d149f5e --- /dev/null +++ b/lib/base/eenv.h @@ -0,0 +1,16 @@ +#ifndef __lib_base_paths_h +#define __lib_base_paths_h + +#include <string> + +class eEnv { +private: + static bool initialized; + static void initialize(); + static int resolveVar(std::string &dest, const char *src); + static int resolveVar(std::string &dest, const std::string &src); +public: + static std::string resolve(const std::string &path); +}; + +#endif diff --git a/lib/base/encoding.cpp b/lib/base/encoding.cpp index 8b4b592b..361acce5 100644 --- a/lib/base/encoding.cpp +++ b/lib/base/encoding.cpp @@ -2,6 +2,7 @@ #include <cstdlib> #include <lib/base/encoding.h> #include <lib/base/eerror.h> +#include <lib/base/eenv.h> eDVBTextEncodingHandler encodingHandler; // the one and only instance @@ -17,8 +18,8 @@ inline char toupper(char c) eDVBTextEncodingHandler::eDVBTextEncodingHandler() { - const char * file=DATADIR "/enigma2/encoding.conf"; - FILE *f = fopen(file, "rt"); + std::string file = eEnv::resolve("${datadir}/enigma2/encoding.conf"); + FILE *f = fopen(file.c_str(), "rt"); if (f) { char *line = (char*) malloc(256); @@ -61,7 +62,7 @@ eDVBTextEncodingHandler::eDVBTextEncodingHandler() free(line); } else - eDebug("[eDVBTextEncodingHandler] couldn't open %s !", file); + eDebug("[eDVBTextEncodingHandler] couldn't open %s !", file.c_str()); } void eDVBTextEncodingHandler::getTransponderDefaultMapping(int tsidonid, int &table) diff --git a/lib/components/Makefile.am b/lib/components/Makefile.am index e377ab85..364c6945 100644 --- a/lib/components/Makefile.am +++ b/lib/components/Makefile.am @@ -1,6 +1,16 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_components.a -libenigma_components_a_SOURCES = scan.cpp file_eraser.cpp +libenigma_components_a_SOURCES = \ + file_eraser.cpp \ + scan.cpp + +componentsincludedir = $(pkgincludedir)/lib/components +componentsinclude_HEADERS = \ + file_eraser.h \ + scan.h diff --git a/lib/driver/Makefile.am b/lib/driver/Makefile.am index de1271b6..b498a6c8 100644 --- a/lib/driver/Makefile.am +++ b/lib/driver/Makefile.am @@ -1,7 +1,38 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h + +AM_CXXFLAGS = \ + $(LIBSDL_CFLAGS) noinst_LIBRARIES = libenigma_driver.a libenigma_driver_a_SOURCES = \ - rc.cpp rcinput.cpp rcconsole.cpp avswitch.cpp rfmod.cpp etimezone.cpp misc_options.cpp + avswitch.cpp \ + etimezone.cpp \ + misc_options.cpp \ + rc.cpp \ + rcconsole.cpp \ + rcinput.cpp \ + rfmod.cpp + +driverincludedir = $(pkgincludedir)/lib/driver +driverinclude_HEADERS = \ + avswitch.h \ + etimezone.h \ + input_fake.h \ + misc_options.h \ + rc.h \ + rcconsole.h \ + rcdbox.h \ + rcdreambox2.h \ + rcinput.h \ + rfmod.h + +if HAVE_LIBSDL +libenigma_driver_a_SOURCES += \ + rcsdl.cpp \ + rcsdl.h +endif diff --git a/lib/driver/rcconsole.cpp b/lib/driver/rcconsole.cpp index eb5aee3d..97a6e7c7 100644 --- a/lib/driver/rcconsole.cpp +++ b/lib/driver/rcconsole.cpp @@ -5,7 +5,7 @@ #include <stdio.h> #include <fcntl.h> -eRCConsoleDriver::eRCConsoleDriver(const char *filename): eRCDriver(eRCInput::getInstance()) +eRCConsoleDriver::eRCConsoleDriver(const char *filename): eRCDriver(eRCInput::getInstance()), m_escape(false) { handle=open(filename, O_RDONLY|O_NONBLOCK); if (handle<0) @@ -38,7 +38,7 @@ void eRCConsoleDriver::keyPressed(int) unsigned char data[16]; unsigned char *d = data; int num = read(handle, data, 16); - int code=-1; + unsigned char code; int km = input->getKeyboardMode(); @@ -47,42 +47,29 @@ void eRCConsoleDriver::keyPressed(int) while (num--) { -// eDebug("console code %08x\n", *d); - if (km == eRCInput::kmAll) - code = *d++; - else - { - if (*d == 27) // escape code - { - while (num) - { - num--; - if (*++d != '[') - break; - } - code = -1; - } else - code = *d; - ++d; - - if (code < 32) /* control characters */ - code = -1; - else switch(code) - { - case 0x7E: // mute, einfg, entf - case 0x7F: // backspace - code = -1; - default: - break; + code = *d++; +// eDebug("console code %02x\n", code); + if (km == eRCInput::kmAscii) { + if (m_escape) { + if (code != '[') + m_escape = false; + continue; } + + if (code == 27) // escape code + m_escape = true; + + if ((code < 32) || // control characters + (code == 0x7e) || // mute, einfg, entf + (code == 0x7f)) // backspace + continue; } - if (code != -1) - for (std::list<eRCDevice*>::iterator i(listeners.begin()); i!=listeners.end(); ++i) - { -// eDebug("ascii %08x", code); - (*i)->handleCode(code); - } + for (std::list<eRCDevice*>::iterator i(listeners.begin()); i!=listeners.end(); ++i) + { +// eDebug("ascii %02x", code); + (*i)->handleCode(code); + } } } diff --git a/lib/driver/rcconsole.h b/lib/driver/rcconsole.h index 85234d5b..8a24612c 100644 --- a/lib/driver/rcconsole.h +++ b/lib/driver/rcconsole.h @@ -10,6 +10,7 @@ class eRCConsoleDriver: public eRCDriver protected: int handle; ePtr<eSocketNotifier> sn; + bool m_escape; void keyPressed(int); public: eRCConsoleDriver(const char *filename); diff --git a/lib/driver/rcsdl.cpp b/lib/driver/rcsdl.cpp new file mode 100644 index 00000000..a907b80a --- /dev/null +++ b/lib/driver/rcsdl.cpp @@ -0,0 +1,390 @@ +#include <lib/driver/rcsdl.h> +//#include <lib/actions/action.h> +#include <lib/base/init.h> +#include <lib/base/init_num.h> +#include <lib/driver/input_fake.h> + +/* + * eSDLInputDevice + */ + +eSDLInputDevice::eSDLInputDevice(eRCDriver *driver) : eRCDevice("SDL", driver), m_escape(false), m_unicode(0) +{ +} + +eSDLInputDevice::~eSDLInputDevice() +{ +} + +void eSDLInputDevice::handleCode(long arg) +{ + const SDL_KeyboardEvent *event = (const SDL_KeyboardEvent *)arg; + const SDL_keysym *key = &event->keysym; + int km = input->getKeyboardMode(); + int code, flags; + + if (event->type == SDL_KEYDOWN) { + m_unicode = key->unicode; + flags = eRCKey::flagMake; + } else { + flags = eRCKey::flagBreak; + } + + if (km == eRCInput::kmNone) { + code = translateKey(key->sym); + } else { + eDebug("unicode=%04x scancode=%02x", m_unicode, key->scancode); + if (m_unicode & 0xff80) { + eDebug("SDL: skipping unicode character"); + return; + } + code = m_unicode & ~0xff80; + // unicode not set...!? use key symbol + if (code == 0) { + // keysym is ascii + if (key->sym >= 128) { + eDebug("SDL: cannot emulate ASCII"); + return; + } + eDebug("SDL: emulate ASCII"); + code = key->sym; + } + if (km == eRCInput::kmAscii) { + // skip ESC c or ESC '[' c + if (m_escape) { + if (code != '[') + m_escape = false; + return; + } + + if (code == SDLK_ESCAPE) + m_escape = true; + + if ((code < SDLK_SPACE) || + (code == 0x7e) || // really? + (code == SDLK_DELETE)) + return; + } + flags |= eRCKey::flagAscii; + } + + eDebug("SDL code=%d flags=%d", code, flags); + input->keyPressed(eRCKey(this, code, flags)); +} + +const char *eSDLInputDevice::getDescription() const +{ + return "SDL"; +} + +int eSDLInputDevice::translateKey(SDLKey key) +{ + #define P(a) case SDLK_##a: return KEY_##a + #define P2(a,b) case SDLK_##a: return KEY_##b + + switch (key) { + P(BACKSPACE); + P(TAB); + P(CLEAR); + P2(RETURN,ENTER); + P(PAUSE); + P2(ESCAPE,ESC); + P(SPACE); +#if 0 + P(EXCLAIM); + P(QUOTEDBL); + P(HASH); +#endif + P(DOLLAR); +#if 0 + P(AMPERSAND); +#endif + P2(QUOTE,APOSTROPHE); +#if 0 + P(LEFTPAREN); + P(RIGHTPAREN); + P(ASTERISK); + P(PLUS); +#endif + P(COMMA); + P(MINUS); + P2(PERIOD,DOT); + P(SLASH); + P(0); + P(1); + P(2); + P(3); + P(4); + P(5); + P(6); + P(7); + P(8); + P(9); +#if 0 + P(COLON); +#endif + P(SEMICOLON); +#if 0 + P(LESS); +#endif + P2(EQUALS,EQUAL); +#if 0 + P(GREATER); +#endif + P(QUESTION); +#if 0 + P(AT); +#endif + P2(LEFTBRACKET,LEFTBRACE); + P(BACKSLASH); + P2(RIGHTBRACKET,RIGHTBRACE); + P2(CARET,GRAVE); +#if 0 + P(UNDERSCORE); + P(BACKQUOTE); +#endif + P2(a,A); + P2(b,B); + P2(c,C); + P2(d,D); + P2(e,E); + P2(f,F); + P2(g,G); + P2(h,H); + P2(i,I); + P2(j,J); + P2(k,K); + P2(l,L); + P2(m,M); + P2(n,N); + P2(o,O); + P2(p,P); + P2(q,Q); + P2(r,R); + P2(s,S); + P2(t,T); + P2(u,U); + P2(v,V); + P2(w,W); + P2(x,X); + P2(y,Y); + P2(z,Z); + P(DELETE); +#if 0 + P(WORLD_0); + P(WORLD_1); + P(WORLD_2); + P(WORLD_3); + P(WORLD_4); + P(WORLD_5); + P(WORLD_6); + P(WORLD_7); + P(WORLD_8); + P(WORLD_9); + P(WORLD_10); + P(WORLD_11); + P(WORLD_12); + P(WORLD_13); + P(WORLD_14); + P(WORLD_15); + P(WORLD_16); + P(WORLD_17); + P(WORLD_18); + P(WORLD_19); + P(WORLD_20); + P(WORLD_21); + P(WORLD_22); + P(WORLD_23); + P(WORLD_24); + P(WORLD_25); + P(WORLD_26); + P(WORLD_27); + P(WORLD_28); + P(WORLD_29); + P(WORLD_30); + P(WORLD_31); + P(WORLD_32); + P(WORLD_33); + P(WORLD_34); + P(WORLD_35); + P(WORLD_36); + P(WORLD_37); + P(WORLD_38); + P(WORLD_39); + P(WORLD_40); + P(WORLD_41); + P(WORLD_42); + P(WORLD_43); + P(WORLD_44); + P(WORLD_45); + P(WORLD_46); + P(WORLD_47); + P(WORLD_48); + P(WORLD_49); + P(WORLD_50); + P(WORLD_51); + P(WORLD_52); + P(WORLD_53); + P(WORLD_54); + P(WORLD_55); + P(WORLD_56); + P(WORLD_57); + P(WORLD_58); + P(WORLD_59); + P(WORLD_60); + P(WORLD_61); + P(WORLD_62); + P(WORLD_63); + P(WORLD_64); + P(WORLD_65); + P(WORLD_66); + P(WORLD_67); + P(WORLD_68); + P(WORLD_69); + P(WORLD_70); + P(WORLD_71); + P(WORLD_72); + P(WORLD_73); + P(WORLD_74); + P(WORLD_75); + P(WORLD_76); + P(WORLD_77); + P(WORLD_78); + P(WORLD_79); + P(WORLD_80); + P(WORLD_81); + P(WORLD_82); + P(WORLD_83); + P(WORLD_84); + P(WORLD_85); + P(WORLD_86); + P(WORLD_87); + P(WORLD_88); + P(WORLD_89); + P(WORLD_90); + P(WORLD_91); + P(WORLD_92); + P(WORLD_93); + P(WORLD_94); + P(WORLD_95); +#endif + P(KP0); + P(KP1); + P(KP2); + P(KP3); + P(KP4); + P(KP5); + P(KP6); + P(KP7); + P(KP8); + P(KP9); + P2(KP_PERIOD,KPDOT); + P2(KP_DIVIDE,KPSLASH); + P2(KP_MULTIPLY,KPASTERISK); + P2(KP_MINUS,KPMINUS); + P2(KP_PLUS,KPPLUS); + P2(KP_ENTER,KPENTER); + P2(KP_EQUALS,KPEQUAL); + P(UP); + P(DOWN); + P(RIGHT); + P(LEFT); + P(INSERT); + P(HOME); + P(END); + P(PAGEUP); + P(PAGEDOWN); + P(F1); + P(F2); + P(F3); + P(F4); + P(F5); + P(F6); + P(F7); + P(F8); + P(F9); + P(F10); + P(F11); + P(F12); + P(F13); + P(F14); + P(F15); + P(NUMLOCK); + P(CAPSLOCK); + P2(SCROLLOCK,SCROLLLOCK); + P2(RSHIFT,RIGHTSHIFT); + P2(LSHIFT,LEFTSHIFT); + P2(RCTRL,RIGHTCTRL); + P2(LCTRL,LEFTCTRL); + P2(RALT,RIGHTALT); + P2(LALT,LEFTALT); + P2(RMETA,RIGHTMETA); + P2(LMETA,LEFTMETA); +#if 0 + P(LSUPER); + P(RSUPER); +#endif + P(MODE); + P(COMPOSE); + P(HELP); + P(PRINT); + P2(SYSREQ,SYSRQ); + P(BREAK); + P(MENU); + P(POWER); + P(EURO); + P(UNDO); + default: + eDebug("unhandled SDL keycode: %d", key); + return KEY_RESERVED; + } + + #undef P2 + #undef P +} + +/* + * eSDLInputDriver + */ + +eSDLInputDriver *eSDLInputDriver::instance; + +eSDLInputDriver::eSDLInputDriver() : eRCDriver(eRCInput::getInstance()) +{ + ASSERT(instance == 0); + instance = this; +} + +eSDLInputDriver::~eSDLInputDriver() +{ + instance = 0; +} + +void eSDLInputDriver::keyPressed(const SDL_KeyboardEvent *key) +{ + eDebug("km=%d enabled=%d locked=%d", + input->getKeyboardMode(), enabled, input->islocked()); + + if (!enabled || input->islocked()) + return; + + std::list<eRCDevice*>::iterator i(listeners.begin()); + while (i != listeners.end()) { + (*i)->handleCode((long)key); + ++i; + } +} + +class eRCSDLInit +{ +private: + eSDLInputDriver driver; + eSDLInputDevice device; + +public: + eRCSDLInit(): driver(), device(&driver) + { + } +}; + +eAutoInitP0<eRCSDLInit> init_rcSDL(eAutoInitNumbers::rc+1, "SDL RC Driver"); diff --git a/lib/driver/rcsdl.h b/lib/driver/rcsdl.h new file mode 100644 index 00000000..9732f5e4 --- /dev/null +++ b/lib/driver/rcsdl.h @@ -0,0 +1,37 @@ +#ifndef __lib_driver_rcsdl_h +#define __lib_driver_rcsdl_h + +#include <lib/driver/rc.h> + +#include <SDL.h> + +class eSDLInputDevice : public eRCDevice +{ +private: + bool m_escape; + unsigned int m_unicode; + int translateKey(SDLKey key); + +public: + eSDLInputDevice(eRCDriver *driver); + ~eSDLInputDevice(); + + virtual void handleCode(long arg); + virtual const char *getDescription() const; +}; + +class eSDLInputDriver : public eRCDriver +{ +private: + static eSDLInputDriver *instance; + +public: + eSDLInputDriver(); + ~eSDLInputDriver(); + + static eSDLInputDriver *getInstance() { return instance; } + + void keyPressed(const SDL_KeyboardEvent *key); +}; + +#endif diff --git a/lib/dvb/Makefile.am b/lib/dvb/Makefile.am index b47ffed9..9b337556 100644 --- a/lib/dvb/Makefile.am +++ b/lib/dvb/Makefile.am @@ -1,12 +1,64 @@ SUBDIRS = lowlevel -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_dvb.a -libenigma_dvb_a_SOURCES = dvb.cpp demux.cpp frontend.cpp esection.cpp db.cpp \ - sec.cpp scan.cpp crc32.cpp pmt.cpp decoder.cpp eit.cpp rotor_calc.cpp \ - epgcache.cpp dvbtime.cpp metaparser.cpp volume.cpp tstools.cpp pvrparse.cpp \ - pesparse.cpp teletext.cpp radiotext.cpp subtitle.cpp +libenigma_dvb_a_SOURCES = \ + crc32.cpp \ + db.cpp \ + decoder.cpp \ + demux.cpp \ + dvb.cpp \ + dvbtime.cpp \ + eit.cpp \ + epgcache.cpp \ + esection.cpp \ + frontend.cpp \ + metaparser.cpp \ + pesparse.cpp \ + pmt.cpp \ + pvrparse.cpp \ + radiotext.cpp \ + rotor_calc.cpp \ + scan.cpp \ + sec.cpp \ + subtitle.cpp \ + teletext.cpp \ + tstools.cpp \ + volume.cpp +dvbincludedir = $(pkgincludedir)/lib/dvb +dvbinclude_HEADERS = \ + crc32.h \ + db.h \ + decoder.h \ + demux.h \ + dvb.h \ + dvbtime.h \ + eit.h \ + epgcache.h \ + esection.h \ + frontend.h \ + frontendparms.h \ + idemux.h \ + idvb.h \ + isection.h \ + list.h \ + metaparser.h \ + pesparse.h \ + pmt.h \ + pvrparse.h \ + radiotext.h \ + rotor_calc.h \ + scan.h \ + sec.h \ + specs.h \ + subtitle.h \ + teletext.h \ + tstools.h \ + volume.h diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 38be6359..522035eb 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -3,6 +3,7 @@ #include <lib/dvb/dvb.h> #include <lib/dvb/frontend.h> #include <lib/dvb/epgcache.h> +#include <lib/base/eenv.h> #include <lib/base/eerror.h> #include <lib/base/estring.h> #include <xmlccwrap/xmlccwrap.h> @@ -73,7 +74,7 @@ RESULT eBouquet::moveService(const eServiceReference &ref, unsigned int pos) RESULT eBouquet::flushChanges() { - FILE *f=fopen((CONFIGDIR"/enigma2/"+m_filename).c_str(), "w"); + FILE *f=fopen(eEnv::resolve("${sysconfdir}/enigma2/" + m_filename).c_str(), "w"); if (!f) return -1; if ( fprintf(f, "#NAME %s\r\n", m_bouquet_name.c_str()) < 0 ) @@ -280,7 +281,7 @@ DEFINE_REF(eDVBDB); void eDVBDB::reloadServicelist() { - loadServicelist(CONFIGDIR"/enigma2/lamedb"); + loadServicelist(eEnv::resolve("${sysconfdir}/enigma2/lamedb").c_str()); } void eDVBDB::parseServiceData(ePtr<eDVBService> s, std::string str) @@ -324,14 +325,14 @@ void eDVBDB::loadServicelist(const char *file) { eDebug("---- opening lame channel db"); FILE *f=fopen(file, "rt"); - if (!f && strcmp(file, CONFIGDIR"/enigma2/lamedb") == 0) + if (!f && strcmp(file, eEnv::resolve("${sysconfdir}/enigma2/lamedb").c_str()) == 0) { struct stat s; if ( !stat("lamedb", &s) ) { - if ( !stat(CONFIGDIR"/enigma2", &s) ) + if ( !stat(eEnv::resolve("${sysconfdir}/enigma2").c_str(), &s) ) { - rename("lamedb", CONFIGDIR"/enigma2/lamedb" ); + rename("lamedb", eEnv::resolve("${sysconfdir}/enigma2/lamedb").c_str()); reloadServicelist(); } } @@ -594,7 +595,7 @@ void eDVBDB::saveServicelist(const char *file) void eDVBDB::saveServicelist() { - saveServicelist(CONFIGDIR"/enigma2/lamedb"); + saveServicelist(eEnv::resolve("${sysconfdir}/enigma2/lamedb").c_str()); } void eDVBDB::loadBouquet(const char *path) @@ -618,7 +619,7 @@ void eDVBDB::loadBouquet(const char *path) std::list<eServiceReference> &list = bouquet.m_services; list.clear(); - std::string p = CONFIGDIR"/enigma2/"; + std::string p = eEnv::resolve("${sysconfdir}/enigma2/"); p+=path; eDebug("loading bouquet... %s", p.c_str()); FILE *fp=fopen(p.c_str(), "rt"); diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index ebdad8a7..ea9e7385 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -2111,8 +2111,8 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm, return -EINVAL; } #if HAVE_DVB_API_VERSION < 5 - parm_inversion |= (feparm.rolloff << 2); // Hack.. we use bit 2..3 of inversion param for rolloff - parm_inversion |= (feparm.pilot << 4); // Hack.. we use bit 4..5 of inversion param for pilot + parm_inversion = (fe_spectral_inversion_t)((feparm.rolloff << 2) | parm_inversion); // Hack.. we use bit 2..3 of inversion param for rolloff + parm_inversion = (fe_spectral_inversion_t)((feparm.pilot << 4) | parm_inversion); // Hack.. we use bit 4..5 of inversion param for pilot if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation_8PSK) { parm_u_qpsk_fec_inner = (fe_code_rate_t)((int)parm_u_qpsk_fec_inner+9); diff --git a/lib/dvb/lowlevel/Makefile.am b/lib/dvb/lowlevel/Makefile.am index 98e89f90..1108097e 100644 --- a/lib/dvb/lowlevel/Makefile.am +++ b/lib/dvb/lowlevel/Makefile.am @@ -1,3 +1,4 @@ -EXTRA_DIST = \ +lowlevelincludedir = $(pkgincludedir)/lib/dvb/lowlevel +lowlevelinclude_HEADERS = \ eit.h \ mhw.h diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index b37aa714..d559614c 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -10,6 +10,7 @@ #include <lib/dvb/esection.h> #include <lib/dvb/scan.h> #include <lib/dvb/frontend.h> +#include <lib/base/eenv.h> #include <lib/base/eerror.h> #include <lib/base/estring.h> #include <lib/python/python.h> @@ -29,7 +30,8 @@ eDVBScan::eDVBScan(iDVBChannel *channel, bool usePAT, bool debug) if (m_channel->getDemux(m_demux)) SCAN_eDebug("scan: failed to allocate demux!"); m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection); - FILE *f = fopen("/etc/enigma2/scan_tp_valid_check.py", "r"); + std::string filename = eEnv::resolve("${sysconfdir}/scan_tp_valid_check.py"); + FILE *f = fopen(filename.c_str(), "r"); if (f) { char code[16384]; @@ -37,7 +39,7 @@ eDVBScan::eDVBScan(iDVBChannel *channel, bool usePAT, bool debug) if (rd) { code[rd]=0; - m_additional_tsid_onid_check_func = Py_CompileString(code, "/etc/enigma2/scan_tp_valid_check.py", Py_file_input); + m_additional_tsid_onid_check_func = Py_CompileString(code, filename.c_str(), Py_file_input); } fclose(f); } diff --git a/lib/dvb_ci/Makefile.am b/lib/dvb_ci/Makefile.am index fc7f7625..9ef72492 100644 --- a/lib/dvb_ci/Makefile.am +++ b/lib/dvb_ci/Makefile.am @@ -1,10 +1,28 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_dvb_ci.a -libenigma_dvb_ci_a_SOURCES = dvbci.cpp dvbci_session.cpp dvbci_resmgr.cpp \ - dvbci_appmgr.cpp dvbci_camgr.cpp \ - dvbci_datetimemgr.cpp dvbci_mmi.cpp \ - dvbci_ui.cpp +libenigma_dvb_ci_a_SOURCES = \ + dvbci.cpp \ + dvbci_appmgr.cpp \ + dvbci_camgr.cpp \ + dvbci_datetimemgr.cpp \ + dvbci_mmi.cpp \ + dvbci_resmgr.cpp \ + dvbci_session.cpp \ + dvbci_ui.cpp +dvbciincludedir = $(pkgincludedir)/lib/dvb_ci +dvbciinclude_HEADERS = \ + dvbci.h \ + dvbci_appmgr.h \ + dvbci_camgr.h \ + dvbci_datetimemgr.h \ + dvbci_mmi.h \ + dvbci_resmgr.h \ + dvbci_session.h \ + dvbci_ui.h diff --git a/lib/gdi/Makefile.am b/lib/gdi/Makefile.am index 1280556e..20321f53 100644 --- a/lib/gdi/Makefile.am +++ b/lib/gdi/Makefile.am @@ -1,15 +1,58 @@ -INCLUDES = \ - -I$(top_srcdir)/include -I$(top_srcdir)/lib/gdi/ati +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h + +AM_CXXFLAGS = \ + $(LIBSDL_CFLAGS) noinst_LIBRARIES = libenigma_gdi.a libenigma_gdi_a_SOURCES = \ - region.cpp grc.cpp epng.cpp erect.cpp fb.cpp font.cpp font_arabic.cpp gfbdc.cpp \ - glcddc.cpp gpixmap.cpp lcd.cpp gfont.cpp accel.cpp picload.cpp picexif.cpp \ - compositing.cpp bcm.cpp + accel.cpp \ + bcm.cpp \ + compositing.cpp \ + epng.cpp \ + erect.cpp \ + fb.cpp \ + font.cpp \ + font_arabic.cpp \ + gfont.cpp \ + glcddc.cpp \ + gmaindc.cpp \ + gpixmap.cpp \ + grc.cpp \ + lcd.cpp \ + picexif.cpp \ + picload.cpp \ + region.cpp -if WITH_SDL -libenigma_gdi_a_SOURCES += sdl.cpp -endif +gdiincludedir = $(pkgincludedir)/lib/gdi +gdiinclude_HEADERS = \ + accel.h \ + compositing.h \ + epng.h \ + epoint.h \ + erect.h \ + esize.h \ + fb.h \ + font.h \ + gfont.h \ + glcddc.h \ + gpixmap.h \ + grc.h \ + lcd.h \ + picexif.h \ + picload.h \ + region.h -# ati/2dablt.cpp ati/2dcore.cpp ati/ati_core.cpp ati/test.cpp ati/2dutil.cpp +if HAVE_LIBSDL +libenigma_gdi_a_SOURCES += \ + sdl.cpp \ + sdl.h +else +libenigma_gdi_a_SOURCES += \ + gfbdc.cpp \ + gfbdc.h +endif diff --git a/lib/gdi/epng.cpp b/lib/gdi/epng.cpp index 972a89d3..fd33298f 100644 --- a/lib/gdi/epng.cpp +++ b/lib/gdi/epng.cpp @@ -1,3 +1,4 @@ +#define PNG_SKIP_SETJMP_CHECK #include <png.h> #include <stdio.h> #include <lib/gdi/epng.h> diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index a5db43a9..9e175476 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -15,12 +15,10 @@ // use this for init Freetype... #include <ft2build.h> #include FT_FREETYPE_H -#ifdef HAVE_FREETYPE2 #define FTC_Image_Cache_New(a,b) FTC_ImageCache_New(a,b) #define FTC_Image_Cache_Lookup(a,b,c,d) FTC_ImageCache_Lookup(a,b,c,d,NULL) #define FTC_SBit_Cache_New(a,b) FTC_SBitCache_New(a,b) #define FTC_SBit_Cache_Lookup(a,b,c,d) FTC_SBitCache_Lookup(a,b,c,d,NULL) -#endif #include <lib/base/eerror.h> #include <lib/gdi/lcd.h> @@ -29,12 +27,7 @@ #include <lib/base/init.h> #include <lib/base/init_num.h> -#define HAVE_FRIBIDI -// until we have it in the cdk - -#ifdef HAVE_FRIBIDI #include <fribidi/fribidi.h> -#endif #include <map> @@ -42,10 +35,6 @@ fontRenderClass *fontRenderClass::instance; static pthread_mutex_t ftlock=PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; -#ifndef HAVE_FREETYPE2 -static FTC_Font cache_current_font=0; -#endif - struct fntColorCacheKey { gRGB start, end; @@ -210,12 +199,8 @@ float fontRenderClass::getLineHeight(const gFont& font) return 0; singleLock s(ftlock); FT_Face current_face; -#ifdef HAVE_FREETYPE2 if ((FTC_Manager_LookupFace(cacheManager, fnt->scaler.face_id, ¤t_face) < 0) || (FTC_Manager_LookupSize(cacheManager, &fnt->scaler, &fnt->size) < 0)) -#else - if (FTC_Manager_Lookup_Size(cacheManager, &fnt->font.font, ¤t_face, &fnt->size)<0) -#endif { eDebug("FTC_Manager_Lookup_Size failed!"); return 0; @@ -263,7 +248,6 @@ DEFINE_REF(Font); Font::Font(fontRenderClass *render, FTC_FaceID faceid, int isize, int tw): tabwidth(tw) { renderer=render; -#ifdef HAVE_FREETYPE2 font.face_id = faceid; font.width = isize; font.height = isize; @@ -272,12 +256,6 @@ Font::Font(fontRenderClass *render, FTC_FaceID faceid, int isize, int tw): tabwi scaler.width = isize; scaler.height = isize; scaler.pixel = 1; -#else - font.font.face_id=faceid; - font.font.pix_width = isize; - font.font.pix_height = isize; - font.image_type = ftc_image_grays; -#endif height=isize; if (tabwidth==-1) tabwidth=8*isize; @@ -474,18 +452,12 @@ void eTextPara::setFont(Font *fnt, Font *replacement) // we ask for replacment_font first becauseof the cache if (replacement_font) { -#ifdef HAVE_FREETYPE2 if ((FTC_Manager_LookupFace(fontRenderClass::instance->cacheManager, replacement_font->scaler.face_id, &replacement_face) < 0) || (FTC_Manager_LookupSize(fontRenderClass::instance->cacheManager, &replacement_font->scaler, &replacement_font->size) < 0)) -#else - if (FTC_Manager_Lookup_Size(fontRenderClass::instance->cacheManager, - &replacement_font->font.font, &replacement_face, - &replacement_font->size)<0) -#endif { eDebug("FTC_Manager_Lookup_Size failed!"); return; @@ -493,24 +465,17 @@ void eTextPara::setFont(Font *fnt, Font *replacement) } if (current_font) { -#ifdef HAVE_FREETYPE2 if ((FTC_Manager_LookupFace(fontRenderClass::instance->cacheManager, current_font->scaler.face_id, ¤t_face) < 0) || (FTC_Manager_LookupSize(fontRenderClass::instance->cacheManager, ¤t_font->scaler, ¤t_font->size) < 0)) -#else - if (FTC_Manager_Lookup_Size(fontRenderClass::instance->cacheManager, ¤t_font->font.font, ¤t_face, ¤t_font->size)<0) -#endif { eDebug("FTC_Manager_Lookup_Size failed!"); return; } } -#ifndef HAVE_FREETYPE2 - cache_current_font=¤t_font->font.font; -#endif previous=0; use_kerning=FT_HAS_KERNING(current_face); } @@ -525,7 +490,6 @@ int eTextPara::renderString(const char *string, int rflags) if (!current_font) return -1; -#ifdef HAVE_FREETYPE2 if ((FTC_Manager_LookupFace(fontRenderClass::instance->cacheManager, current_font->scaler.face_id, ¤t_face) < 0) || @@ -536,17 +500,6 @@ int eTextPara::renderString(const char *string, int rflags) eDebug("FTC_Manager_Lookup_Size failed!"); return -1; } -#else - if (¤t_font->font.font != cache_current_font) - { - if (FTC_Manager_Lookup_Size(fontRenderClass::instance->cacheManager, ¤t_font->font.font, ¤t_face, ¤t_font->size)<0) - { - eDebug("FTC_Manager_Lookup_Size failed!"); - return -1; - } - cache_current_font=¤t_font->font.font; - } -#endif if (!current_face) eFatal("eTextPara::renderString: no current_face"); @@ -610,7 +563,6 @@ int eTextPara::renderString(const char *string, int rflags) // now do the usual logical->visual reordering int size=uc_shape.size(); -#ifdef HAVE_FRIBIDI FriBidiCharType dir=FRIBIDI_TYPE_ON; uc_visual.resize(size); // gaaanz lahm, aber anders geht das leider nicht, sorry. @@ -618,9 +570,6 @@ int eTextPara::renderString(const char *string, int rflags) std::copy(uc_shape.begin(), uc_shape.end(), array); fribidi_log2vis(array, size, &dir, target, 0, 0, 0); uc_visual.assign(target, target+size); -#else - uc_visual=uc_shape; -#endif glyphs.reserve(size); @@ -714,13 +663,11 @@ nprint: isprintable=0; } bboxValid=false; calc_bbox(); -#ifdef HAVE_FRIBIDI if (dir & FRIBIDI_MASK_RTL) { realign(dirRight); doTopBottomReordering=true; } -#endif if (charCount) { @@ -739,7 +686,6 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons if (!current_font) return; -#ifdef HAVE_FREETYPE2 if ((FTC_Manager_LookupFace(fontRenderClass::instance->cacheManager, current_font->scaler.face_id, ¤t_face) < 0) || @@ -750,17 +696,6 @@ void eTextPara::blit(gDC &dc, const ePoint &offset, const gRGB &background, cons eDebug("FTC_Manager_Lookup_Size failed!"); return; } -#else - if (¤t_font->font.font != cache_current_font) - { - if (FTC_Manager_Lookup_Size(fontRenderClass::instance->cacheManager, ¤t_font->font.font, ¤t_face, ¤t_font->size)<0) - { - eDebug("FTC_Manager_Lookup_Size failed!"); - return; - } - cache_current_font=¤t_font->font.font; - } -#endif ePtr<gPixmap> target; dc.getPixmap(target); diff --git a/lib/gdi/font.h b/lib/gdi/font.h index 7dd9f89a..6b821838 100644 --- a/lib/gdi/font.h +++ b/lib/gdi/font.h @@ -8,11 +8,9 @@ #include FT_CACHE_H #include FT_CACHE_IMAGE_H #include FT_CACHE_SMALL_BITMAPS_H -#ifdef HAVE_FREETYPE2 typedef FTC_ImageCache FTC_Image_Cache; typedef FTC_ImageTypeRec FTC_Image_Desc; typedef FTC_SBitCache FTC_SBit_Cache; -#endif #include <vector> #include <list> @@ -191,9 +189,7 @@ class Font: public iObject { DECLARE_REF(Font); public: -#ifdef HAVE_FREETYPE2 FTC_ScalerRec scaler; -#endif FTC_Image_Desc font; fontRenderClass *renderer; FT_Error getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit); diff --git a/lib/gdi/gfbdc.cpp b/lib/gdi/gfbdc.cpp index 80dd2479..a4f65ebc 100644 --- a/lib/gdi/gfbdc.cpp +++ b/lib/gdi/gfbdc.cpp @@ -7,18 +7,8 @@ #include <time.h> -gFBDC *gFBDC::instance; - -ePtr<gFBDC> NewgFBDCPtr(void) -{ - ePtr<gFBDC> ptr; - gFBDC::getInstance(ptr); - return ptr; -} - gFBDC::gFBDC() { - instance=this; fb=new fbClass; if (!fb->Available()) @@ -34,7 +24,6 @@ gFBDC::~gFBDC() { delete fb; delete[] surface.clut.data; - instance=0; } void gFBDC::calcRamp() @@ -91,7 +80,7 @@ void gFBDC::setPalette() fb->PutCMAP(); } -void gFBDC::exec(gOpcode *o) +void gFBDC::exec(const gOpcode *o) { switch (o->opcode) { @@ -242,7 +231,4 @@ void gFBDC::reloadSettings() setPalette(); } -// eAutoInitPtr<gFBDC> init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC"); -#ifndef WITH_SDL eAutoInitPtr<gFBDC> init_gFBDC(eAutoInitNumbers::graphic-1, "GFBDC"); -#endif diff --git a/lib/gdi/gfbdc.h b/lib/gdi/gfbdc.h index 23051c4f..7f76d0c9 100644 --- a/lib/gdi/gfbdc.h +++ b/lib/gdi/gfbdc.h @@ -3,17 +3,12 @@ #include "fb.h" #include "gpixmap.h" -#include "grc.h" +#include "gmaindc.h" -class gFBDC; - -SWIG_IGNORE(gFBDC); -class gFBDC: public gDC +class gFBDC: public gMainDC { -#ifndef SWIG fbClass *fb; - static gFBDC *instance; - void exec(gOpcode *opcode); + void exec(const gOpcode *opcode); unsigned char ramp[256], rampalpha[256]; // RGB ramp 0..255 int brightness, gamma, alpha; void calcRamp(); @@ -21,13 +16,8 @@ class gFBDC: public gDC gSurface surface, surface_back; int m_enable_double_buffering; int m_xres, m_yres; -#else - gFBDC(); - virtual ~gFBDC(); -#endif public: void setResolution(int xres, int yres); -#ifndef SWIG void reloadSettings(); void setAlpha(int alpha); void setBrightness(int brightness); @@ -43,17 +33,7 @@ public: gFBDC(); virtual ~gFBDC(); - static int getInstance(ePtr<gFBDC> &ptr) { if (!instance) return -1; ptr = instance; return 0; } int islocked() { return fb->islocked(); } -#endif }; -SWIG_TEMPLATE_TYPEDEF(ePtr<gFBDC>, gFBDC); -SWIG_EXTEND(ePtr<gFBDC>, - static ePtr<gFBDC> getInstance() - { - extern ePtr<gFBDC> NewgFBDCPtr(void); - return NewgFBDCPtr(); - } -); #endif diff --git a/lib/gdi/glcddc.cpp b/lib/gdi/glcddc.cpp index a593cfa3..bade53ba 100644 --- a/lib/gdi/glcddc.cpp +++ b/lib/gdi/glcddc.cpp @@ -30,7 +30,7 @@ gLCDDC::~gLCDDC() instance=0; } -void gLCDDC::exec(gOpcode *o) +void gLCDDC::exec(const gOpcode *o) { switch (o->opcode) { diff --git a/lib/gdi/glcddc.h b/lib/gdi/glcddc.h index 6d5f3834..a2b3c7f0 100644 --- a/lib/gdi/glcddc.h +++ b/lib/gdi/glcddc.h @@ -9,7 +9,7 @@ class gLCDDC: public gDC eLCD *lcd; static gLCDDC *instance; int update; - void exec(gOpcode *opcode); + void exec(const gOpcode *opcode); gSurface surface; public: gLCDDC(); diff --git a/lib/gdi/gmaindc.cpp b/lib/gdi/gmaindc.cpp new file mode 100644 index 00000000..4890027f --- /dev/null +++ b/lib/gdi/gmaindc.cpp @@ -0,0 +1,28 @@ +#include <lib/gdi/gmaindc.h> + +gMainDC *gMainDC::m_instance; + +ePtr<gMainDC> NewgMainDCPtr(void) +{ + ePtr<gMainDC> ptr; + gMainDC::getInstance(ptr); + return ptr; +} + +gMainDC::gMainDC() +{ + ASSERT(m_instance == 0); + m_instance = this; +} + +gMainDC::gMainDC(gPixmap *pixmap) : gDC(pixmap) +{ + ASSERT(m_instance == 0); + m_instance = this; +} + +gMainDC::~gMainDC() +{ + m_instance = 0; +} + diff --git a/lib/gdi/gmaindc.h b/lib/gdi/gmaindc.h new file mode 100644 index 00000000..780be2e2 --- /dev/null +++ b/lib/gdi/gmaindc.h @@ -0,0 +1,33 @@ +#ifndef __lib_gdi_gmaindc_h +#define __lib_gdi_gmaindc_h + +#include "grc.h" + +class gMainDC; + +SWIG_IGNORE(gMainDC); +class gMainDC: public gDC +{ +protected: + static gMainDC *m_instance; + + gMainDC(); + gMainDC(gPixmap *pixmap); + virtual ~gMainDC(); +public: + virtual void setResolution(int xres, int yres) = 0; +#ifndef SWIG + static int getInstance(ePtr<gMainDC> &ptr) { if (!m_instance) return -1; ptr = m_instance; return 0; } +#endif +}; + +SWIG_TEMPLATE_TYPEDEF(ePtr<gMainDC>, gMainDC); +SWIG_EXTEND(ePtr<gMainDC>, + static ePtr<gMainDC> getInstance() + { + extern ePtr<gMainDC> NewgMainDCPtr(void); + return NewgMainDCPtr(); + } +); + +#endif diff --git a/lib/gdi/grc.cpp b/lib/gdi/grc.cpp index dff6b059..a45b3b1e 100644 --- a/lib/gdi/grc.cpp +++ b/lib/gdi/grc.cpp @@ -609,7 +609,7 @@ gDC::~gDC() delete[] m_spinner_pic; } -void gDC::exec(gOpcode *o) +void gDC::exec(const gOpcode *o) { switch (o->opcode) { diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 3b8201ad..38caa107 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -286,7 +286,7 @@ protected: eRect m_spinner_pos; int m_spinner_num, m_spinner_i; public: - virtual void exec(gOpcode *opcode); + virtual void exec(const gOpcode *opcode); gDC(gPixmap *pixmap); gDC(); virtual ~gDC(); @@ -296,10 +296,10 @@ public: virtual eSize size() { return m_pixmap->size(); } virtual int islocked() { return 0; } - void enableSpinner(); - void disableSpinner(); - void incrementSpinner(); - void setSpinner(eRect pos, ePtr<gPixmap> *pic, int len); + virtual void enableSpinner(); + virtual void disableSpinner(); + virtual void incrementSpinner(); + virtual void setSpinner(eRect pos, ePtr<gPixmap> *pic, int len); }; #endif diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index a7dc22db..518ee1b0 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -4,8 +4,12 @@ #include <fcntl.h> #include <sys/ioctl.h> +#if defined(HAVE_DBOX_FP_H) && defined(HAVE_DBOX_LCD_KS0713_H) #include <dbox/fp.h> #include <dbox/lcd-ks0713.h> +#else +#define NO_LCD 1 +#endif #include <lib/gdi/esize.h> #include <lib/base/init.h> @@ -70,10 +74,6 @@ eDBoxLCD::eDBoxLCD() eDebug("found OLED display!"); is_oled = 1; } -#else - lcdfd = -1; -#endif - instance=this; if (lcdfd<0) eDebug("couldn't open LCD - load lcd.o!"); @@ -106,6 +106,9 @@ eDBoxLCD::eDBoxLCD() is_oled = 3; } } +#endif + instance=this; + setSize(xres, yres, bpp); } @@ -117,6 +120,7 @@ void eDBoxLCD::setInverted(unsigned char inv) int eDBoxLCD::setLCDContrast(int contrast) { +#ifndef NO_LCD int fp; if((fp=open("/dev/dbox/fp0", O_RDWR))<=0) { @@ -129,11 +133,13 @@ int eDBoxLCD::setLCDContrast(int contrast) eDebug("[LCD] can't set lcd contrast"); } close(fp); +#endif return(0); } int eDBoxLCD::setLCDBrightness(int brightness) { +#ifndef NO_LCD eDebug("setLCDBrightness %d", brightness); FILE *f=fopen("/proc/stb/lcd/oled_brightness", "w"); if (!f) @@ -157,6 +163,7 @@ int eDBoxLCD::setLCDBrightness(int brightness) eDebug("[LCD] can't set lcd brightness (%m)"); close(fp); } +#endif return(0); } diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp index c162f89d..0ce10c09 100644 --- a/lib/gdi/picload.cpp +++ b/lib/gdi/picload.cpp @@ -1,4 +1,5 @@ -#include <png.h> // must be included before Python.h because of setjmp +#define PNG_SKIP_SETJMP_CHECK +#include <png.h> #include <fcntl.h> #include <lib/gdi/picload.h> diff --git a/lib/gdi/sdl.cpp b/lib/gdi/sdl.cpp index 6dbdb67c..eb4e2ae4 100644 --- a/lib/gdi/sdl.cpp +++ b/lib/gdi/sdl.cpp @@ -1,80 +1,83 @@ -#ifdef WITH_SDL #include <lib/gdi/sdl.h> - +#include <lib/actions/action.h> #include <lib/base/init.h> #include <lib/base/init_num.h> +#include <lib/driver/input_fake.h> +#include <lib/driver/rcsdl.h> #include <SDL.h> -gSDLDC *gSDLDC::m_instance; - -gSDLDC::gSDLDC() +gSDLDC::gSDLDC() : m_pump(eApp, 1) { - if (SDL_Init(SDL_INIT_VIDEO) < 0) - { + if (SDL_Init(SDL_INIT_VIDEO) < 0) { eWarning("Could not initialize SDL: %s", SDL_GetError()); return; } - - m_screen = SDL_SetVideoMode(720, 576, 32, SDL_HWSURFACE); - if (!m_screen) - { - eWarning("Could not create SDL surface: %s", SDL_GetError()); - return; - } - m_instance=this; - + setResolution(720, 576); + + CONNECT(m_pump.recv_msg, gSDLDC::pumpEvent); + m_surface.type = 0; - m_surface.x = m_screen->w; - m_surface.y = m_screen->h; - m_surface.bpp = m_screen->format->BitsPerPixel; - m_surface.bypp = m_screen->format->BytesPerPixel; - m_surface.stride = m_screen->pitch; - m_surface.data = m_screen->pixels; - m_surface.clut.colors=256; - m_surface.clut.data=new gRGB[m_surface.clut.colors]; - + m_surface.clut.colors = 256; + m_surface.clut.data = new gRGB[m_surface.clut.colors]; + m_pixmap = new gPixmap(&m_surface); - + memset(m_surface.clut.data, 0, sizeof(*m_surface.clut.data)*m_surface.clut.colors); + + run(); } gSDLDC::~gSDLDC() { + pushEvent(EV_QUIT); + kill(); SDL_Quit(); - m_instance=0; } -void gSDLDC::setPalette() +void gSDLDC::keyEvent(const SDL_Event &event) { - if (!m_surface.clut.data) - return; - -/* for (int i=0; i<256; ++i) - { - fb->CMAP()->red[i]=ramp[m_surface.clut.data[i].r]<<8; - fb->CMAP()->green[i]=ramp[m_surface.clut.data[i].g]<<8; - fb->CMAP()->blue[i]=ramp[m_surface.clut.data[i].b]<<8; - fb->CMAP()->transp[i]=rampalpha[m_surface.clut.data[i].a]<<8; - if (!fb->CMAP()->red[i]) - fb->CMAP()->red[i]=0x100; - } - fb->PutCMAP(); */ + eSDLInputDriver *driver = eSDLInputDriver::getInstance(); + + eDebug("SDL Key %s: key=%d", (event.type == SDL_KEYDOWN) ? "Down" : "Up", event.key.keysym.sym); + + if (driver) + driver->keyPressed(&event.key); } -void gSDLDC::exec(gOpcode *o) +void gSDLDC::pumpEvent(const SDL_Event &event) { - switch (o->opcode) - { - case gOpcode::setPalette: - { - gDC::exec(o); - setPalette(); + switch (event.type) { + case SDL_KEYDOWN: + case SDL_KEYUP: + keyEvent(event); + break; + case SDL_QUIT: + eDebug("SDL Quit"); + extern void quitMainloop(int exit_code); + quitMainloop(0); break; } +} + +void gSDLDC::pushEvent(enum event code, void *data1, void *data2) +{ + SDL_Event event; + + event.type = SDL_USEREVENT; + event.user.code = code; + event.user.data1 = data1; + event.user.data2 = data2; + + SDL_PushEvent(&event); +} + +void gSDLDC::exec(const gOpcode *o) +{ + switch (o->opcode) { case gOpcode::flush: - SDL_Flip(m_screen); + pushEvent(EV_FLIP); eDebug("FLUSH"); break; default: @@ -83,6 +86,68 @@ void gSDLDC::exec(gOpcode *o) } } -eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC"); +void gSDLDC::setResolution(int xres, int yres) +{ + pushEvent(EV_SET_VIDEO_MODE, (void *)xres, (void *)yres); +} + +/* + * SDL thread below... + */ + +void gSDLDC::evSetVideoMode(unsigned long xres, unsigned long yres) +{ + m_screen = SDL_SetVideoMode(xres, yres, 32, SDL_HWSURFACE); + if (!m_screen) { + eFatal("Could not create SDL surface: %s", SDL_GetError()); + return; + } -#endif + m_surface.x = m_screen->w; + m_surface.y = m_screen->h; + m_surface.bpp = m_screen->format->BitsPerPixel; + m_surface.bypp = m_screen->format->BytesPerPixel; + m_surface.stride = m_screen->pitch; + m_surface.data = m_screen->pixels; + + SDL_EnableUNICODE(1); +} + +void gSDLDC::evFlip() +{ + SDL_Flip(m_screen); +} + +void gSDLDC::thread() +{ + hasStarted(); + + bool stop = false; + while (!stop) { + SDL_Event event; + if (SDL_WaitEvent(&event)) { + switch (event.type) { + case SDL_KEYDOWN: + case SDL_KEYUP: + case SDL_QUIT: + m_pump.send(event); + break; + case SDL_USEREVENT: + switch (event.user.code) { + case EV_SET_VIDEO_MODE: + evSetVideoMode((unsigned long)event.user.data1, (unsigned long)event.user.data2); + break; + case EV_FLIP: + evFlip(); + break; + case EV_QUIT: + stop = true; + break; + } + break; + } + } + } +} + +eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC"); diff --git a/lib/gdi/sdl.h b/lib/gdi/sdl.h index 20ff04fa..6d016cf9 100644 --- a/lib/gdi/sdl.h +++ b/lib/gdi/sdl.h @@ -1,27 +1,39 @@ #ifndef __lib_gdi_sdl_h #define __lib_gdi_sdl_h -#include "fb.h" -#include "gpixmap.h" -#include "grc.h" +#include <lib/base/thread.h> +#include <lib/gdi/gmaindc.h> #include <SDL.h> -class gSDLDC: public gDC +class gSDLDC: public gMainDC, public eThread, public Object { +private: SDL_Surface *m_screen; - static gSDLDC *m_instance; - void exec(gOpcode *opcode); + void exec(const gOpcode *opcode); - void setPalette(); gSurface m_surface; + + eFixedMessagePump<SDL_Event> m_pump; + void keyEvent(const SDL_Event &event); + void pumpEvent(const SDL_Event &event); + virtual void thread(); + + enum event { + EV_SET_VIDEO_MODE, + EV_FLIP, + EV_QUIT, + }; + + void pushEvent(enum event code, void *data1 = 0, void *data2 = 0); + void evSetVideoMode(unsigned long xres, unsigned long yres); + void evFlip(); + public: - + void setResolution(int xres, int yres); gSDLDC(); virtual ~gSDLDC(); - static int getInstance(ePtr<gSDLDC> &ptr) { if (!m_instance) return -1; ptr = m_instance; return 0; } int islocked() { return 0; } }; - #endif diff --git a/lib/gui/Makefile.am b/lib/gui/Makefile.am index f4de9d12..9d31bf73 100644 --- a/lib/gui/Makefile.am +++ b/lib/gui/Makefile.am @@ -1,11 +1,50 @@ -INCLUDES = \ +AM_CPPFLAGS = \ + -I$(top_srcdir) \ -I$(top_srcdir)/include \ - -I$(top_srcdir)/src + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_gui.a libenigma_gui_a_SOURCES = \ - ebutton.cpp elabel.cpp eslider.cpp ewidget.cpp ewidgetdesktop.cpp \ - ewindow.cpp ewindowstyle.cpp elistbox.cpp elistboxcontent.cpp \ - epixmap.cpp ewindowstyleskinned.cpp einput.cpp einputstring.cpp einputnumber.cpp \ - ewidgetanimation.cpp epositiongauge.cpp evideo.cpp esubtitle.cpp ecanvas.cpp + ebutton.cpp \ + ecanvas.cpp \ + einput.cpp \ + einputnumber.cpp \ + einputstring.cpp \ + elabel.cpp \ + elistbox.cpp \ + elistboxcontent.cpp \ + epixmap.cpp \ + epositiongauge.cpp \ + eslider.cpp \ + esubtitle.cpp \ + evideo.cpp \ + ewidget.cpp \ + ewidgetanimation.cpp \ + ewidgetdesktop.cpp \ + ewindow.cpp \ + ewindowstyle.cpp \ + ewindowstyleskinned.cpp + +guiincludedir = $(pkgincludedir)/lib/gui +guiinclude_HEADERS = \ + ebutton.h \ + ecanvas.h \ + einput.h \ + einputnumber.h \ + einputstring.h \ + elabel.h \ + elistbox.h \ + elistboxcontent.h \ + epixmap.h \ + epositiongauge.h \ + eslider.h \ + esubtitle.h \ + evideo.h \ + ewidget.h \ + ewidgetanimation.h \ + ewidgetdesktop.h \ + ewindow.h \ + ewindowstyle.h \ + ewindowstyleskinned.h diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp index 98bc1f7d..08bd0474 100644 --- a/lib/gui/ewidgetdesktop.cpp +++ b/lib/gui/ewidgetdesktop.cpp @@ -381,7 +381,10 @@ void eWidgetDesktop::makeCompatiblePixmap(gPixmap &pm) ePtr<gPixmap> target_pixmap; m_screen.m_dc->getPixmap(target_pixmap); - ASSERT(target_pixmap); + if (!target_pixmap) { + eDebug("no target pixmap! assuming bpp > 8 for accelerated graphics."); + return; + } if (target_pixmap->surface && target_pixmap->surface->bpp > 8) return; diff --git a/lib/mmi/Makefile.am b/lib/mmi/Makefile.am index 020c988e..392c52c2 100644 --- a/lib/mmi/Makefile.am +++ b/lib/mmi/Makefile.am @@ -1,6 +1,14 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_mmi.a -libenigma_mmi_a_SOURCES = mmi_ui.cpp +libenigma_mmi_a_SOURCES = \ + mmi_ui.cpp + +mmiincludedir = $(pkgincludedir)/lib/mmi +mmiinclude_HEADERS = \ + mmi_ui.h diff --git a/lib/nav/Makefile.am b/lib/nav/Makefile.am index 0320cb25..3d57d6ac 100644 --- a/lib/nav/Makefile.am +++ b/lib/nav/Makefile.am @@ -1,9 +1,16 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h noinst_LIBRARIES = libenigma_nav.a libenigma_nav_a_SOURCES = \ - core.cpp pcore.cpp - + core.cpp \ + pcore.cpp +navincludedir = $(pkgincludedir)/lib/nav +navinclude_HEADERS = \ + core.h \ + pcore.h diff --git a/lib/python/.gitignore b/lib/python/.gitignore new file mode 100644 index 00000000..c1fa59fc --- /dev/null +++ b/lib/python/.gitignore @@ -0,0 +1,2 @@ +enigma.py +enigma_python.cpp diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 7f837565..0f1a8fca 100644 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -15,17 +15,17 @@ def readFile(filename): file.close() return data -class Harddisk: - DEVTYPE_UDEV = 0 - DEVTYPE_DEVFS = 1 +DEVTYPE_UDEV = 0 +DEVTYPE_DEVFS = 1 +class Harddisk: def __init__(self, device): self.device = device if access("/dev/.udev", 0): - self.type = self.DEVTYPE_UDEV + self.type = DEVTYPE_UDEV elif access("/dev/.devfsd", 0): - self.type = self.DEVTYPE_DEVFS + self.type = DEVTYPE_DEVFS else: print "Unable to determine structure of /dev" @@ -37,11 +37,11 @@ class Harddisk: self.disk_path = '' self.phys_path = path.realpath(self.sysfsPath('device')) - if self.type == self.DEVTYPE_UDEV: + if self.type == DEVTYPE_UDEV: self.dev_path = '/dev/' + self.device self.disk_path = self.dev_path - elif self.type == self.DEVTYPE_DEVFS: + elif self.type == DEVTYPE_DEVFS: tmp = readFile(self.sysfsPath('dev')).split(':') s_major = int(tmp[0]) s_minor = int(tmp[1]) @@ -64,9 +64,9 @@ class Harddisk: return self.device < ob.device def partitionPath(self, n): - if self.type == self.DEVTYPE_UDEV: + if self.type == DEVTYPE_UDEV: return self.dev_path + n - elif self.type == self.DEVTYPE_DEVFS: + elif self.type == DEVTYPE_DEVFS: return self.dev_path + '/part' + n def sysfsPath(self, filename): @@ -79,9 +79,9 @@ class Harddisk: def bus(self): # CF (7025 specific) - if self.type == self.DEVTYPE_UDEV: + if self.type == DEVTYPE_UDEV: ide_cf = False # FIXME - elif self.type == self.DEVTYPE_DEVFS: + elif self.type == DEVTYPE_DEVFS: ide_cf = self.device[:2] == "hd" and "host0" not in self.dev_path internal = "pci" in self.phys_path @@ -142,7 +142,7 @@ class Harddisk: def numPartitions(self): numPart = -1 - if self.type == self.DEVTYPE_UDEV: + if self.type == DEVTYPE_UDEV: try: devdir = listdir('/dev') except OSError: @@ -151,7 +151,7 @@ class Harddisk: if filename.startswith(self.device): numPart += 1 - elif self.type == self.DEVTYPE_DEVFS: + elif self.type == DEVTYPE_DEVFS: try: idedir = listdir(self.dev_path) except OSError: @@ -413,24 +413,38 @@ class Partition: return True return False -DEVICEDB = \ +DEVICEDB_SR = \ {"dm8000": { - # dm8000: - "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.1/1-1.1:1.0": "Front USB Slot", - "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.2/1-1.2:1.0": "Back, upper USB Slot", - "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.3/1-1.3:1.0": "Back, lower USB Slot", - "/devices/platform/brcm-ehci-1.1/usb2/2-1/2-1:1.0/host1/target1:0:0/1:0:0:0": "DVD Drive", + "/devices/pci0000:01/0000:01:00.0/host0/target0:0:0/0:0:0:0": _("DVD Drive"), + "/devices/pci0000:01/0000:01:00.0/host1/target1:0:0/1:0:0:0": _("DVD Drive"), + "/devices/platform/brcm-ehci-1.1/usb2/2-1/2-1:1.0/host3/target3:0:0/3:0:0:0": _("DVD Drive"), + }, + "dm800": + { + }, + "dm7025": + { + } + } + +DEVICEDB = \ + {"dm8000": + { + "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.1/1-1.1:1.0": _("Front USB Slot"), + "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.2/1-1.2:1.0": _("Back, upper USB Slot"), + "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.3/1-1.3:1.0": _("Back, lower USB Slot"), + "/devices/platform/brcm-ehci.0/usb1/1-1/1-1.1/1-1.1:1.0": _("Front USB Slot"), + "/devices/platform/brcm-ehci-1.1/usb2/2-1/2-1:1.0/": _("Internal USB Slot"), + "/devices/platform/brcm-ohci-1.1/usb4/4-1/4-1:1.0/": _("Internal USB Slot"), }, "dm800": { - # dm800: "/devices/platform/brcm-ehci.0/usb1/1-2/1-2:1.0": "Upper USB Slot", "/devices/platform/brcm-ehci.0/usb1/1-1/1-1:1.0": "Lower USB Slot", }, "dm7025": { - # dm7025: "/devices/pci0000:00/0000:00:14.1/ide1/1.0": "CF Card Slot", #hdc "/devices/pci0000:00/0000:00:14.1/ide0/0.0": "Internal Harddisk" } @@ -441,6 +455,7 @@ class HarddiskManager: self.hdd = [ ] self.cd = "" self.partitions = [ ] + self.devices_scanned_on_init = [ ] self.on_partition_list_change = CList() @@ -508,24 +523,23 @@ class HarddiskManager: def enumerateBlockDevices(self): print "enumerating block devices..." for blockdev in listdir("/sys/block"): - error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(blockdev) - print "found block device '%s':" % blockdev, - if error: - print "error querying properties" - elif blacklisted: - print "blacklisted" - elif not medium_found: - print "no medium" - else: - print "ok, removable=%s, cdrom=%s, partitions=%s, device=%s" % (removable, is_cdrom, partitions, blockdev) - - self.addHotplugPartition(blockdev) - for part in partitions: - self.addHotplugPartition(part) + error, blacklisted, removable, is_cdrom, partitions, medium_found = self.addHotplugPartition(blockdev) + if not error and not blacklisted: + if medium_found: + for part in partitions: + self.addHotplugPartition(part) + self.devices_scanned_on_init.append((blockdev, removable, is_cdrom, medium_found)) def getAutofsMountpoint(self, device): return "/autofs/%s/" % (device) + def is_hard_mounted(self, device): + mounts = file('/proc/mounts').read().split('\n') + for x in mounts: + if x.find('/autofs') == -1 and x.find(device) != -1: + return True + return False + def addHotplugPartition(self, device, physdev = None): if not physdev: dev, part = self.splitDeviceName(device) @@ -535,22 +549,36 @@ class HarddiskManager: physdev = dev print "couldn't determine blockdev physdev for device", device - # device is the device name, without /dev - # physdev is the physical device path, which we (might) use to determine the userfriendly name - description = self.getUserfriendlyDeviceName(device, physdev) + error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device) + print "found block device '%s':" % device, - p = Partition(mountpoint = self.getAutofsMountpoint(device), description = description, force_mounted = True, device = device) - self.partitions.append(p) - self.on_partition_list_change("add", p) + if blacklisted: + print "blacklisted" + else: + if error: + print "error querying properties" + elif not medium_found: + print "no medium" + else: + print "ok, removable=%s, cdrom=%s, partitions=%s" % (removable, is_cdrom, partitions) + + l = len(device) + if l: + # see if this is a harddrive + if not device[l-1].isdigit() and not removable and not is_cdrom: + self.hdd.append(Harddisk(device)) + self.hdd.sort() + SystemInfo["Harddisk"] = len(self.hdd) > 0 + + if (not removable or medium_found) and not self.is_hard_mounted(device): + # device is the device name, without /dev + # physdev is the physical device path, which we (might) use to determine the userfriendly name + description = self.getUserfriendlyDeviceName(device, physdev) + p = Partition(mountpoint = self.getAutofsMountpoint(device), description = description, force_mounted = True, device = device) + self.partitions.append(p) + self.on_partition_list_change("add", p) - # see if this is a harddrive - l = len(device) - if l and not device[l-1].isdigit(): - error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device) - if not blacklisted and not removable and not is_cdrom and medium_found: - self.hdd.append(Harddisk(device)) - self.hdd.sort() - SystemInfo["Harddisk"] = len(self.hdd) > 0 + return error, blacklisted, removable, is_cdrom, partitions, medium_found def removeHotplugPartition(self, device): mountpoint = self.getAutofsMountpoint(device) @@ -608,15 +636,23 @@ class HarddiskManager: def getUserfriendlyDeviceName(self, dev, phys): dev, part = self.splitDeviceName(dev) description = "External Storage %s" % dev + have_model_descr = False try: description = readFile("/sys" + phys + "/model") + have_model_descr = True except IOError, s: print "couldn't read model: ", s from Tools.HardwareInfo import HardwareInfo - for physdevprefix, pdescription in DEVICEDB.get(HardwareInfo().device_name,{}).items(): + if dev.find('sr') == 0 and dev[2].isdigit(): + devicedb = DEVICEDB_SR + else: + devicedb = DEVICEDB + for physdevprefix, pdescription in devicedb.get(HardwareInfo().device_name,{}).items(): if phys.startswith(physdevprefix): - description = pdescription - + if have_model_descr: + description = pdescription + ' - ' + description + else: + description = pdescription # not wholedisk and not partition 1 if part and part != 1: description += " (Partition %d)" % part diff --git a/lib/python/Components/Keyboard.py b/lib/python/Components/Keyboard.py index 820d1036..b026cd56 100755 --- a/lib/python/Components/Keyboard.py +++ b/lib/python/Components/Keyboard.py @@ -1,6 +1,7 @@ from Components.Console import Console from os import listdir as os_listdir, path as os_path from re import compile as re_compile +from enigma import eEnv class Keyboard: def __init__(self): @@ -8,9 +9,9 @@ class Keyboard: self.readKeyboardMapFiles() def readKeyboardMapFiles(self): - for keymapfile in os_listdir('/usr/share/keymaps/'): + for keymapfile in os_listdir(eEnv.resolve('${datadir}/keymaps/')): if (keymapfile.endswith(".info")): - f = open('/usr/share/keymaps/' + keymapfile) + f = open(eEnv.resolve('${datadir}/keymaps/') + keymapfile) mapfile = None mapname = None for line in f: @@ -32,7 +33,7 @@ class Keyboard: try: keymap = self.keyboardmaps[index] print "Activating keymap:",keymap[1] - keymappath = '/usr/share/keymaps/' + keymap[0] + keymappath = eEnv.resolve('${datadir}/keymaps/') + keymap[0] if os_path.exists(keymappath): Console().ePopen(("loadkmap < " + str(keymappath))) except: diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 73031861..d8a7c5c2 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -10,7 +10,7 @@ from enigma import eDVBSatelliteEquipmentControl as secClass, \ eDVBSatelliteDiseqcParameters as diseqcParam, \ eDVBSatelliteSwitchParameters as switchParam, \ eDVBSatelliteRotorParameters as rotorParam, \ - eDVBResourceManager, eDVBDB + eDVBResourceManager, eDVBDB, eEnv from time import localtime, mktime from datetime import datetime @@ -1082,7 +1082,7 @@ def InitNimManager(nimmgr): unicablelnbproducts = {} unicablematrixproducts = {} - doc = xml.etree.cElementTree.parse("/usr/share/enigma2/unicable.xml") + doc = xml.etree.cElementTree.parse(eEnv.resolve("${datadir}/enigma2/unicable.xml")) root = doc.getroot() entry = root.find("lnb") diff --git a/lib/python/Components/Renderer/Picon.py b/lib/python/Components/Renderer/Picon.py index 5ae43ed8..51dc09a5 100644 --- a/lib/python/Components/Renderer/Picon.py +++ b/lib/python/Components/Renderer/Picon.py @@ -2,11 +2,11 @@ ## Picon renderer by Gruffy .. some speedups by Ghost ## from Renderer import Renderer -from enigma import ePixmap +from enigma import ePixmap, eEnv from Tools.Directories import fileExists, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, resolveFilename class Picon(Renderer): - searchPaths = ('/usr/share/enigma2/%s/', + searchPaths = (eEnv.resolve('${datadir}/enigma2/%s/'), '/media/cf/%s/', '/media/usb/%s/') diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index b86c1a13..8ea9aa6a 100644 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -1,7 +1,7 @@ from Components.Harddisk import harddiskmanager from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations from Tools.Directories import resolveFilename, SCOPE_HDD -from enigma import Misc_Options, setTunerTypePriorityOrder; +from enigma import Misc_Options, setTunerTypePriorityOrder, eEnv; from SystemInfo import SystemInfo import os @@ -94,7 +94,7 @@ def InitUsageConfig(): SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output() - config.usage.keymap = ConfigText(default = "/usr/share/enigma2/keymap.xml") + config.usage.keymap = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keymap.xml")) config.seek = ConfigSubsection() config.seek.selfdefined_13 = ConfigNumber(default=15) diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am index e38f7d82..666ba67d 100644 --- a/lib/python/Makefile.am +++ b/lib/python/Makefile.am @@ -1,23 +1,45 @@ -INCLUDES = \ +AM_CPPFLAGS = \ + -I$(top_srcdir) \ -I$(top_srcdir)/include \ - -I$(top_srcdir)/src + -include Python.h \ + -include $(top_builddir)/enigma2_config.h SUBDIRS = Components Tools Screens Plugins noinst_LIBRARIES = libenigma_python.a libenigma_python_a_SOURCES = \ - python.cpp enigma_python_wrap.cxx connections.cpp + connections.cpp \ + python.cpp -enigma_python_wrap.cxx: enigma_python.i - swig -I$(top_srcdir)/ -c++ -python -O -nortti -nothreads enigma_python.i - python enigma_py_patcher.py +pythonincludedir = $(pkgincludedir)/lib/python +pythoninclude_HEADERS = \ + connections.h \ + python.h \ + swig.h -enigma.py: enigma_python_wrap.cxx +nodist_libenigma_python_a_SOURCES = \ + enigma_python.cpp -CLEANFILES = enigma.py enigma_python_wrap.cxx +noinst_PYTHON = \ + enigma_py_patcher.py + +EXTRA_DIST = \ + enigma_python.i + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enigma_python.Pcpp@am__quote@ + +.i.cpp: + $(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -MT $@ -MD -MF $(DEPDIR)/$*.Tpo -I$(top_srcdir) -O -nortti -nothreads -o $@ $< + $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Pcpp + $(AM_V_at)$(PYTHON) $(srcdir)/enigma_py_patcher.py + +enigma.py: enigma_python.cpp + +CLEANFILES = enigma.py enigma_python.cpp installdir = $(pkglibdir)/python install_PYTHON = \ enigma.py + diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am index 3ccca98e..4828081f 100644 --- a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am +++ b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(LIBDIR)/enigma2/python/Plugins/DemoPlugins/TPMDemo +installdir = $(pkglibdir)/python/Plugins/DemoPlugins/TPMDemo install_PYTHON = \ __init__.py \ diff --git a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am index 71ea7142..ec212e47 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am @@ -1,4 +1,3 @@ -if HAVE_DDVDLIB SUBDIRS = src meta installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer @@ -8,4 +7,3 @@ install_PYTHON = \ plugin.py \ keymap.xml \ LICENSE -endif diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am index 27c751cf..7aaec9bb 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am @@ -1,17 +1,15 @@ -OBJS := servicedvd.cpp +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h --include $(OBJS:.cpp=.d) +plugindir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer -installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer +plugin_LTLIBRARIES = servicedvd.la -install_PYTHON = \ - servicedvd.so +servicedvd_la_SOURCES = \ + servicedvd.cpp \ + servicedvd.h -servicedvd.so: - $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \ - -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,servicedvd.so -o servicedvd.so \ - $(LDFLAGS) -ldreamdvd - -all: servicedvd.so - -CLEANFILES = servicedvd.so servicedvd.d +servicedvd_la_LDFLAGS = -avoid-version -module diff --git a/lib/python/Plugins/Extensions/Makefile.am b/lib/python/Plugins/Extensions/Makefile.am index 5a6e3f3a..7a3a9be2 100755 --- a/lib/python/Plugins/Extensions/Makefile.am +++ b/lib/python/Plugins/Extensions/Makefile.am @@ -1,6 +1,10 @@ installdir = $(pkglibdir)/python/Plugins/Extensions -SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDPlayer DVDBurn Modem +SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDBurn Modem + +if HAVE_LIBDDVD +SUBDIRS += DVDPlayer +endif install_PYTHON = \ __init__.py diff --git a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am index 8e80e183..5ce7d031 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am +++ b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am @@ -1,17 +1,15 @@ -OBJS = socket_mmi.cpp +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h --include $(OBJS:.cpp=.d) +plugindir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI -installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI +plugin_LTLIBRARIES = socketmmi.la -install_PYTHON = \ - socketmmi.so +socketmmi_la_SOURCES = \ + socket_mmi.cpp \ + socket_mmi.h -socketmmi.so: socket_mmi.cpp socket_mmi.h - $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \ - -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,socketmmi.so -o socketmmi.so \ - $(LDFLAGS) - -all: socketmmi.so - -CLEANFILES = socketmmi.so socketmmi.d +socketmmi_la_LDFLAGS = -avoid-version -module diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py index 2c0edf53..52296c66 100755 --- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py @@ -12,7 +12,7 @@ from ServiceReference import ServiceReference from Plugins.Plugin import PluginDescriptor from xml.etree.cElementTree import parse as ci_parse from Tools.XMLTools import elementsWithTag, mergeText, stringToXML -from enigma import eDVBCI_UI, eDVBCIInterfaces +from enigma import eDVBCI_UI, eDVBCIInterfaces, eEnv from os import system, path as os_path @@ -115,7 +115,7 @@ class CIconfigMenu(Screen): Screen.__init__(self, session) self.ci_slot=ci_slot - self.filename="/etc/enigma2/ci"+str(self.ci_slot)+".xml" + self.filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(self.ci_slot) + ".xml" self["key_red"] = StaticText(_("Delete")) self["key_green"] = StaticText(_("add Service")) @@ -567,7 +567,7 @@ def activate_all(session): return Len > 0 and definitions[Len-1].text or default for ci in range(NUM_CI): - filename="/etc/enigma2/ci"+str(ci)+".xml" + filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml" if not os_path.exists(filename): print "[CI_Activate_Config_CI%d] no config file found" %ci diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py index b19007c9..1f379f10 100644 --- a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py @@ -1,66 +1,300 @@ from Plugins.Plugin import PluginDescriptor -from twisted.internet.protocol import Protocol, Factory -from twisted.internet import reactor from Components.Harddisk import harddiskmanager +from Tools.Directories import fileExists hotplugNotifier = [ ] +bdpoll = None -class Hotplug(Protocol): - def connectionMade(self): - self.received = "" +def processHotplugData(self, v): + print "hotplug:", v + action = v.get("ACTION") + device = v.get("DEVPATH") + physdevpath = v.get("PHYSDEVPATH") + media_state = v.get("X_E2_MEDIA_STATUS") - def dataReceived(self, data): - self.received += data + dev = device.split('/')[-1] - def connectionLost(self, reason): - data = self.received.split('\0')[:-1] + if action is not None and action == "add": + error, blacklisted, removable, is_cdrom, partitions, medium_found = harddiskmanager.addHotplugPartition(dev, physdevpath) + if bdpoll and removable or is_cdrom: + bdpoll.addDevice(dev, is_cdrom, medium_found) + elif action is not None and action == "remove": + if bdpoll: + bdpoll.removeDevice(dev) + harddiskmanager.removeHotplugPartition(dev) + elif media_state is not None: + if media_state == '1': + harddiskmanager.removeHotplugPartition(dev) + harddiskmanager.addHotplugPartition(dev, physdevpath) + elif media_state == '0': + harddiskmanager.removeHotplugPartition(dev) - v = {} + for callback in hotplugNotifier: + try: + callback(dev, action or media_state) + except AttributeError: + hotplugNotifier.remove(callback) - for x in data: - i = x.find('=') - var, val = x[:i], x[i+1:] - v[var] = val +CDROM_DRIVE_STATUS = 0x5326 +CDROM_MEDIA_CHANGED = 0x5325 +CDSL_CURRENT = ((int)(~0>>1)) +CDS_NO_INFO = 0 +CDS_NO_DISC = 1 +CDS_TRAY_OPEN = 2 +CDS_DRIVE_NOT_READY = 3 +CDS_DISC_OK = 4 +ENOMEDIUM = 159 +IOC_NRBITS = 8 +IOC_NRSHIFT = 0 +IOC_TYPESHIFT = (IOC_NRSHIFT+IOC_NRBITS) +BLKRRPART = ((0x12<<IOC_TYPESHIFT) | (95<<IOC_NRSHIFT)) - print "hotplug:", v +def autostart(reason, **kwargs): + if reason == 0: + print "starting hotplug handler" - action = v.get("ACTION") - device = v.get("DEVPATH") - physdevpath = v.get("PHYSDEVPATH") - media_state = v.get("X_E2_MEDIA_STATUS") + if fileExists('/dev/.udev'): + global netlink + global bdpoll + from enigma import eSocketNotifier, eTimer, ePythonMessagePump + import socket + from select import POLLIN, POLLPRI - dev = device.split('/')[-1] + class Netlink: + def __init__(self): + self.netlink = socket.socket(socket.AF_NETLINK, socket.SOCK_DGRAM, 15) + self.netlink.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 65536) + self.netlink.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 65536) + self.netlink.bind((0, 1)) + self.sn = eSocketNotifier(self.netlink.fileno(), POLLIN|POLLPRI) + self.sn.callback.append(self.dataAvail) - if action is not None and action == "add": - harddiskmanager.addHotplugPartition(dev, physdevpath) - elif action is not None and action == "remove": - harddiskmanager.removeHotplugPartition(dev) - elif media_state is not None: - if media_state == '1': - harddiskmanager.removeHotplugPartition(dev) - harddiskmanager.addHotplugPartition(dev, physdevpath) - elif media_state == '0': - harddiskmanager.removeHotplugPartition(dev) - - for callback in hotplugNotifier: - try: - callback(dev, action or media_state) - except AttributeError: - hotplugNotifier.remove(callback) + def dataAvail(self, what): + received = self.netlink.recvfrom(16384) +# print "HOTPLUG(%d):" %(what), received -def autostart(reason, **kwargs): - if reason == 0: - print "starting hotplug handler" - factory = Factory() - factory.protocol = Hotplug + data = received[0].split('\0')[:-1] + v = {} + + for x in data: + i = x.find('=') + var, val = x[:i], x[i+1:] + v[var] = val + + if v['SUBSYSTEM'] == 'block' and v['ACTION'] in ('add', 'remove'): + processHotplugData(self, v) + + from threading import Thread, Semaphore, Lock + + class ThreadQueue: + def __init__(self): + self.__list = [ ] + self.__lock = Lock() + + def push(self, val): + list = self.__list + lock = self.__lock + lock.acquire() + list.append(val) + lock.release() + + def pop(self): + list = self.__list + lock = self.__lock + lock.acquire() + ret = list[0] + del list[0] + lock.release() + return ret - try: import os - os.remove("/tmp/hotplug.socket") - except OSError: - pass + import errno + import fcntl + + class BDPoll(Thread): + CHECK_INTERVAL = 2000 + MSG_MEDIUM_REMOVED = 1 + MSG_MEDIUM_INSERTED = 2 + MSG_POLL_FINISHED = 4 + def __init__(self): + Thread.__init__(self) + self.__sema = Semaphore(0) + self.__lock = Lock() + self.running = False + self.devices_to_poll = { } + self.messages = ThreadQueue() + self.checkTimer = eTimer() + self.checkTimer.callback.append(self.timeout) + self.checkTimer.start(BDPoll.CHECK_INTERVAL, True) + self.mp = ePythonMessagePump() + self.mp.recv_msg.get().append(self.gotThreadMsg) + self.start() + + def gotThreadMsg(self, msg): + msg = self.messages.pop() + if msg[0] == BDPoll.MSG_MEDIUM_REMOVED: + print "MSG_MEDIUM_REMOVED" + harddiskmanager.removeHotplugPartition(msg[1]) + elif msg[0] == BDPoll.MSG_MEDIUM_INSERTED: + print "MSG_MEDIUM_INSERTED" + harddiskmanager.addHotplugPartition(msg[1]) + elif msg[0] == BDPoll.MSG_POLL_FINISHED: + self.checkTimer.start(BDPoll.CHECK_INTERVAL, True) + + def timeout(self): + self.__sema.release() # start bdpoll loop in thread + + def is_mounted(self, dev): + mounts = file('/proc/mounts').read() + return mounts.find(dev) != -1 + + def run(self): + sema = self.__sema + lock = self.__lock + messages = self.messages + mp = self.mp + self.running = True + while self.running: + sema.acquire() + self.__lock.acquire() + devices_to_poll = self.devices_to_poll.items() + self.__lock.release() + devices_to_poll_processed = [ ] + for device, state in devices_to_poll: + got_media = False + is_cdrom, prev_media_state = state + if is_cdrom: + try: + fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK | os.O_EXCL) + except OSError, err: + if err.errno == errno.EBUSY: + print "open cdrom exclusive failed:", + if not self.is_mounted(device): + print "not mounted" + continue + try: + print "mounted... try non exclusive" + fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK) + except OSError, err: + print "open cdrom not exclusive failed", os.strerror(err.errno) + continue + #here the fs must be valid! + try: + ret = fcntl.ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) + except IOError, err: + print "ioctl CDROM_DRIVE_STATUS failed", os.strerror(err.errno) + else: + if ret in (CDS_NO_INFO, CDS_NO_DISC, CDS_TRAY_OPEN, CDS_DRIVE_NOT_READY): + pass + elif ret == CDS_DISC_OK: + #todo new kernels support events to userspace event on media change + #but not 2.6.18.... see hotplug-ng bdpoll.c + got_media = True + os.close(fd) + else: + try: + fd = os.open("/dev/" + device, os.O_RDONLY) + except OSError, err: + if err.errno == ENOMEDIUM: + pass + else: + print "open non cdrom failed", os.strerror(err.errno) + continue + else: + got_media = True + os.close(fd) + if prev_media_state: + if not got_media: + print "media removal detected on", device + try: + fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK) + except OSError, err: + print "open device for blkrrpart ioctl failed", os.strerror(err.errno) + else: + try: + fcntl.ioctl(fd, BLKRRPART) + except IOError, err: + print "ioctl BLKRRPART failed", os.strerror(err.errno) + os.close(fd) + else: + if got_media: + print "media insertion detected on", device + devices_to_poll_processed.append((device, is_cdrom, got_media)) + self.__lock.acquire() + for device, is_cdrom, state in devices_to_poll_processed: + old_state = self.devices_to_poll.get(device) + if old_state is not None and old_state[1] != state: + msg = state and BDPoll.MSG_MEDIUM_INSERTED or BDPoll.MSG_MEDIUM_REMOVED + self.devices_to_poll[device] = (is_cdrom, state) + messages.push((msg, device)) + mp.send(0) + + self.__lock.release() + messages.push((self.MSG_POLL_FINISHED,)) + mp.send(0) + + def addDevice(self, device, is_cdrom, inserted): + self.__lock.acquire() + if device in self.devices_to_poll: + print "device", device, "already in bdpoll" + else: + print "add device", device, "to bdpoll current state:", + if inserted: + print "medium inserted" + else: + print "medium removed" + self.devices_to_poll[device] = (is_cdrom, inserted) + self.__lock.release() + + def removeDevice(self, device): + self.__lock.acquire() + if device in self.devices_to_poll: + print "device", device, "removed from bdpoll" + del self.devices_to_poll[device] + else: + print "try to del not exist device", device, "from bdpoll" + self.__lock.release() + + netlink = Netlink() + bdpoll = BDPoll() + for blockdev, removable, is_cdrom, medium_found in harddiskmanager.devices_scanned_on_init: + if removable or is_cdrom: + bdpoll.addDevice(blockdev, is_cdrom, medium_found) + else: + from twisted.internet.protocol import Protocol, Factory + from twisted.internet import reactor + + try: + import os + os.remove("/tmp/hotplug.socket") + except OSError: + pass + + class Hotplug(Protocol): + def connectionMade(self): + print "HOTPLUG connection!" + self.received = "" + + def dataReceived(self, data): + print "hotplug:", data + self.received += data + print "complete", self.received + + def connectionLost(self, reason): + print "HOTPLUG connection lost!" + data = self.received.split('\0')[:-1] + v = {} + + for x in data: + i = x.find('=') + var, val = x[:i], x[i+1:] + v[var] = val + + processHotplugData(self, v) - reactor.listenUNIX("/tmp/hotplug.socket", factory) + factory = Factory() + factory.protocol = Hotplug + reactor.listenUNIX("/tmp/hotplug.socket", factory) def Plugins(**kwargs): return PluginDescriptor(name = "Hotplug", description = "listens to hotplug events", where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py index ba96c071..3504d4cb 100755 --- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py +++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py @@ -14,7 +14,7 @@ from Screens.TaskView import JobView from Tools.Directories import fileExists from Tools.HardwareInfo import HardwareInfo from os import system -from enigma import eConsoleAppContainer, quitMainloop +from enigma import eConsoleAppContainer, quitMainloop, eEnv from Components.About import about class md5Postcondition(Condition): @@ -51,7 +51,7 @@ class md5verify(Task): class writeNAND(Task): def __init__(self, job, param, box): Task.__init__(self,job, ("Writing image file to NAND Flash")) - self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1") + self.setTool(eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1")) if box == "dm7025": self.end = 256 elif box[:5] == "dm800": @@ -226,4 +226,4 @@ class NFIFlash(Screen): if self.job.status == self.job.FINISHED: self["status"].text = ("rebooting...") from os import system - system("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh") + system(eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh")) diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py index 997b9571..30cbb6b6 100755 --- a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py @@ -12,12 +12,13 @@ from Plugins.Plugin import PluginDescriptor from Components.config import config from Tools.Directories import resolveFilename, SCOPE_PLUGINS from os import path, walk +from enigma import eEnv class SkinSelector(Screen): # for i18n: # _("Choose your Skin") skinlist = [] - root = "/usr/share/enigma2/" + root = eEnv.resolve("${datadir}/enigma2/") def __init__(self, session, args = None): diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index 7bd7d7a2..01649bb3 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -11,7 +11,7 @@ from Components.config import config from Components.ConfigList import ConfigList,ConfigListScreen from Components.FileList import MultiFileSelectList from Plugins.Plugin import PluginDescriptor -from enigma import eTimer +from enigma import eTimer, eEnv from Tools.Directories import * from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK from time import gmtime, strftime, localtime @@ -20,7 +20,7 @@ from datetime import date config.plugins.configurationbackup = ConfigSubsection() config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) -config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) +config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) def getBackupPath(): backuppath = config.plugins.configurationbackup.backuplocation.value diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py index 1797e4fe..32d7140a 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py @@ -9,13 +9,14 @@ from Plugins.Plugin import PluginDescriptor from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK +from enigma import eEnv from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigBoolean from Components.Harddisk import harddiskmanager config.misc.firstrun = ConfigBoolean(default = True) config.plugins.configurationbackup = ConfigSubsection() config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) -config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf']) +config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf']) backupfile = "enigma2settingsbackup.tar.gz" diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 707663a0..e1f3e1de 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -28,7 +28,7 @@ from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR from Tools.LoadPixmap import LoadPixmap from Tools.NumericalTextInput import NumericalTextInput -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode, eEnv from cPickle import dump, load from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK from time import time, gmtime, strftime, localtime @@ -43,7 +43,7 @@ from SoftwareTools import iSoftwareTools config.plugins.configurationbackup = ConfigSubsection() config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False) -config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) +config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname']) config.plugins.SoftwareManager = ConfigSubsection() config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection( @@ -1684,7 +1684,7 @@ class PacketManager(Screen, NumericalTextInput): self.cmdList = [] self.cachelist = [] self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs) - self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory + self.cache_file = eEnv.resolve('${libdir}/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache') #Path to cache directory self.oktext = _("\nAfter pressing OK, please wait!") self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox') self.opkgAvail = fileExists('/usr/bin/opkg') diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am index cfdeb654..490a7720 100755 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am @@ -1,4 +1,4 @@ -installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/TempFanControl +installdir = $(pkglibdir)/python/Plugins/SystemPlugins/TempFanControl SUBDIRS = meta @@ -6,4 +6,4 @@ install_PYTHON = \ __init__.py \ plugin.py -dist_install_DATA = LICENSE
\ No newline at end of file +dist_install_DATA = LICENSE diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py index 28ee363e..a13c7975 100755 --- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py +++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py @@ -1,4 +1,4 @@ -from enigma import eTimer, eTPM +from enigma import eTimer, eTPM, eEnv from Screens.Screen import Screen from Components.ActionMap import ActionMap, NumberActionMap from Components.Pixmap import Pixmap,MultiPixmap @@ -18,7 +18,7 @@ from Tools.HardwareInfo import HardwareInfo from Wlan import Wlan, wpaSupplicant, iStatus import sha -plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan" +plugin_path = eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/WirelessLan") list = [] list.append("WEP") diff --git a/lib/python/Plugins/newplugin.py b/lib/python/Plugins/newplugin.py index c1c6f948..32c7269d 100644..100755 --- a/lib/python/Plugins/newplugin.py +++ b/lib/python/Plugins/newplugin.py @@ -137,7 +137,7 @@ def Plugins(**kwargs): file.close() makefile = open(pluginpath + "/Makefile.am", "w") -makefile.write("""installdir = $(LIBDIR)/enigma2/python/Plugins/%s/%s +makefile.write("""installdir = $(pkglibdir)/python/Plugins/%s/%s install_PYTHON = \\ __init__.py \\ diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index 34316f01..c07e3495 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -8,7 +8,7 @@ from Components.MenuList import MenuList from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase profile("ChannelSelection.py 1") from EpgSelection import EPGSelection -from enigma import eServiceReference, eEPGCache, eServiceCenter, eRCInput, eTimer, eDVBDB, iPlayableService, iServiceInformation, getPrevAsciiCode +from enigma import eServiceReference, eEPGCache, eServiceCenter, eRCInput, eTimer, eDVBDB, iPlayableService, iServiceInformation, getPrevAsciiCode, eEnv from Components.config import config, ConfigSubsection, ConfigText from Tools.NumericalTextInput import NumericalTextInput profile("ChannelSelection.py 2") @@ -544,7 +544,7 @@ class ChannelSelectionEdit: refstr = refstr[pos+14:] pos = refstr.find('"') if pos != -1: - filename = '/etc/enigma2/' + refstr[:pos] # FIXMEEE !!! HARDCODED /etc/enigma2 + filename = eEnv.resolve('${sysconfdir}/enigma2/') + refstr[:pos] self.removeCurrentService() try: if filename is not None: diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py index e9c3c680..61e6fdd7 100755 --- a/lib/python/Screens/Setup.py +++ b/lib/python/Screens/Setup.py @@ -4,6 +4,7 @@ from Components.config import config, ConfigNothing from Components.SystemInfo import SystemInfo from Components.ConfigList import ConfigListScreen from Components.Sources.StaticText import StaticText +from enigma import eEnv import xml.etree.cElementTree @@ -14,7 +15,7 @@ try: setupfile = file('data/setup.xml', 'r') except: # if not found in the current path, we use the global datadir-path - setupfile = file('/usr/share/enigma2/setup.xml', 'r') + setupfile = file(eEnv.resolve('${datadir}/enigma2/setup.xml'), 'r') setupdom = xml.etree.cElementTree.parse(setupfile) setupfile.close() diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index a752d31c..61e1d5ef 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -10,7 +10,7 @@ from Components.ActionMap import NumberActionMap from Components.MenuList import MenuList from Components.ConfigList import ConfigList from Components.Sources.List import List -from enigma import eTimer +from enigma import eTimer, eEnv from xml.sax import make_parser from xml.sax.handler import ContentHandler @@ -178,7 +178,7 @@ class Wizard(Screen): parser.setContentHandler(wizardHandler) for xmlfile in self.xmlfile: if xmlfile[0] != '/': - parser.parse('/usr/share/enigma2/' + xmlfile) + parser.parse(eEnv.resolve('${datadir}/enigma2/') + xmlfile) else: parser.parse(xmlfile) diff --git a/lib/python/Tools/Directories.py b/lib/python/Tools/Directories.py index 8ed2c8a4..518db49d 100755 --- a/lib/python/Tools/Directories.py +++ b/lib/python/Tools/Directories.py @@ -3,6 +3,7 @@ from os import path as os_path, mkdir, rmdir, system, walk, stat as os_stat, listdir, readlink, makedirs, error as os_error, symlink, access, F_OK, R_OK, W_OK from stat import S_IMODE from re import compile +from enigma import eEnv try: from os import chmod @@ -39,26 +40,26 @@ PATH_CREATE = 0 PATH_DONTCREATE = 1 PATH_FALLBACK = 2 defaultPaths = { - SCOPE_TRANSPONDERDATA: ("/etc/", PATH_DONTCREATE), - SCOPE_SYSETC: ("/etc/", PATH_DONTCREATE), - SCOPE_FONTS: ("/usr/share/fonts/", PATH_DONTCREATE), - SCOPE_CONFIG: ("/etc/enigma2/", PATH_CREATE), - SCOPE_PLUGINS: ("/usr/lib/enigma2/python/Plugins/", PATH_CREATE), + SCOPE_TRANSPONDERDATA: (eEnv.resolve("${sysconfdir}/"), PATH_DONTCREATE), + SCOPE_SYSETC: (eEnv.resolve("${sysconfdir}/"), PATH_DONTCREATE), + SCOPE_FONTS: (eEnv.resolve("${datadir}/fonts/"), PATH_DONTCREATE), + SCOPE_CONFIG: (eEnv.resolve("${sysconfdir}/enigma2/"), PATH_CREATE), + SCOPE_PLUGINS: (eEnv.resolve("${libdir}/enigma2/python/Plugins/"), PATH_CREATE), - SCOPE_LANGUAGE: ("/usr/share/enigma2/po/", PATH_DONTCREATE), + SCOPE_LANGUAGE: (eEnv.resolve("${datadir}/enigma2/po/"), PATH_DONTCREATE), - SCOPE_SKIN: ("/usr/share/enigma2/", PATH_DONTCREATE), - SCOPE_SKIN_IMAGE: ("/usr/share/enigma2/", PATH_DONTCREATE), + SCOPE_SKIN: (eEnv.resolve("${datadir}/enigma2/"), PATH_DONTCREATE), + SCOPE_SKIN_IMAGE: (eEnv.resolve("${datadir}/enigma2/"), PATH_DONTCREATE), SCOPE_HDD: ("/hdd/movie/", PATH_DONTCREATE), SCOPE_MEDIA: ("/media/", PATH_DONTCREATE), - SCOPE_PLAYLIST: ("/etc/enigma2/playlist/", PATH_CREATE), + SCOPE_PLAYLIST: (eEnv.resolve("${sysconfdir}/enigma2/playlist/"), PATH_CREATE), SCOPE_USERETC: ("", PATH_DONTCREATE), # user home directory - SCOPE_DEFAULTDIR: ("/usr/share/enigma2/defaults/", PATH_CREATE), + SCOPE_DEFAULTDIR: (eEnv.resolve("${datadir}/enigma2/defaults/"), PATH_CREATE), SCOPE_DEFAULTPARTITION: ("/dev/mtdblock/6", PATH_DONTCREATE), - SCOPE_DEFAULTPARTITIONMOUNTDIR: ("/usr/share/enigma2/dealer", PATH_CREATE), - SCOPE_METADIR: ("/usr/share/meta", PATH_CREATE), + SCOPE_DEFAULTPARTITIONMOUNTDIR: (eEnv.resolve("${datadir}/enigma2/dealer"), PATH_CREATE), + SCOPE_METADIR: (eEnv.resolve("${datadir}/meta"), PATH_CREATE), } FILE_COPY = 0 # copy files from fallback dir to the basedir @@ -67,7 +68,7 @@ PATH_COPY = 2 # copy the complete fallback dir to the basedir PATH_MOVE = 3 # move the fallback dir to the basedir (can be used for changes in paths) fallbackPaths = { SCOPE_CONFIG: [("/home/root/", FILE_MOVE), - ("/usr/share/enigma2/defaults/", FILE_COPY)], + (eEnv.resolve("${datadir}/enigma2/defaults/"), FILE_COPY)], SCOPE_HDD: [("/hdd/movies", PATH_MOVE)] } diff --git a/lib/python/connections.h b/lib/python/connections.h index ad76198a..b4cd1c79 100644 --- a/lib/python/connections.h +++ b/lib/python/connections.h @@ -3,11 +3,6 @@ #include <libsig_comp.h> - /* avoid warnigs :) */ -#include <features.h> -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200112L - #include <lib/python/python.h> class PSignal diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 19fb9254..7c999277 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -38,6 +38,7 @@ is usually caused by not marking PSignals as immutable. #define SWIG_COMPILE #include <lib/base/ebase.h> #include <lib/base/smartptr.h> +#include <lib/base/eenv.h> #include <lib/base/eerror.h> #include <lib/base/etpm.h> #include <lib/base/nconfig.h> @@ -50,7 +51,7 @@ is usually caused by not marking PSignals as immutable. #include <lib/gdi/fb.h> #include <lib/gdi/font.h> #include <lib/gdi/gpixmap.h> -#include <lib/gdi/gfbdc.h> +#include <lib/gdi/gmaindc.h> #include <lib/gui/ewidget.h> #include <lib/gui/elabel.h> #include <lib/gui/einput.h> @@ -133,6 +134,7 @@ typedef long time_t; %include "std_string.i" %include <lib/python/swig.h> %include <lib/base/object.h> +%include <lib/base/eenv.h> %include <lib/base/eerror.h> %immutable eSocketNotifier::activated; @@ -164,7 +166,7 @@ typedef long time_t; %include <lib/gdi/fb.h> %include <lib/gdi/font.h> %include <lib/gdi/gpixmap.h> -%include <lib/gdi/gfbdc.h> +%include <lib/gdi/gmaindc.h> %include <lib/gdi/epoint.h> %include <lib/gdi/erect.h> %include <lib/gdi/esize.h> diff --git a/lib/python/python.h b/lib/python/python.h index 18fdac78..f5b6e4d8 100644 --- a/lib/python/python.h +++ b/lib/python/python.h @@ -4,7 +4,6 @@ #define __lib_python_python_class_h #endif -#include <Python.h> #include <string> #include <lib/base/object.h> diff --git a/lib/service/Makefile.am b/lib/service/Makefile.am index ed09d73d..edafd1a2 100644 --- a/lib/service/Makefile.am +++ b/lib/service/Makefile.am @@ -1,9 +1,37 @@ -INCLUDES = \ - -I$(top_srcdir)/include +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include \ + -include Python.h \ + -include $(top_builddir)/enigma2_config.h + +AM_CXXFLAGS = \ + $(LIBXINE_CFLAGS) noinst_LIBRARIES = libenigma_service.a libenigma_service_a_SOURCES = \ - listboxservice.cpp service.cpp servicemp3.cpp servicedvb.cpp servicefs.cpp \ - event.cpp servicedvbrecord.cpp - + event.cpp \ + listboxservice.cpp \ + service.cpp \ + servicedvb.cpp \ + servicedvbrecord.cpp \ + servicefs.cpp \ + servicemp3.cpp + +serviceincludedir = $(pkgincludedir)/lib/service +serviceinclude_HEADERS = \ + event.h \ + iservice.h \ + listboxservice.h \ + service.h \ + servicedvb.h \ + servicedvbrecord.h \ + servicefs.h \ + servicemp3.h + +if HAVE_LIBXINE +libenigma_service_a_SOURCES += \ + servicexine.cpp +serviceinclude_HEADERS += \ + servicexine.h +endif diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 1fb1e443..e453a2b3 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -1,5 +1,3 @@ -#ifdef HAVE_GSTREAMER - /* note: this requires gstreamer 0.10.x and a big list of plugins. */ /* it's currently hardcoded to use a big-endian alsasink as sink. */ #include <lib/base/ebase.h> @@ -1791,6 +1789,3 @@ void eServiceMP3::setPCMDelay(int delay) } } -#else -#warning gstreamer not available, not building media player -#endif diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 01f7cf7f..b864a100 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -1,7 +1,6 @@ #ifndef __servicemp3_h #define __servicemp3_h -#ifdef HAVE_GSTREAMER #include <lib/base/message.h> #include <lib/service/iservice.h> #include <lib/dvb/pmt.h> @@ -228,6 +227,5 @@ private: std::string m_useragent; RESULT trickSeek(gdouble ratio); }; -#endif #endif |
