Merge remote branch 'remotes/origin/bug_135_dvdburn_ts_only' into experimental
[enigma2.git] / main / enigma.cpp
index 72087c92144655f63cf6f2b981c92859cdece004..3f420b4bb6ee2e996e5a863dc42d457fc8073ae5 100644 (file)
@@ -1,9 +1,8 @@
-#ifdef WITH_SDL
-#define SDLDC
-#endif
-
-#include <stdio.h>
 #include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
 #include <libsig_comp.h>
 
 #include <lib/actions/action.h>
@@ -150,7 +149,7 @@ int main(int argc, char **argv)
        eMain main;
 
 #if 1
-#ifdef SDLDC
+#ifdef WITH_SDL
        ePtr<gSDLDC> my_dc;
        gSDLDC::getInstance(my_dc);
 #else
@@ -191,7 +190,7 @@ int main(int argc, char **argv)
        dsk_lcd.setDC(my_lcd_dc);
 
        ePtr<gPixmap> m_pm;
-       loadPNG(m_pm, DATADIR "/enigma2/pal.png");
+       loadPNG(m_pm, DATADIR "/enigma2/skin_default/pal.png");
        if (!m_pm)
        {
                eFatal("pal.png not found!");
@@ -214,8 +213,8 @@ int main(int argc, char **argv)
                ePtr<gPixmap> wait[MAX_SPINNER];
                for (i=0; i<MAX_SPINNER; ++i)
                {
-                       char filename[strlen(DATADIR) + 20];
-                       sprintf(filename, DATADIR "/enigma2/wait%d.png", i + 1);
+                       char filename[strlen(DATADIR) + 41];
+                       sprintf(filename, DATADIR "/enigma2/skin_default/spinner/wait%d.png", i + 1);
                        loadPNG(wait[i], filename);
                        
                        if (!wait[i])
@@ -243,12 +242,16 @@ int main(int argc, char **argv)
 
        setIoPrio(IOPRIO_CLASS_BE, 3);
 
-       python.execute("mytest", "__main__");
-       
+//     python.execute("mytest", "__main__");
+       python.execFile("/usr/lib/enigma2/python/mytest.py");
+
+       extern void setFullsize(); // definend in lib/gui/evideo.cpp
+       setFullsize();
+
        if (exit_code == 5) /* python crash */
        {
                eDebug("(exit code 5)");
-               bsodFatal();
+               bsodFatal(0);
        }
        
        dsk.paint();
@@ -258,7 +261,6 @@ int main(int argc, char **argv)
                gPainter p(my_lcd_dc);
                p.resetClip(eRect(0, 0, 132, 64));
                p.clear();
-               p.flush();
        }
 
        return exit_code;
@@ -281,6 +283,24 @@ void runMainloop()
 
 void quitMainloop(int exitCode)
 {
+       FILE *f = fopen("/proc/stb/fp/was_timer_wakeup", "w");
+       if (f)
+       {
+               fprintf(f, "%d", 0);
+               fclose(f);
+       }
+       else
+       {
+               int fd = open("/dev/dbox/fp0", O_WRONLY);
+               if (fd >= 0)
+               {
+                       if (ioctl(fd, 10 /*FP_CLEAR_WAKEUP_TIMER*/) < 0)
+                               eDebug("FP_CLEAR_WAKEUP_TIMER failed (%m)");
+                       close(fd);
+               }
+               else
+                       eDebug("open /dev/dbox/fp0 for wakeup timer clear failed!(%m)");
+       }
        exit_code = exitCode;
        eApp->quit(0);
 }
@@ -289,11 +309,25 @@ void quitMainloop(int exitCode)
 
 const char *getEnigmaVersionString()
 {
-       return 
-#ifdef ENIGMA2_CHECKOUT_TAG
-               ENIGMA2_CHECKOUT_TAG
+       std::string date =
+#ifdef ENIGMA2_LAST_CHANGE_DATE
+               ENIGMA2_LAST_CHANGE_DATE;
 #else
-               "HEAD"
+               __DATE__;
 #endif
-                       "-" __DATE__;
+       std::string branch =
+#ifdef ENIGMA2_BRANCH
+               ENIGMA2_BRANCH;
+#else
+               "HEAD";
+#endif
+       return std::string(date + '-' + branch).c_str();
+}
+
+#include <malloc.h>
+
+void dump_malloc_stats(void)
+{
+       struct mallinfo mi = mallinfo();
+       eDebug("MALLOC: %d total", mi.uordblks);
 }