Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
[CST] Focus
2012-10-03 11:03:41 +04:00
8 changed files with 82 additions and 60 deletions

View File

@@ -231,8 +231,8 @@ bool CRecordInstance::Stop(bool remove_event)
CCamManager::getInstance()->Stop(channel_id, CCamManager::RECORD); CCamManager::getInstance()->Stop(channel_id, CCamManager::RECORD);
if((autoshift && g_settings.auto_delete) /* || autoshift_delete*/) { if((autoshift && g_settings.auto_delete) /* || autoshift_delete*/) {
snprintf(buf,sizeof(buf), "nice -n 20 rm -f \"%s.ts\" &", filename); snprintf(buf,sizeof(buf), "\"%s.ts\"", filename);
system(buf); my_system("nice", "-n20", "rm", "-f", buf);
snprintf(buf,sizeof(buf), "%s.xml", filename); snprintf(buf,sizeof(buf), "%s.xml", filename);
//autoshift_delete = false; //autoshift_delete = false;
unlink(buf); unlink(buf);

View File

@@ -269,21 +269,34 @@ int CHDDMenuHandler::doMenu ()
int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
{ {
char cmd[100]; char M_opt[50],S_opt[50];
char opt[100];
struct dirent **namelist; struct dirent **namelist;
int n = scandir("/sys/block", &namelist, my_filter, alphasort); int n = scandir("/sys/block", &namelist, my_filter, alphasort);
if (n < 0) if (n < 0)
return 0; return 0;
const char hdparm[] = "/sbin/hdparm";
bool hdparm_link = false;
struct stat stat_buf;
if(::lstat(hdparm, &stat_buf) == 0)
if( S_ISLNK(stat_buf.st_mode) )
hdparm_link = true;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
printf("CHDDDestExec: noise %d sleep %d /dev/%s\n", printf("CHDDDestExec: noise %d sleep %d /dev/%s\n",
g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name); g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name);
//hdparm -M is not included in busybox hdparm! snprintf(S_opt, sizeof(S_opt),"-S%d", g_settings.hdd_sleep);
//we need full version of hdparm or should remove -M parameter here snprintf(opt, sizeof(opt),"/dev/%s",namelist[i]->d_name);
snprintf(cmd, sizeof(cmd), "hdparm -M%d -S%d /dev/%s >/dev/null 2>/dev/null &",
g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name); if(hdparm_link){
system(cmd); //hdparm -M is not included in busybox hdparm!
my_system(hdparm, S_opt, opt);
}else{
snprintf(M_opt, sizeof(M_opt),"-M%d", g_settings.hdd_noise);
my_system(hdparm, M_opt, S_opt, opt);
}
free(namelist[i]); free(namelist[i]);
} }
free(namelist); free(namelist);
@@ -327,7 +340,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
if(res != CMessageBox::mbrYes) if(res != CMessageBox::mbrYes)
return 0; return 0;
bool srun = system("killall -9 smbd"); bool srun = my_system("killall", "-9", "smbd");
//res = check_and_umount(dst); //res = check_and_umount(dst);
res = check_and_umount(src, dst); res = check_and_umount(src, dst);
@@ -462,9 +475,8 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
progress->showGlobalStatus(100); progress->showGlobalStatus(100);
sleep(2); sleep(2);
snprintf(cmd, sizeof(cmd), "/sbin/tune2fs -r 0 -c 0 -i 0 %s", src); printf("CHDDFmtExec: executing %s %s\n","/sbin/tune2fs -r 0 -c 0 -i 0", src);
printf("CHDDFmtExec: executing %s\n", cmd); my_system("/sbin/tune2fs", "-r 0", "-c 0", "-i 0", src);
system(cmd);
_remount: _remount:
progress->hide(); progress->hide();
@@ -498,7 +510,7 @@ _remount:
sync(); sync();
} }
_return: _return:
if(!srun) system("smbd"); if(!srun) my_system("smbd",NULL);
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
@@ -518,7 +530,7 @@ int CHDDChkExec::exec(CMenuTarget* /*parent*/, const std::string& key)
printf("CHDDChkExec: key %s\n", key.c_str()); printf("CHDDChkExec: key %s\n", key.c_str());
bool srun = system("killall -9 smbd"); bool srun = my_system("killall", "-9", "smbd");
//res = check_and_umount(dst); //res = check_and_umount(dst);
res = check_and_umount(src, dst); res = check_and_umount(src, dst);
@@ -602,6 +614,6 @@ ret1:
} }
printf("CHDDChkExec: mount res %d\n", res); printf("CHDDChkExec: mount res %d\n", res);
if(!srun) system("smbd"); if(!srun) my_system("smbd",NULL);
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }

