mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
Merge remote-tracking branch 'neutrino-mp/master' into pu/mp
Conflicts:
src/neutrino.cpp
src/nhttpd/tuxboxapi/neutrinoyparser.cpp
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8bdb16cec6
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-13 (Mon, 13 Mar 2017)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -42,3 +42,4 @@ libneutrino_system_a_SOURCES = \
|
||||
ytcache.cpp \
|
||||
ytparser.cpp \
|
||||
setting_helpers.cpp
|
||||
# safe_system.c
|
||||
|
@@ -2,6 +2,7 @@
|
||||
* $port: configure_network.cpp,v 1.7 2009/11/20 22:44:19 tuxbox-cvs Exp $
|
||||
*
|
||||
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
|
||||
* (C) 2011 Stefan Seyfried
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -14,9 +15,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <cstdio> /* perror... */
|
||||
|
@@ -44,6 +44,11 @@
|
||||
#include <neutrino.h>
|
||||
#include <driver/display.h>
|
||||
|
||||
#if HAVE_TRIPLEDRAGON
|
||||
/* TD kernel 2.6.12 is too old and does not have writesize yet, use oobsize instead */
|
||||
#define writesize oobsize
|
||||
#endif
|
||||
|
||||
CFlashTool::CFlashTool()
|
||||
{
|
||||
statusViewer = NULL;
|
||||
|
@@ -31,11 +31,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <pty.h> /* forkpty*/
|
||||
#include <sys/ioctl.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/vfs.h> /* or <sys/statfs.h> */
|
||||
#include <sys/time.h> /* gettimeofday */
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
@@ -303,7 +305,7 @@ int check_dir(const char * dir, bool allow_tmp)
|
||||
ret = 0; // ok
|
||||
}
|
||||
if(ret == -1)
|
||||
printf("Wrong Filessystem Type: 0x%" PRIx32"\n",s.f_type);
|
||||
printf("Wrong Filessystem Type: 0x%llx\n", (unsigned long long)s.f_type);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -555,7 +557,6 @@ std::string& htmlEntityDecode(std::string& text)
|
||||
CFileHelpers::CFileHelpers()
|
||||
{
|
||||
FileBufMaxSize = 0xFFFF;
|
||||
doCopyFlag = true;
|
||||
ConsoleQuiet = false;
|
||||
clearDebugInfo();
|
||||
}
|
||||
@@ -741,8 +742,6 @@ bool CFileHelpers::cp(const char *Src, const char *Dst, const char *Flags/*=""*/
|
||||
|
||||
bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t forceMode/*=0*/)
|
||||
{
|
||||
doCopyFlag = true;
|
||||
|
||||
/*
|
||||
set mode for Dst
|
||||
----------------
|
||||
@@ -778,69 +777,28 @@ bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t forceMode/*
|
||||
uint32_t block;
|
||||
off64_t fsizeSrc64 = lseek64(fd1, 0, SEEK_END);
|
||||
lseek64(fd1, 0, SEEK_SET);
|
||||
if (fsizeSrc64 > 0x7FFFFFF0) { // > 2GB
|
||||
uint32_t FileBufSize = FileBufMaxSize;
|
||||
FileBuf = initFileBuf(FileBuf, FileBufSize);
|
||||
off64_t fsize64 = fsizeSrc64;
|
||||
block = FileBufSize;
|
||||
//printf("#####[%s] fsizeSrc64: %lld 0x%010llX - large file\n", __FUNCTION__, fsizeSrc64, fsizeSrc64);
|
||||
while(fsize64 > 0) {
|
||||
if(fsize64 < (off64_t)FileBufSize)
|
||||
block = (uint32_t)fsize64;
|
||||
read(fd1, FileBuf, block);
|
||||
write(fd2, FileBuf, block);
|
||||
fsize64 -= block;
|
||||
if (!doCopyFlag)
|
||||
break;
|
||||
}
|
||||
if (doCopyFlag) {
|
||||
lseek64(fd2, 0, SEEK_SET);
|
||||
off64_t fsizeDst64 = lseek64(fd2, 0, SEEK_END);
|
||||
if (fsizeSrc64 != fsizeDst64){
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
FileBuf = deleteFileBuf(FileBuf);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
off64_t fsize64 = fsizeSrc64;
|
||||
uint32_t FileBufSize = (fsizeSrc64 < (off_t)FileBufMaxSize) ? (uint32_t)fsizeSrc64 : FileBufMaxSize;
|
||||
FileBuf = initFileBuf(FileBuf, FileBufSize);
|
||||
block = FileBufSize;
|
||||
//printf("#####[%s] fsizeSrc64: %lld 0x%010llX - large file\n", __func__, fsizeSrc64, fsizeSrc64);
|
||||
while (fsize64 > 0) {
|
||||
if (fsize64 < (off64_t)FileBufSize)
|
||||
block = (uint32_t)fsize64;
|
||||
read(fd1, FileBuf, block); /* FIXME: short read??? */
|
||||
write(fd2, FileBuf, block); /* FIXME: short write?? */
|
||||
fsize64 -= block;
|
||||
}
|
||||
else { // < 2GB
|
||||
off_t fsizeSrc = lseek(fd1, 0, SEEK_END);
|
||||
uint32_t FileBufSize = (fsizeSrc < (off_t)FileBufMaxSize) ? fsizeSrc : FileBufMaxSize;
|
||||
FileBuf = initFileBuf(FileBuf, FileBufSize);
|
||||
lseek(fd1, 0, SEEK_SET);
|
||||
off_t fsize = fsizeSrc;
|
||||
block = FileBufSize;
|
||||
//printf("#####[%s] fsizeSrc: %ld 0x%08lX - normal file\n", __FUNCTION__, fsizeSrc, fsizeSrc);
|
||||
while(fsize > 0) {
|
||||
if(fsize < (off_t)FileBufSize)
|
||||
block = (uint32_t)fsize;
|
||||
read(fd1, FileBuf, block);
|
||||
write(fd2, FileBuf, block);
|
||||
fsize -= block;
|
||||
if (!doCopyFlag)
|
||||
break;
|
||||
}
|
||||
if (doCopyFlag) {
|
||||
lseek(fd2, 0, SEEK_SET);
|
||||
off_t fsizeDst = lseek(fd2, 0, SEEK_END);
|
||||
if (fsizeSrc != fsizeDst){
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
FileBuf = deleteFileBuf(FileBuf);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
|
||||
if (!doCopyFlag) {
|
||||
sync();
|
||||
unlink(Dst);
|
||||
lseek64(fd2, 0, SEEK_SET);
|
||||
off64_t fsizeDst64 = lseek64(fd2, 0, SEEK_END);
|
||||
if (fsizeSrc64 != fsizeDst64) {
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
FileBuf = deleteFileBuf(FileBuf);
|
||||
return false;
|
||||
}
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
|
||||
FileBuf = deleteFileBuf(FileBuf);
|
||||
return true;
|
||||
@@ -908,8 +866,11 @@ bool CFileHelpers::copyDir(const char *Src, const char *Dst, bool backupMode)
|
||||
// is file
|
||||
else if (S_ISREG(FileInfo.st_mode)) {
|
||||
std::string save = "";
|
||||
(void)backupMode; /* squelch unused parameter warning */
|
||||
#if ENABLE_EXTUPDATE
|
||||
if (backupMode && (CExtUpdate::getInstance()->isBlacklistEntry(srcPath)))
|
||||
save = ".save";
|
||||
#endif
|
||||
copyFile(srcPath, (dstPath + save).c_str()); /* mode is set by copyFile */
|
||||
}
|
||||
}
|
||||
|
@@ -99,7 +99,6 @@ class CFileHelpers
|
||||
CFileHelpers();
|
||||
~CFileHelpers();
|
||||
static CFileHelpers* getInstance();
|
||||
bool doCopyFlag;
|
||||
|
||||
void clearDebugInfo();
|
||||
void readDebugInfo(helpersDebugInfo* di);
|
||||
|
26
src/system/safe_system.c
Normal file
26
src/system/safe_system.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* (C) 2011 Stefan Seyfried <seife@tuxboxcvs.slipkontur.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
int safe_system(const char *command)
|
||||
{
|
||||
int fd;
|
||||
/* hm, what if we have more than 256 FDs open? */
|
||||
for (fd = 3; fd < 256; fd++)
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
return system(command);
|
||||
}
|
11
src/system/safe_system.h
Normal file
11
src/system/safe_system.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _SAFE_SYSTEM_H_
|
||||
#define _SAFE_SYSTEM_H_
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
extern int safe_system(const char *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@@ -7,7 +7,7 @@
|
||||
inline void set_threadname(const char *name)
|
||||
{
|
||||
char threadname[17];
|
||||
strncpy(threadname, name, sizeof(threadname));
|
||||
strncpy(threadname, name, 16);
|
||||
threadname[16] = 0;
|
||||
prctl (PR_SET_NAME, (unsigned long)threadname);
|
||||
}
|
||||
|
@@ -492,9 +492,18 @@ bool CTZChangeNotifier::changeNotify(const neutrino_locale_t, void * Data)
|
||||
}
|
||||
if(found) {
|
||||
printf("Timezone: %s -> %s\n", name.c_str(), zone.c_str());
|
||||
std::string cmd = "cp /usr/share/zoneinfo/" + zone + " /etc/localtime";
|
||||
printf("exec %s\n", cmd.c_str());
|
||||
my_system(3,"/bin/sh", "-c", cmd.c_str());
|
||||
std::string cmd = "/usr/share/zoneinfo/" + zone;
|
||||
printf("symlink %s to /etc/localtime\n", cmd.c_str());
|
||||
if (unlink("/etc/localtime"))
|
||||
perror("unlink failed");
|
||||
if (symlink(cmd.c_str(), "/etc/localtime"))
|
||||
perror("symlink failed");
|
||||
/* for yocto tzdata compatibility */
|
||||
FILE *f = fopen("/etc/timezone", "w");
|
||||
if (f) {
|
||||
fprintf(f, "%s\n", zone.c_str());
|
||||
fclose(f);
|
||||
}
|
||||
#if 0
|
||||
cmd = ":" + zone;
|
||||
setenv("TZ", cmd.c_str(), 1);
|
||||
@@ -563,6 +572,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if HAVE_COOL_HARDWARE
|
||||
void CFanControlNotifier::setSpeed(unsigned int speed)
|
||||
{
|
||||
printf("FAN Speed %d\n", speed);
|
||||
@@ -585,6 +595,16 @@ bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data)
|
||||
setSpeed(speed);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
void CFanControlNotifier::setSpeed(unsigned int)
|
||||
{
|
||||
}
|
||||
|
||||
bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CCpuFreqNotifier::changeNotify(const neutrino_locale_t, void * data)
|
||||
{
|
||||
@@ -604,14 +624,23 @@ bool CAutoModeNotifier::changeNotify(const neutrino_locale_t /*OptionName*/, voi
|
||||
int i;
|
||||
int modes[VIDEO_STD_MAX+1];
|
||||
|
||||
memset(modes, 0, sizeof(int)*VIDEO_STD_MAX+1);
|
||||
memset(modes, 0, sizeof(modes));
|
||||
|
||||
for(i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++)
|
||||
for(i = 0; i < VIDEOMENU_VIDEOMODE_OPTION_COUNT; i++) {
|
||||
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key < 0) /* not available on this platform */
|
||||
continue;
|
||||
if (VIDEOMENU_VIDEOMODE_OPTIONS[i].key >= VIDEO_STD_MAX) {
|
||||
/* this must not happen */
|
||||
printf("CAutoModeNotifier::changeNotify VIDEOMODE_OPTIONS[%d].key = %d (>= %d)\n",
|
||||
i, VIDEOMENU_VIDEOMODE_OPTIONS[i].key, VIDEO_STD_MAX);
|
||||
continue;
|
||||
}
|
||||
#ifdef BOXMODEL_CS_HD2
|
||||
modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_auto_modes[i];
|
||||
#else
|
||||
modes[VIDEOMENU_VIDEOMODE_OPTIONS[i].key] = g_settings.enabled_video_modes[i];
|
||||
#endif
|
||||
}
|
||||
videoDecoder->SetAutoModes(modes);
|
||||
return false;
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ class CGenericMenuActivate
|
||||
void Clear() { items.clear(); }
|
||||
void Activate(bool enable)
|
||||
{
|
||||
for(std::vector<CMenuItem*>::iterator it = items.begin(); it != items.end(); it++)
|
||||
for(std::vector<CMenuItem*>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
(*it)->setActive(enable);
|
||||
}
|
||||
};
|
||||
|
@@ -40,9 +40,9 @@ const struct personalize_settings_t personalize_settings[SNeutrinoSettings::P_SE
|
||||
{"personalize_redbutton" , CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED}, // epg/info
|
||||
|
||||
//main menu
|
||||
{"personalize_tv_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_tv_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE}, //toggle
|
||||
{"personalize_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_tv_mode" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE},
|
||||
{"personalize_tv_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE}, //toggle
|
||||
{"personalize_radio_mode" , CPersonalizeGui::PERSONALIZE_MODE_NOTVISIBLE},
|
||||
{"personalize_timer" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
{"personalize_media" , CPersonalizeGui::PERSONALIZE_MODE_VISIBLE},
|
||||
|
||||
|
@@ -4,6 +4,8 @@
|
||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||
Homepage: http://dbox.cyberphoria.org/
|
||||
|
||||
Copyright (C) 2007-2012 Stefan Seyfried
|
||||
|
||||
Kommentar:
|
||||
|
||||
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
|
||||
@@ -47,7 +49,7 @@
|
||||
#ifdef BOXMODEL_CS_HD2
|
||||
#define VIDEOMENU_VIDEOMODE_OPTION_COUNT 16
|
||||
#else
|
||||
#define VIDEOMENU_VIDEOMODE_OPTION_COUNT 12
|
||||
#define VIDEOMENU_VIDEOMODE_OPTION_COUNT 13
|
||||
#endif
|
||||
|
||||
struct SNeutrinoTheme
|
||||
@@ -704,7 +706,7 @@ struct SNeutrinoSettings
|
||||
LCD_SHOW_VOLUME ,
|
||||
LCD_AUTODIMM ,
|
||||
LCD_DEEPSTANDBY_BRIGHTNESS,
|
||||
#if HAVE_TRIPLEDRAGON
|
||||
#if HAVE_TRIPLEDRAGON || USE_STB_HAL
|
||||
LCD_EPGMODE ,
|
||||
#endif
|
||||
LCD_SETTING_COUNT
|
||||
@@ -873,7 +875,7 @@ typedef struct time_settings_t
|
||||
|
||||
const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_COUNT] =
|
||||
{
|
||||
{ 0, LOCALE_TIMING_MENU, LOCALE_MENU_HINT_OSD_TIMING},//TODO: add hint locales
|
||||
{ 240, LOCALE_TIMING_MENU, LOCALE_MENU_HINT_OSD_TIMING},//TODO: add hint locales
|
||||
{ 60, LOCALE_TIMING_CHANLIST, LOCALE_MENU_HINT_OSD_TIMING},
|
||||
{ 240, LOCALE_TIMING_EPG, LOCALE_MENU_HINT_OSD_TIMING},
|
||||
{ 6, LOCALE_TIMING_INFOBAR, LOCALE_MENU_HINT_OSD_TIMING},
|
||||
@@ -926,7 +928,6 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO
|
||||
struct SglobalInfo
|
||||
{
|
||||
unsigned char box_Type;
|
||||
delivery_system_t delivery_system;
|
||||
bool has_fan;
|
||||
hw_caps_t *hw_caps;
|
||||
};
|
||||
|
Reference in New Issue
Block a user