Skip to content

Commit

Permalink
Merge branch 'osd'
Browse files Browse the repository at this point in the history
  • Loading branch information
betacentauri committed Feb 25, 2012
2 parents e220aa3 + 5e93025 commit fe3c83e
Show file tree
Hide file tree
Showing 21 changed files with 746 additions and 124 deletions.
11 changes: 7 additions & 4 deletions enigma2/lib/driver/misc_options.cpp
Expand Up @@ -8,6 +8,7 @@
#include <lib/base/init.h>
#include <lib/base/init_num.h>
#include <lib/base/eerror.h>
#include <lib/base/eenv.h>

Misc_Options *Misc_Options::instance = 0;

Expand All @@ -22,10 +23,11 @@ int Misc_Options::set_12V_output(int state)
{
if (state == m_12V_output_state)
return 0;
int fd = open("/usr/local/e2/etc/stb/misc/12V_output", O_WRONLY);
int fd = open(eEnv::resolve("${sysconfdir}/stb/misc/12V_output").c_str(), O_WRONLY);
if (fd < 0)
{
eDebug("couldn't open /usr/local/e2/etc/stb/misc/12V_output");
std::string err= "couldn't open " + eEnv::resolve("${sysconfdir}/stb/misc/12V_output");
eDebug(err.c_str());
return -1;
}
const char *str=0;
Expand All @@ -42,10 +44,11 @@ int Misc_Options::set_12V_output(int state)

bool Misc_Options::detected_12V_output()
{
int fd = open("/usr/local/e2/etc/stb/misc/12V_output", O_WRONLY);
int fd = open(eEnv::resolve("${sysconfdir}/stb/misc/12V_output").c_str(), O_WRONLY);
if (fd < 0)
{
eDebug("couldn't open /usr/local/e2/etc/stb/misc/12V_output");
std::string err= "couldn't open " + eEnv::resolve("${sysconfdir}/stb/misc/12V_output");
eDebug(err.c_str());
return false;
}
close(fd);
Expand Down
5 changes: 3 additions & 2 deletions enigma2/lib/dvb/decoder.cpp
@@ -1,5 +1,6 @@
#include <lib/base/ebase.h>
#include <lib/base/eerror.h>
#include <lib/base/eenv.h>
#include <lib/dvb/decoder.h>
#include <lib/gdi/xineLib.h>

Expand Down Expand Up @@ -434,7 +435,7 @@ RESULT eTSMPEGDecoder::setHwPCMDelay(int delay)
{
if (delay != m_pcm_delay )
{
FILE *fp = fopen("/usr/local/e2/etc/stb/audio/audio_delay_pcm", "w");
FILE *fp = fopen(eEnv::resolve("${sysconfdir}/stb/audio/audio_delay_pcm").c_str(), "w");
if (fp)
{
fprintf(fp, "%x", delay*90);
Expand All @@ -450,7 +451,7 @@ RESULT eTSMPEGDecoder::setHwAC3Delay(int delay)
{
if ( delay != m_ac3_delay )
{
FILE *fp = fopen("/usr/local/e2/etc/stb/audio/audio_delay_bitstream", "w");
FILE *fp = fopen(eEnv::resolve("${sysconfdir}/stb/audio/audio_delay_bitstream").c_str(), "w");
if (fp)
{
fprintf(fp, "%x", delay*90);
Expand Down
6 changes: 4 additions & 2 deletions enigma2/lib/dvb/dvb.cpp
@@ -1,5 +1,6 @@
#include <lib/base/eerror.h>
#include <lib/base/filepush.h>
#include <lib/base/eenv.h>
#include <lib/dvb/cahandler.h>
#include <lib/dvb/idvb.h>
#include <lib/dvb/dvb.h>
Expand Down Expand Up @@ -82,7 +83,7 @@ eDVBResourceManager::eDVBResourceManager()
num_adapter++;
}

int fd = open("/usr/local/e2/etc/stb/info/model", O_RDONLY);
int fd = open(eEnv::resolve("${sysconfdir}/stb/info/model").c_str(), O_RDONLY);
char tmp[16];
int rd = fd >= 0 ? read(fd, tmp, sizeof(tmp)) : 0;
if (fd >= 0)
Expand All @@ -101,7 +102,8 @@ eDVBResourceManager::eDVBResourceManager()
else if (!strncmp(tmp, "dm7020hd\n", rd))
m_boxtype = DM7020HD;
else {
eDebug("boxtype detection via /usr/local/e2/etc/stb/info not possible... use fallback via demux count!\n");
std::string info= "boxtype detection via " + eEnv::resolve("${sysconfdir}/stb/info") + " not possible... use fallback via demux count!\n";
eDebug(info.c_str());
if (m_demux.size() == 3)
m_boxtype = DM800;
else if (m_demux.size() < 5)
Expand Down
15 changes: 11 additions & 4 deletions enigma2/lib/dvb/dvbtime.cpp
@@ -1,5 +1,6 @@
#include <lib/dvb/dvbtime.h>
#include <lib/dvb/dvb.h>
#include <lib/base/eenv.h>

#include <sys/ioctl.h>
#include <stdio.h>
Expand All @@ -17,13 +18,16 @@ static time_t prev_time;

void setRTC(time_t time)
{
FILE *f = fopen("/usr/local/e2/etc/stb/fp/rtc", "w");
FILE *f = fopen(eEnv::resolve("${sysconfdir}/stb/fp/rtc").c_str(), "w");
if (f)
{
if (fprintf(f, "%u", (unsigned int)time))
prev_time = time;
else
eDebug("write /usr/local/e2/etc/stb/fp/rtc failed (%m)");
{
std::string err= "write " + eEnv::resolve("${sysconfdir}/stb/fp/rtc") + "failed (%m)";
eDebug(err.c_str());
}
fclose(f);
}
else
Expand All @@ -43,13 +47,16 @@ void setRTC(time_t time)
time_t getRTC()
{
time_t rtc_time=0;
FILE *f = fopen("/usr/local/e2/etc/stb/fp/rtc", "r");
FILE *f = fopen(eEnv::resolve("${sysconfdir}/stb/fp/rtc").c_str(), "r");
if (f)
{
// sanity check to detect corrupt atmel firmware
unsigned int tmp;
if (fscanf(f, "%u", &tmp) != 1)
eDebug("read /usr/local/e2/etc/stb/fp/rtc failed (%m)");
{
std::string err= "read " + eEnv::resolve("${sysconfdir}/stb/fp/rtc") + " failed (%m)";
eDebug(err.c_str());
}
else
rtc_time=tmp;
fclose(f);
Expand Down
7 changes: 4 additions & 3 deletions enigma2/lib/dvb/frontend.cpp
Expand Up @@ -2,6 +2,7 @@
#include <lib/dvb/frontendparms.h>
#include <lib/base/eerror.h>
#include <lib/base/nconfig.h> // access to python config
#include <lib/base/eenv.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
Expand Down Expand Up @@ -1485,8 +1486,8 @@ int eDVBFrontend::readInputpower()
int power=m_slotid; // this is needed for read inputpower from the correct tuner !
char proc_name[64];
char proc_name2[64];
sprintf(proc_name, "/usr/local/e2/etc/stb/frontend/%d/lnb_sense", m_slotid);
sprintf(proc_name2, "/usr/local/e2/etc/stb/fp/lnb_sense%d", m_slotid);
sprintf(proc_name, eEnv::resolve("${sysconfdir}/stb/frontend/%d/lnb_sense").c_str(), m_slotid);
sprintf(proc_name2, eEnv::resolve("${sysconfdir}/stb/fp/lnb_sense%d").c_str(), m_slotid);
FILE *f;
if ((f=fopen(proc_name, "r")) || (f=fopen(proc_name2, "r")))
{
Expand Down Expand Up @@ -1855,7 +1856,7 @@ int eDVBFrontend::tuneLoopInt() // called by m_tuneTimer
if (!m_simulate)
{
char proc_name[64];
sprintf(proc_name, "/usr/local/e2/etc/stb/frontend/%d/static_current_limiting", sec_fe->m_dvbid);
sprintf(proc_name, eEnv::resolve("${sysconfdir}/stb/frontend/%d/static_current_limiting").c_str(), sec_fe->m_dvbid);
FILE *f=fopen(proc_name, "w");
if (f) // new interface exist?
{
Expand Down
15 changes: 8 additions & 7 deletions enigma2/lib/dvb_ci/dvbci.cpp
Expand Up @@ -4,7 +4,7 @@
#include <lib/base/init.h>
#include <lib/base/init_num.h>
#include <lib/base/ebase.h>

#include <lib/base/eenv.h>
#include <lib/base/eerror.h>
#include <lib/base/nconfig.h> // access to python config
#include <lib/dvb/db.h>
Expand Down Expand Up @@ -653,7 +653,7 @@ int eDVBCIInterfaces::setInputSource(int tuner_no, data_source source)
if (getNumOfSlots() > 1) // FIXME .. we force DM8000 when more than one CI Slot is avail
{
char buf[64];
snprintf(buf, 64, "/usr/local/e2/etc/stb/tsmux/input%d", tuner_no);
snprintf(buf, 64, eEnv::resolve("${sysconfdir}/stb/tsmux/input%d").c_str(), tuner_no);

FILE *input=0;
if((input = fopen(buf, "wb")) == NULL) {
Expand Down Expand Up @@ -700,7 +700,7 @@ int eDVBCIInterfaces::setInputSource(int tuner_no, data_source source)
else // DM7025
{
char buf[64];
snprintf(buf, 64, "/usr/local/e2/etc/stb/tsmux/input%d", tuner_no);
snprintf(buf, 64, eEnv::resolve("${sysconfdir}/stb/tsmux/input%d").c_str(), tuner_no);

if (tuner_no > 1)
eDebug("setInputSource(%d, %d) failed... dm7025 just have two inputs", tuner_no, (int)source);
Expand Down Expand Up @@ -1277,7 +1277,7 @@ int eDVBCISlot::setSource(data_source source)
if (eDVBCIInterfaces::getInstance()->getNumOfSlots() > 1) // FIXME .. we force DM8000 when more than one CI Slot is avail
{
char buf[64];
snprintf(buf, 64, "/usr/local/e2/etc/stb/tsmux/ci%d_input", slotid);
snprintf(buf, 64, eEnv::resolve("${sysconfdir}/stb/tsmux/ci%d_input").c_str(), slotid);
FILE *ci = fopen(buf, "wb");
switch(source)
{
Expand Down Expand Up @@ -1315,9 +1315,10 @@ int eDVBCISlot::setSource(data_source source)
{
// eDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
// eDebug("eDVBCISlot::enableTS(%d %d)", enable, (int)source);
FILE *ci = fopen("/usr/local/e2/etc/stb/tsmux/input2", "wb");
FILE *ci = fopen(eEnv::resolve("${sysconfdir}/stb/tsmux/input2").c_str(), "wb");
if(ci == NULL) {
eDebug("cannot open /usr/local/e2/etc/stb/tsmux/input2");
std::string err= "cannot open " + eEnv::resolve("${sysconfdir}/stb/tsmux/input2");
eDebug(err.c_str());
return 0;
}
if (source != TUNER_A && source != TUNER_B)
Expand All @@ -1333,7 +1334,7 @@ int eDVBCISlot::setSource(data_source source)
int eDVBCISlot::setClockRate(int rate)
{
char buf[64];
snprintf(buf, 64, "/usr/local/e2/etc/stb/tsmux/ci%d_tsclk", slotid);
snprintf(buf, 64, eEnv::resolve("${sysconfdir}/stb/tsmux/ci%d_tsclk").c_str(), slotid);
FILE *ci = fopen(buf, "wb");
if (ci)
{
Expand Down
25 changes: 21 additions & 4 deletions enigma2/lib/gdi/gxlibdc.cpp
Expand Up @@ -49,6 +49,12 @@ static bool getConfigBool(const std::string &key, bool defaultValue)
return defaultValue;
}

static int getConfigInt(const std::string &key)
{
std::string value = getConfigString(key, "0");
return atoi(value.c_str());
}

gXlibDC::gXlibDC() : m_pump(eApp, 1)
{
double res_h, res_v;
Expand All @@ -60,6 +66,8 @@ gXlibDC::gXlibDC() : m_pump(eApp, 1)

argb_buffer = NULL;
fullscreen = getConfigBool("config.pc.default_fullscreen", false);
initialWindowWidth = getConfigInt("config.pc.initial_window_width");
initialWindowHeight = getConfigInt("config.pc.initial_window_height");
windowWidth = 720;
windowHeight = 576;
xpos = 0;
Expand Down Expand Up @@ -90,7 +98,10 @@ gXlibDC::gXlibDC() : m_pump(eApp, 1)
}

XLockDisplay(display);
window = XCreateSimpleWindow(display, XDefaultRootWindow(display), xpos, ypos, windowWidth, windowHeight, 0, 0, 0);
if (initialWindowWidth && initialWindowHeight)
window = XCreateSimpleWindow(display, XDefaultRootWindow(display), xpos, ypos, initialWindowWidth, initialWindowHeight, 0, 0, 0);
else
window = XCreateSimpleWindow(display, XDefaultRootWindow(display), xpos, ypos, windowWidth, windowHeight, 0, 0, 0);
XSelectInput (display, window, INPUT_MOTION);
XMapRaised(display, window);
res_h = (DisplayWidth(display, screen) * 1000 / DisplayWidthMM(display, screen));
Expand Down Expand Up @@ -239,16 +250,22 @@ void gXlibDC::setResolution(int xres, int yres)
m_surface.offset = 0;

m_pixmap = new gPixmap(&m_surface);

XResizeWindow(display, window, windowWidth, windowHeight);

if (initialWindowWidth == 0 || initialWindowHeight == 0)
XResizeWindow(display, window, windowWidth, windowHeight);
updateWindowState();
}

void gXlibDC::updateWindowState() {
if (fullscreen) {
width = DisplayWidth( display, screen );
height = DisplayHeight( display, screen );
} else {
} else if (initialWindowWidth && initialWindowHeight)
{
width = initialWindowWidth;
height = initialWindowHeight;
} else
{
width = windowWidth;
height = windowHeight;
}
Expand Down
1 change: 1 addition & 0 deletions enigma2/lib/gdi/gxlibdc.h
Expand Up @@ -29,6 +29,7 @@ class gXlibDC: public gMainDC, public eThread, public Object
x11_visual_t vis;
int fullscreen;
int windowWidth, windowHeight;
int initialWindowWidth, initialWindowHeight;
cXineLib *xineLib;
gSurface m_surface;
uint32_t *argb_buffer;
Expand Down
19 changes: 11 additions & 8 deletions enigma2/lib/gdi/lcd.cpp
Expand Up @@ -75,8 +75,8 @@ eDBoxLCD::eDBoxLCD()
lcdfd = open("/dev/dbox/oled0", O_RDWR);
if (lcdfd < 0)
{
if (!access("/usr/local/e2/etc/stb/lcd/oled_brightness", W_OK) ||
!access("/usr/local/e2/etc/stb/fp/oled_brightness", W_OK) )
if (!access(eEnv::resolve("${sysconfdir}/stb/lcd/oled_brightness").c_str(), W_OK) ||
!access(eEnv::resolve("${sysconfdir}/stb/fp/oled_brightness").c_str(), W_OK) )
is_oled = 2;
lcdfd = open("/dev/dbox/lcd0", O_RDWR);
} else
Expand All @@ -92,20 +92,20 @@ eDBoxLCD::eDBoxLCD()
int i=LCD_MODE_BIN;
ioctl(lcdfd, LCD_IOCTL_ASC_MODE, &i);
inverted=0;
FILE *f = fopen("/usr/local/e2/etc/stb/lcd/xres", "r");
FILE *f = fopen(eEnv::resolve("${sysconfdir}/stb/lcd/xres").c_str(), "r");
if (f)
{
int tmp;
if (fscanf(f, "%x", &tmp) == 1)
xres = tmp;
fclose(f);
f = fopen("/usr/local/e2/etc/stb/lcd/yres", "r");
f = fopen(eEnv::resolve("${sysconfdir}/stb/lcd/yres").c_str(), "r");
if (f)
{
if (fscanf(f, "%x", &tmp) == 1)
yres = tmp;
fclose(f);
f = fopen("/usr/local/e2/etc/stb/lcd/bpp", "r");
f = fopen(eEnv::resolve("${sysconfdir}/stb/lcd/bpp").c_str(), "r");
if (f)
{
if (fscanf(f, "%x", &tmp) == 1)
Expand Down Expand Up @@ -151,13 +151,16 @@ int eDBoxLCD::setLCDBrightness(int brightness)
{
#ifndef NO_LCD
eDebug("setLCDBrightness %d", brightness);
FILE *f=fopen("/usr/local/e2/etc/stb/lcd/oled_brightness", "w");
FILE *f=fopen(eEnv::resolve("${sysconfdir}/stb/lcd/oled_brightness").c_str(), "w");
if (!f)
f = fopen("/usr/local/e2/etc/stb/fp/oled_brightness", "w");
f = fopen(eEnv::resolve("${sysconfdir}/stb/fp/oled_brightness").c_str(), "w");
if (f)
{
if (fprintf(f, "%d", brightness) == 0)
eDebug("write /usr/local/e2/etc/stb/lcd/oled_brightness failed!! (%m)");
{
std::string err= "write " + eEnv::resolve("${sysconfdir}/stb/lcd/oled_brightness") + " failed!! (%m)";
eDebug(err.c_str());
}
fclose(f);
}
else
Expand Down

0 comments on commit fe3c83e

Please sign in to comment.