View File

@@ -71,6 +71,7 @@
#include <gui/pictureviewer.h> #include <gui/pictureviewer.h>
#include <gui/customcolor.h> #include <gui/customcolor.h>
#include <driver/record.h> #include <driver/record.h>
#include <system/helpers.h>
extern CPictureViewer * g_PicViewer; extern CPictureViewer * g_PicViewer;
static CProgressBar *timescale; static CProgressBar *timescale;
@@ -3593,10 +3594,8 @@ int CDirMenu::exec(CMenuTarget* parent, const std::string & actionKey)
{ {
if(dirState[number] == DIR_STATE_SERVER_DOWN) if(dirState[number] == DIR_STATE_SERVER_DOWN)
{ {
std::string command = "ether-wake "; printf("try to start server: %s %s\n","ether-wake", g_settings.network_nfs_mac[dirNfsMountNr[number]]);
command += g_settings.network_nfs_mac[dirNfsMountNr[number]]; if(my_system("ether-wake", g_settings.network_nfs_mac[dirNfsMountNr[number]]) != 0)
printf("try to start server: %s\n",command.c_str());
if(system(command.c_str()) != 0)
perror("ether-wake failed"); perror("ether-wake failed");
dirOptionText[number]="STARTE SERVER"; dirOptionText[number]="STARTE SERVER";

View File

@@ -34,6 +34,8 @@
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <system/debug.h> #include <system/debug.h>
#include <system/helpers.h>
#include <unistd.h> #include <unistd.h>
#define TOUCH_BASE "/var/etc/." #define TOUCH_BASE "/var/etc/."
@@ -70,18 +72,17 @@ CNetworkService::CNetworkService(std::string cmd, std::string opts)
void CNetworkService::Start() void CNetworkService::Start()
{ {
std::string cmd = command + " " + options; printf("CNetworkService::Start: %s %s\n", command.c_str(), options.c_str());
printf("CNetworkService::Start: %s\n", cmd.c_str()); my_system( command.c_str(), options.c_str());
system(cmd.c_str());
enabled = true; enabled = true;
TouchFile(); TouchFile();
} }
void CNetworkService::Stop() void CNetworkService::Stop()
{ {
std::string cmd = "killall " + command; const char killall []= "killall";
printf("CNetworkService::Stop: %s\n", cmd.c_str()); printf("CNetworkService::Stop: %s %s\n", killall, command.c_str());
system(cmd.c_str()); my_system(killall, command.c_str());
enabled = false; enabled = false;
TouchFile(); TouchFile();
} }

View File

@@ -40,7 +40,7 @@
#include <gui/widget/stringinput.h> #include <gui/widget/stringinput.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <system/setting_helpers.h> #include <system/helpers.h>
#include <sys/vfs.h> #include <sys/vfs.h>
@@ -102,14 +102,13 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
fileBrowser.Dir_Mode = true; fileBrowser.Dir_Mode = true;
if (fileBrowser.exec("/media") == true) if (fileBrowser.exec("/media") == true)
{ {
char fname[256];
struct statfs s; struct statfs s;
int ret = ::statfs(fileBrowser.getSelectedFile()->Name.c_str(), &s); int ret = ::statfs(fileBrowser.getSelectedFile()->Name.c_str(), &s);
if(ret == 0 && s.f_type != 0x72b6L) /*jffs2*/ if(ret == 0 && s.f_type != 0x72b6L) /*jffs2*/
{ {
sprintf(fname, "/bin/backup.sh %s", fileBrowser.getSelectedFile()->Name.c_str()); const char backup_sh[] = "/bin/backup.sh";
printf("backup: executing [%s]\n", fname); printf("backup: executing [%s %s]\n",backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
system(fname); my_system( backup_sh, fileBrowser.getSelectedFile()->Name.c_str() );
} }
else else
ShowMsgUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_SETTINGS_BACKUP_FAILED),CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR); ShowMsgUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_SETTINGS_BACKUP_FAILED),CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_ERROR);
@@ -125,10 +124,9 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
int result = ShowMsgUTF(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo); int result = ShowMsgUTF(LOCALE_SETTINGS_RESTORE, g_Locale->getText(LOCALE_SETTINGS_RESTORE_WARN), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo);
if(result == CMessageBox::mbrYes) if(result == CMessageBox::mbrYes)
{ {
char fname[256]; const char restore_sh[] = "/bin/restore.sh";
sprintf(fname, "/bin/restore.sh %s", fileBrowser.getSelectedFile()->Name.c_str()); printf("restore: executing [%s %s]\n", restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
printf("restore: executing [%s]\n", fname); my_system( restore_sh, fileBrowser.getSelectedFile()->Name.c_str() );
system(fname);
} }
} }
return res; return res;

View File

@@ -53,6 +53,7 @@
#include <system/flashtool.h> #include <system/flashtool.h>
#include <system/httptool.h> #include <system/httptool.h>
#include <system/helpers.h>
#define SQUASHFS #define SQUASHFS
@@ -471,7 +472,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
CFSMounter::umount(); CFSMounter::umount();
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8 ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8
//system("/etc/init.d/rcK"); //my_system("/etc/init.d/rcK");
ft.reboot(); ft.reboot();
sleep(20000); sleep(20000);
} }
@@ -492,13 +493,12 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
} }
else // not image, install else // not image, install
{ {
char cmd[100]; const char install_sh[] = "/bin/install.sh";
sprintf(cmd, "install.sh %s %s", g_settings.update_dir, filename.c_str());
#ifdef DEBUG1 #ifdef DEBUG1
printf("[update] calling %s\n", cmd); printf("[update] calling %s %s %s\n",install_sh, g_settings.update_dir, filename.c_str() );
#else #else
printf("[update] calling %s\n", cmd); printf("[update] calling %s %s %s\n",install_sh, g_settings.update_dir, filename.c_str() );
system(cmd); my_system( install_sh, g_settings.update_dir, filename.c_str() );
#endif #endif
showGlobalStatus(100); showGlobalStatus(100);
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8

View File

@@ -37,6 +37,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <signal.h> #include <signal.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <dirent.h>
#include <fstream> #include <fstream>
@@ -557,9 +560,18 @@ int CNeutrinoApp::loadSetup(const char * fname)
if(g_settings.auto_delete) { if(g_settings.auto_delete) {
if(strcmp(g_settings.timeshiftdir, g_settings.network_nfs_recordingdir)) { if(strcmp(g_settings.timeshiftdir, g_settings.network_nfs_recordingdir)) {
char buf[512]; DIR *d = opendir(timeshiftDir);
sprintf(buf, "rm -f %s/*_temp.ts %s/*_temp.xml &", timeshiftDir, timeshiftDir); if(d){
system(buf); while (struct dirent *e = readdir(d))
{
std::string filename = e->d_name;
if ((filename.find("_temp.ts") == filename.size() - 8) || (filename.find("_temp.xml") == filename.size() - 9))
{
remove(filename.c_str());
}
}
closedir(d);
}
} }
} }
g_settings.record_hours = configfile.getInt32( "record_hours", 4 ); g_settings.record_hours = configfile.getInt32( "record_hours", 4 );
@@ -1879,10 +1891,12 @@ TIMER_START();
g_CamHandler->init(); g_CamHandler->init();
#ifndef ASSUME_MDEV #ifndef ASSUME_MDEV
system("mkdir /media/sda1 2> /dev/null"); const char hddsda1[] = "/media/sda1";
system("mount /media/sda1 2> /dev/null"); const char hddsdb1[] = "/media/sdb1";
system("mkdir /media/sdb1 2> /dev/null"); mkdir(hddsda1, 0755);
system("mount /media/sdb1 2> /dev/null"); mount("/dev/sda1", hddsda1, "ext3", 0, NULL);
mkdir(hddsdb1,0755);
mount("/dev/sdb1", hddsdb1, "ext3", 0, NULL);
#endif #endif
CFSMounter::automount(); CFSMounter::automount();
@@ -2684,9 +2698,7 @@ _repeat:
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) { for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) {
if (strcmp(g_settings.network_nfs_local_dir[i],recordingDir) == 0) { if (strcmp(g_settings.network_nfs_local_dir[i],recordingDir) == 0) {
printf("[neutrino] waking up %s (%s)\n",g_settings.network_nfs_ip[i].c_str(),recordingDir); printf("[neutrino] waking up %s (%s)\n",g_settings.network_nfs_ip[i].c_str(),recordingDir);
std::string command = "ether-wake "; if(my_system("ether-wake",g_settings.network_nfs_mac[i]) != 0)
command += g_settings.network_nfs_mac[i];
if(system(command.c_str()) != 0)
perror("ether-wake failed"); perror("ether-wake failed");
break; break;
} }
@@ -2946,8 +2958,8 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
//CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN)); //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN));
my_system("/etc/init.d/rcK"); my_system("/etc/init.d/rcK");
system("/bin/sync"); sync();
system("/bin/umount -a"); my_system("/bin/umount", "-a");
sleep(1); sleep(1);
{ {
standby_data_t standby; standby_data_t standby;
@@ -3024,7 +3036,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
delete &CMoviePlayerGui::getInstance(); delete &CMoviePlayerGui::getInstance();
shutdown_cs_api(); shutdown_cs_api();
system("/etc/init.d/rcK"); my_system("/etc/init.d/rcK");
CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true); CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true);
InfoClock->StopClock(); InfoClock->StopClock();

View File

@@ -27,11 +27,11 @@
#include "configure_network.h" #include "configure_network.h"
#include <lib/libnet/libnet.h> /* netGetNameserver, netSetNameserver */ #include <lib/libnet/libnet.h> /* netGetNameserver, netSetNameserver */
#include <lib/libnet/network_interfaces.h> /* getInetAttributes, setInetAttributes */ #include <lib/libnet/network_interfaces.h> /* getInetAttributes, setInetAttributes */
#include <stdlib.h> /* system */
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
#include <system/helpers.h>
CNetworkConfig::CNetworkConfig() CNetworkConfig::CNetworkConfig()
{ {
@@ -218,11 +218,11 @@ void CNetworkConfig::commitConfig(void)
void CNetworkConfig::startNetwork(void) void CNetworkConfig::startNetwork(void)
{ {
std::string cmd = "/sbin/ifup " + ifname; const char _ifup[] = "/sbin/ifup";
#ifdef DEBUG #ifdef DEBUG
printf("CNetworkConfig::startNetwork: %s\n", cmd.c_str()); printf("CNetworkConfig::startNetwork: %s %s\n",_ifup, ifname.c_str());
#endif #endif
system(cmd.c_str()); my_system(_ifup, ifname.c_str());
if (!inet_static) { if (!inet_static) {
init_vars(); init_vars();
@@ -232,11 +232,11 @@ void CNetworkConfig::startNetwork(void)
void CNetworkConfig::stopNetwork(void) void CNetworkConfig::stopNetwork(void)
{ {
std::string cmd = "/sbin/ifdown " + ifname; const char _ifdown[] = "/sbin/ifdown";
#ifdef DEBUG #ifdef DEBUG
printf("CNetworkConfig::stopNetwork: %s\n", cmd.c_str()); printf("CNetworkConfig::stopNetwork: %s %s\n",_ifdown, ifname.c_str());
#endif #endif
system(cmd.c_str()); my_system(_ifdown, ifname.c_str());
} }