Merge branch 'ni/tuxbox' into ni/mp/tuxbox

Origin commit data
------------------
Branch: ni/coolstream
Commit: 3ad27fb3c0
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-02-23 (Thu, 23 Feb 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-02-23 15:25:21 +01:00
5 changed files with 24 additions and 86 deletions

View File

@@ -55,11 +55,7 @@ void COSDFader::StartFadeIn()
fadeIn = true; fadeIn = true;
fadeOut = false; fadeOut = false;
fadeValue = 100; fadeValue = 100;
#ifdef BOXMODEL_CS_HD2
frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_UNIFORM_ALPHA); // Global alpha multiplied with pixel alpha
#else
frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha
#endif
frameBuffer->setBlendLevel(fadeValue); frameBuffer->setBlendLevel(fadeValue);
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2))
@@ -79,11 +75,7 @@ bool COSDFader::StartFadeOut()
if ((!fadeOut) && g_settings.widget_fade) { if ((!fadeOut) && g_settings.widget_fade) {
fadeOut = true; fadeOut = true;
fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
#ifdef BOXMODEL_CS_HD2
frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_UNIFORM_ALPHA); // Global alpha multiplied with pixel alpha
#else
frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha
#endif
ret = true; ret = true;
} }
return ret; return ret;
@@ -93,11 +85,7 @@ void COSDFader::StopFade()
{ {
if ( fadeIn || fadeOut ) { if ( fadeIn || fadeOut ) {
g_RCInput->killTimer(fadeTimer); g_RCInput->killTimer(fadeTimer);
#ifdef BOXMODEL_CS_HD2
frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha
#else
frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha
#endif
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2))
usleep(60000); usleep(60000);
#endif #endif
@@ -124,11 +112,7 @@ bool COSDFader::FadeDone()
fadeValue = max_alpha; fadeValue = max_alpha;
g_RCInput->killTimer (fadeTimer); g_RCInput->killTimer (fadeTimer);
fadeIn = false; fadeIn = false;
#ifdef BOXMODEL_CS_HD2
frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha
#else
frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha
#endif
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2)) #if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_CS_HD2))
usleep(60000); usleep(60000);
#endif #endif

View File

@@ -297,7 +297,10 @@ fb_pixel_t * CFbAccelCSHD2::getBackBufferPointer() const
void CFbAccelCSHD2::setBlendMode(uint8_t mode) void CFbAccelCSHD2::setBlendMode(uint8_t mode)
{ {
if (ioctl(fd, FBIO_SETBLENDMODE, mode)) uint8_t arg = CNXTFB_BLEND_MODE_PER_PIXEL;
if (mode == 2)
arg = CNXTFB_BLEND_MODE_UNIFORM_ALPHA;
if (ioctl(fd, FBIO_SETBLENDMODE, arg))
printf("FBIO_SETBLENDMODE failed.\n"); printf("FBIO_SETBLENDMODE failed.\n");
} }

View File

