implement configurable http user-agent (fixes #224)
[enigma2.git] / main / enigma.cpp
index 307edd5a9fd35fb9f0fbe322b7574a1582e2c4ed..b8554d582c1b72f6788002509a36ae3c6a4f698d 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>
@@ -169,11 +172,11 @@ int main(int argc, char **argv)
                eTextPara::forceReplacementGlyph(i);
 
        eWidgetDesktop dsk(eSize(720, 576));
-       eWidgetDesktop dsk_lcd(eSize(132, 64));
-       
+       eWidgetDesktop dsk_lcd(my_lcd_dc->size());
+
        dsk.setStyleID(0);
-       dsk_lcd.setStyleID(1);
-       
+       dsk_lcd.setStyleID(my_lcd_dc->size().width() == 96 ? 2 : 1);
+
 /*     if (double_buffer)
        {
                eDebug(" - double buffering found, enable buffered graphics mode.");
@@ -210,7 +213,7 @@ int main(int argc, char **argv)
                ePtr<gPixmap> wait[MAX_SPINNER];
                for (i=0; i<MAX_SPINNER; ++i)
                {
-                       char filename[strlen(DATADIR) + 20];
+                       char filename[strlen(DATADIR) + 41];
                        sprintf(filename, DATADIR "/enigma2/skin_default/spinner/wait%d.png", i + 1);
                        loadPNG(wait[i], filename);
                        
@@ -242,10 +245,13 @@ int main(int argc, char **argv)
 //     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();
@@ -277,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);
 }
@@ -285,14 +309,21 @@ 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
+               __DATE__;
+#endif
+       std::string branch =
+#ifdef ENIGMA2_BRANCH
+               ENIGMA2_BRANCH;
 #else
-               "HEAD"
+               "HEAD";
 #endif
-                       "-" __DATE__;
+       return std::string(date + '-' + branch).c_str();
 }
+
 #include <malloc.h>
 
 void dump_malloc_stats(void)