-#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>
#include <lib/driver/rc.h>
#include <lib/base/ioprio.h>
#include <lib/base/ebase.h>
+#include <lib/base/eenv.h>
#include <lib/base/eerror.h>
#include <lib/base/init.h>
#include <lib/base/init_num.h>
-#include <lib/gdi/gfbdc.h>
+#include <lib/gdi/gmaindc.h>
#include <lib/gdi/glcddc.h>
#include <lib/gdi/grc.h>
-#ifdef WITH_SDL
-#include <lib/gdi/sdl.h>
-#endif
#include <lib/gdi/epng.h>
-#include <lib/gdi/font.h>
+#include <lib/gdi/font.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/elabel.h>
#include <lib/gui/elistboxcontent.h>
#include <lib/python/connections.h>
#include <lib/python/python.h>
-#include "bsod.h"
+#include "bsod.h"
+#include "version_info.h"
-#ifdef HAVE_GSTREAMER
#include <gst/gst.h>
-#endif
#ifdef OBJECT_DEBUG
int object_total_remaining;
atexit(object_dump);
#endif
-#ifdef HAVE_GSTREAMER
gst_init(&argc, &argv);
-#endif
// set pythonpath if unset
- setenv("PYTHONPATH", LIBDIR "/enigma2/python", 0);
+ setenv("PYTHONPATH", eEnv::resolve("${libdir}/enigma2/python").c_str(), 0);
printf("PYTHONPATH: %s\n", getenv("PYTHONPATH"));
bsodLogInit();
eMain main;
#if 1
-#ifdef SDLDC
- ePtr<gSDLDC> my_dc;
- gSDLDC::getInstance(my_dc);
-#else
- ePtr<gFBDC> my_dc;
- gFBDC::getInstance(my_dc);
+ ePtr<gMainDC> my_dc;
+ gMainDC::getInstance(my_dc);
- int double_buffer = my_dc->haveDoubleBuffering();
-#endif
+ //int double_buffer = my_dc->haveDoubleBuffering();
ePtr<gLCDDC> my_lcd_dc;
gLCDDC::getInstance(my_lcd_dc);
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.");
dsk_lcd.setDC(my_lcd_dc);
ePtr<gPixmap> m_pm;
- loadPNG(m_pm, DATADIR "/enigma2/pal.png");
+ loadPNG(m_pm, eEnv::resolve("${datadir}/enigma2/skin_default/pal.png").c_str());
if (!m_pm)
{
eFatal("pal.png not found!");
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);
- loadPNG(wait[i], filename);
+ char filename[64];
+ std::string rfilename;
+ snprintf(filename, sizeof(filename), "${datadir}/enigma2/skin_default/spinner/wait%d.png", i + 1);
+ rfilename = eEnv::resolve(filename);
+ loadPNG(wait[i], rfilename.c_str());
if (!wait[i])
{
if (!i)
- eDebug("failed to load %s! (%m)", filename);
+ eDebug("failed to load %s! (%m)", rfilename.c_str());
else
eDebug("found %d spinner!\n", i);
break;
setIoPrio(IOPRIO_CLASS_BE, 3);
- python.execute("mytest", "__main__");
-
+// python.execute("mytest", "__main__");
+ python.execFile(eEnv::resolve("${libdir}/enigma2/python/mytest.py").c_str());
+
+ extern void setFullsize(); // definend in lib/gui/evideo.cpp
+ setFullsize();
+
if (exit_code == 5) /* python crash */
- bsodFatal();
+ {
+ eDebug("(exit code 5)");
+ bsodFatal(0);
+ }
dsk.paint();
dsk_lcd.paint();
gPainter p(my_lcd_dc);
p.resetClip(eRect(0, 0, 132, 64));
p.clear();
- p.flush();
}
return exit_code;
return eApp;
}
+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);
+}
+
+static void sigterm_handler(int num)
+{
+ quitMainloop(128 + num);
+}
+
void runMainloop()
{
+ struct sigaction act;
+
+ act.sa_handler = sigterm_handler;
+ act.sa_flags = SA_RESTART;
+
+ if (sigemptyset(&act.sa_mask) == -1)
+ perror("sigemptyset");
+ if (sigaction(SIGTERM, &act, 0) == -1)
+ perror("SIGTERM");
+
eApp->runLoop();
}
-void quitMainloop(int exitCode)
+const char *getEnigmaVersionString()
{
- exit_code = exitCode;
- eApp->quit(0);
+ std::string date = enigma2_date;
+ std::string branch = enigma2_branch;
+ 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);
}