@@ -174,49 +174,9 @@ bool CRCInput::checkdev()
return true; /* need to check anyway... */ return true; /* need to check anyway... */
} }
#ifdef BOXMODEL_CS_HD2
bool CRCInput::checkdev_lnk(std::string lnk)
{
static struct stat info;
if (lstat(lnk.c_str(), &info) != -1) {
if (S_ISLNK(info.st_mode)) {
std::string tmp = readLink(lnk);
if (!tmp.empty()) {
if (lstat(tmp.c_str(), &info) != -1) {
if (S_ISCHR(info.st_mode))
return true;
}
}
}
}
return false;
}
#endif
bool CRCInput::checkpath(in_dev id) bool CRCInput::checkpath(in_dev id)
{ {
for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) { for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) {
#ifdef BOXMODEL_CS_HD2
if ((id.type == DT_LNK) || ((*it).type == DT_LNK)) {
std::string check1, check2;
if (id.type == DT_LNK)
check1 = readLink(id.path);
else
check1 = id.path;
if ((*it).type == DT_LNK)
check2 = readLink((*it).path);
else
check2 = (*it).path;
if ((!check1.empty()) && (!check2.empty()) && (check1 == check2)) {
printf("[rcinput:%s] skipping already opened %s => %s\n", __func__, id.path.c_str(), check1.c_str());
return true;
}
else
return false;
}
#endif
if ((*it).path == id.path) { if ((*it).path == id.path) {
printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str()); printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str());
return true; return true;
@@ -245,23 +205,24 @@ void CRCInput::open(bool recheck)
while ((dentry = readdir(dir)) != NULL) while ((dentry = readdir(dir)) != NULL)
{ {
if ((dentry->d_type != DT_CHR)
#ifdef BOXMODEL_CS_HD2
&& (dentry->d_type != DT_LNK)
#endif
) {
d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name);
continue;
}
#ifdef BOXMODEL_CS_HD2
if ((dentry->d_type == DT_LNK) && (!checkdev_lnk("/dev/input/" + std::string(dentry->d_name)))) {
d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name);
continue;
}
id.type = dentry->d_type;
#endif
d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name);
id.path = "/dev/input/" + std::string(dentry->d_name); id.path = "/dev/input/" + std::string(dentry->d_name);
/* hack: on hd2, the device is called "/dev/cs_ir",
there are links in /dev/input: pointing to it nevis_ir and event0 (WTF???)
so if nevis_ir points to cs_ir, accept it, even though it is a symlink...
a better solution would be to simply mknod /dev/input/nevis_ir c 240 0, creating
a second instance of /dev/cs_ir named /dev/input/nevis_ir (or to fix the driver
to actually create a real event0 device via udev)
Note: i'm deliberately not using event0, because this might be replaced by a "real"
event0 device if e.g. an USB keyboard is plugged in*/
if (dentry->d_type == DT_LNK &&
id.path == "/dev/input/nevis_ir") {
if (readLink(id.path) != "/dev/cs_ir")
continue;
} else if (dentry->d_type != DT_CHR) {
d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name);
continue;
}
d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name);
if (checkpath(id)) if (checkpath(id))
continue; continue;
id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC);
@@ -1815,11 +1776,7 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address)
} }
int fd = -1; int fd = -1;
for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) { for (std::vector<in_dev>::iterator it = indev.begin(); it != indev.end(); ++it) {
if (((*it).path == "/dev/input/nevis_ir") if ((*it).path == "/dev/input/nevis_ir") {
#ifdef BOXMODEL_CS_HD2
|| ((*it).path == "/dev/input/input0")
#endif
){
fd = (*it).fd; fd = (*it).fd;
break; break;
} }

View File

@@ -145,9 +145,6 @@ class CRCInput
{ {
int fd; int fd;
std::string path; std::string path;
#ifdef BOXMODEL_CS_HD2
int type;
#endif
}; };
uint32_t timerid; uint32_t timerid;
@@ -170,9 +167,6 @@ class CRCInput
void open(bool recheck = false); void open(bool recheck = false);
bool checkpath(in_dev id); bool checkpath(in_dev id);
bool checkdev(); bool checkdev();
#ifdef BOXMODEL_CS_HD2
bool checkdev_lnk(std::string lnk);
#endif
void close(); void close();
int translate(int code); int translate(int code);
void calculateMaxFd(void); void calculateMaxFd(void);

View File

@@ -305,7 +305,7 @@ int CKeybindSetup::showKeySetup()
#endif #endif
cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCK, cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCK,
&g_settings.repeat_blocker, true, 0, 999, NULL, &g_settings.repeat_blocker, true, 0, 999, this,
CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF); CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF);
cc->setNumberFormat(ms_number_format); cc->setNumberFormat(ms_number_format);
cc->setNumericInput(true); cc->setNumericInput(true);
@@ -313,7 +313,7 @@ int CKeybindSetup::showKeySetup()
keySettings->addItem(cc); keySettings->addItem(cc);
cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC, cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCKGENERIC,
&g_settings.repeat_genericblocker, true, 0, 999, NULL, &g_settings.repeat_genericblocker, true, 0, 999, this,
CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF); CRCInput::convertDigitToKey(shortcut++), NULL, 0, 0, LOCALE_OPTIONS_OFF);
cc->setNumberFormat(ms_number_format); cc->setNumberFormat(ms_number_format);
cc->setNumericInput(true); cc->setNumericInput(true);