Merge commit 'origin/master' into tmbinc/FixTimingBugs
[enigma2.git] / main / enigma.cpp
index 36fcea4b6985bcbdd0b76bbd310ba18818b32429..98175c49425f927a358a41f8d1471f04b96ab328 100644 (file)
@@ -1,5 +1,8 @@
-#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>
@@ -239,12 +242,13 @@ 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");
+
        if (exit_code == 5) /* python crash */
        {
                eDebug("(exit code 5)");
-               bsodFatal();
+               bsodFatal(0);
        }
        
        dsk.paint();
@@ -276,6 +280,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);
 }
@@ -297,5 +319,5 @@ const char *getEnigmaVersionString()
 void dump_malloc_stats(void)
 {
        struct mallinfo mi = mallinfo();
-       printf("MALLOC: %d total\n", mi.uordblks);
+       eDebug("MALLOC: %d total", mi.uordblks);
 }