diff --git a/data/cables.xml b/data/cables.xml
index 619c3279a..9bfecff6e 100644
--- a/data/cables.xml
+++ b/data/cables.xml
@@ -260,6 +260,12 @@
+
+
+
+
+
+
diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale
index 2ca31dd32..8d3fea58e 100644
--- a/data/locale/deutsch.locale
+++ b/data/locale/deutsch.locale
@@ -1323,8 +1323,8 @@ networkmenu.ntpenable Zeit per INet synchronisieren
networkmenu.ntprefresh NTP/DVB-Aktualisierung
networkmenu.ntprefresh_hint1 NTP/DVB-Time-Sync [min]
networkmenu.ntprefresh_hint2 braucht Reboot oder EPG-Reset
-networkmenu.ntpserver NTP-URL (Zeitserver)
-networkmenu.ntpserver_hint1 NTP-URL Beispiel: ntp1.ptb.de
+networkmenu.ntpserver NTP-Server
+networkmenu.ntpserver_hint1 NTP-Server Beispiel: ntp1.ptb.de
networkmenu.ntpserver_hint2 braucht Reboot oder EPG-Reset
networkmenu.ntptitle Zeitsynchronisation
networkmenu.password Passwort (PSK)
@@ -1648,6 +1648,8 @@ streaminfo.resolution Auflösung
streaminfo.signal Empfangssignal
streaming.busy Ein oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart von Neutrino-HD Abhilfe.
streaming.dir_not_writable Das Aufnahmeverzeichnis ist nicht beschreibbar.\nAufnahmen sind daher nicht möglich.
+streaming.overflow Aufnahme-Puffer Überlauf! Bitte ggf. einige Aufnahmen beenden.
+streaming.slow System oder Datenträger zu langsam! Bitte ggf. einige Aufnahmen beenden.
streaming.write_error Die Aufnahme wurde leider abgebrochen,\nda ein Fehler beim Schreiben der Daten auftrat.
stringinput.caps Groß-/Kleinbuchstaben
stringinput.clear Alles löschen
diff --git a/data/satellites.xml b/data/satellites.xml
index 79d7318a1..4e23f57fc 100755
--- a/data/satellites.xml
+++ b/data/satellites.xml
@@ -1375,12 +1375,12 @@
-
+
-
+
@@ -1560,6 +1560,7 @@
+
@@ -1601,7 +1602,6 @@
-
diff --git a/src/driver/record.cpp b/src/driver/record.cpp
index 6e637611d..222f956e5 100644
--- a/src/driver/record.cpp
+++ b/src/driver/record.cpp
@@ -231,8 +231,8 @@ bool CRecordInstance::Stop(bool remove_event)
CCamManager::getInstance()->Stop(channel_id, CCamManager::RECORD);
if((autoshift && g_settings.auto_delete) /* || autoshift_delete*/) {
- snprintf(buf,sizeof(buf), "nice -n 20 rm -f \"%s.ts\" &", filename);
- system(buf);
+ snprintf(buf,sizeof(buf), "\"%s.ts\"", filename);
+ my_system("nice", "-n20", "rm", "-f", buf);
snprintf(buf,sizeof(buf), "%s.xml", filename);
//autoshift_delete = false;
unlink(buf);
@@ -575,6 +575,8 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel)
return RECORD_INVALID_DIRECTORY;
/* fallback to g_settings.network_nfs_recordingdir */
Directory = std::string(g_settings.network_nfs_recordingdir);
+ }else{
+ return RECORD_INVALID_DIRECTORY;
}
}
diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp
index 88b618954..910506fe0 100644
--- a/src/gui/hdd_menu.cpp
+++ b/src/gui/hdd_menu.cpp
@@ -269,21 +269,34 @@ int CHDDMenuHandler::doMenu ()
int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&)
{
- char cmd[100];
+ char M_opt[50],S_opt[50];
+ char opt[100];
struct dirent **namelist;
int n = scandir("/sys/block", &namelist, my_filter, alphasort);
if (n < 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++) {
printf("CHDDDestExec: noise %d sleep %d /dev/%s\n",
g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name);
- //hdparm -M is not included in busybox hdparm!
- //we need full version of hdparm or should remove -M parameter here
- 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);
- system(cmd);
+ snprintf(S_opt, sizeof(S_opt),"-S%d", g_settings.hdd_sleep);
+ snprintf(opt, sizeof(opt),"/dev/%s",namelist[i]->d_name);
+
+ if(hdparm_link){
+ //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);
@@ -327,7 +340,7 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
if(res != CMessageBox::mbrYes)
return 0;
- bool srun = system("killall -9 smbd");
+ bool srun = my_system("killall", "-9", "smbd");
//res = check_and_umount(dst);
res = check_and_umount(src, dst);
@@ -462,9 +475,8 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key)
progress->showGlobalStatus(100);
sleep(2);
- snprintf(cmd, sizeof(cmd), "/sbin/tune2fs -r 0 -c 0 -i 0 %s", src);
- printf("CHDDFmtExec: executing %s\n", cmd);
- system(cmd);
+ printf("CHDDFmtExec: executing %s %s\n","/sbin/tune2fs -r 0 -c 0 -i 0", src);
+ my_system("/sbin/tune2fs", "-r 0", "-c 0", "-i 0", src);
_remount:
progress->hide();
@@ -498,7 +510,7 @@ _remount:
sync();
}
_return:
- if(!srun) system("smbd");
+ if(!srun) my_system("smbd",NULL);
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());
- bool srun = system("killall -9 smbd");
+ bool srun = my_system("killall", "-9", "smbd");
//res = check_and_umount(dst);
res = check_and_umount(src, dst);
@@ -602,6 +614,6 @@ ret1:
}
printf("CHDDChkExec: mount res %d\n", res);
- if(!srun) system("smbd");
+ if(!srun) my_system("smbd",NULL);
return menu_return::RETURN_REPAINT;
}
diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp
index 5807eabd4..ac5ecfa27 100644
--- a/src/gui/imageinfo.cpp
+++ b/src/gui/imageinfo.cpp
@@ -32,6 +32,8 @@
#include
#include
+#include
+
#include
#include
@@ -209,8 +211,24 @@ void CImageInfo::paint()
#else
const char * builddate = config.getString("builddate", BUILT_DATE).c_str();
#endif
+
static CFlashVersionInfo versionInfo(version);
const char * releaseCycle = versionInfo.getReleaseCycle();
+
+ struct utsname uts_info;
+ std::string Version_Kernel;
+ if( uname(&uts_info) < 0 ) {
+ Version_Kernel = releaseCycle;
+ Version_Kernel += " ";
+ Version_Kernel += versionInfo.getType();
+ }else{
+ Version_Kernel = releaseCycle;
+ Version_Kernel += " ";
+ Version_Kernel += versionInfo.getType();
+ Version_Kernel += " - Kernel: ";
+ Version_Kernel += uts_info.release;
+ }
+
snprintf((char*) imagedate,sizeof(imagedate), "%s %s", versionInfo.getDate(), versionInfo.getTime());
ypos += iheight;
@@ -223,7 +241,7 @@ void CImageInfo::paint()
ypos += iheight;
paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION));
- paintLine(xpos+offset, font_info, releaseCycle);
+ paintLine(xpos+offset, font_info, Version_Kernel.c_str());
ypos += iheight;
#ifdef SVNVERSION
diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp
index d106d0f98..7502bad65 100644
--- a/src/gui/infoviewer_bb.cpp
+++ b/src/gui/infoviewer_bb.cpp
@@ -94,7 +94,7 @@ CInfoViewerBB::CInfoViewerBB()
void CInfoViewerBB::Init()
{
hddscale = NULL;
- varscale = NULL;
+ sysscale = NULL;
hddwidth = 0;
bbIconMaxH = 0;
bbButtonMaxH = 0;
@@ -597,9 +597,11 @@ void CInfoViewerBB::showSysfsHdd()
{
if (g_settings.infobar_show_sysfs_hdd) {
//sysFS info
- int sysper = 0;
- sysper = get_fs_usage("/");
- showBarSys(sysper);
+ int percent = 0;
+ long t, u;
+ if (get_fs_usage("/", t, u))
+ percent = (u * 100ULL) / t;
+ showBarSys(percent);
#if 0
//HDD info in a seperate thread
@@ -610,8 +612,9 @@ void CInfoViewerBB::showSysfsHdd()
}
#else
if (!check_dir(g_settings.network_nfs_recordingdir)) {
- sysper = get_fs_usage(g_settings.network_nfs_recordingdir);
- showBarHdd(sysper);
+ if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
+ percent = (u * 100ULL) / t;
+ showBarHdd(percent);
}
#endif
}
@@ -621,9 +624,11 @@ void* CInfoViewerBB::hddperThread(void *arg)
{
CInfoViewerBB *infoViewerBB = (CInfoViewerBB*) arg;
- int hddper = 0;
- hddper = get_fs_usage(g_settings.network_nfs_recordingdir);
- infoViewerBB->showBarHdd(hddper);
+ int percent = 0;
+ long t, u;
+ if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
+ percent = (u * 100ULL) / t;
+ infoViewerBB->showBarHdd(percent);
infoViewerBB->hddperTflag=false;
pthread_exit(NULL);
@@ -632,13 +637,11 @@ void* CInfoViewerBB::hddperThread(void *arg)
void CInfoViewerBB::showBarSys(int percent)
{
if (is_visible)
- varscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth, 6, percent, 100);
+ sysscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 - 2 - 6, hddwidth, 6, percent, 100);
}
void CInfoViewerBB::showBarHdd(int percent)
{
- if (percent < 0)
- percent = 0;
if (is_visible)
hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, percent, 100);
}
@@ -791,16 +794,16 @@ void CInfoViewerBB::changePB()
if (hddscale != NULL)
delete hddscale;
hddscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true);
- if (varscale != NULL)
- delete varscale;
- varscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true);
+ if (sysscale != NULL)
+ delete sysscale;
+ sysscale = new CProgressBar(true, hddwidth, 6, 50, 100, 75, true);
}
void CInfoViewerBB::reset_allScala()
{
hddscale->reset();
- varscale->reset();
- lasthdd = lastvar = -1;
+ sysscale->reset();
+ //lasthdd = lastsys = -1;
}
void CInfoViewerBB::setBBOffset()
diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h
index 84353c6b9..41bb17cb0 100644
--- a/src/gui/infoviewer_bb.h
+++ b/src/gui/infoviewer_bb.h
@@ -98,7 +98,7 @@ class CInfoViewerBB
int BBarY, BBarFontY;
int hddwidth;
- int lasthdd, lastvar;
+ //int lasthdd, lastsys;
bool fta;
int minX;
@@ -106,7 +106,7 @@ class CInfoViewerBB
bool scrambledNoSig, scrambledNoSigSave;
pthread_t scrambledT;
- CProgressBar *hddscale, *varscale;
+ CProgressBar *hddscale, *sysscale;
void showBBIcons(const int modus, const std::string & icon);
void getBBIconInfo(void);
diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp
index bc05e028c..409d0ddd4 100644
--- a/src/gui/miscsettings_menu.cpp
+++ b/src/gui/miscsettings_menu.cpp
@@ -281,8 +281,10 @@ void CMiscMenue::showMiscSettingsMenuEnergy(CMenuWidget *ms_energy)
CStringInput * miscSettings_shutdown_count = new CStringInput(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, g_settings.shutdown_count, 3, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT2, "0123456789 ");
CMenuForwarder *m2 = new CMenuDForwarder(LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, !g_settings.shutdown_real, g_settings.shutdown_count, miscSettings_shutdown_count);
m2->setHint("", LOCALE_MENU_HINT_SHUTDOWN_COUNT);
-
- miscNotifier = new CMiscNotifier( m1, m2 );
+
+ miscNotifier = new COnOffNotifier(1);
+ miscNotifier->addItem(m1);
+ miscNotifier->addItem(m2);
CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_SHUTDOWN_REAL, &g_settings.shutdown_real, OPTIONS_OFF1_ON0_OPTIONS, OPTIONS_OFF1_ON0_OPTION_COUNT, true, miscNotifier);
mc->setHint("", LOCALE_MENU_HINT_SHUTDOWN_REAL);
diff --git a/src/gui/miscsettings_menu.h b/src/gui/miscsettings_menu.h
index 84e4e72b5..b05d0c68a 100644
--- a/src/gui/miscsettings_menu.h
+++ b/src/gui/miscsettings_menu.h
@@ -40,7 +40,7 @@ class CMiscMenue : public CMenuTarget
private:
CFanControlNotifier *fanNotifier;
CSectionsdConfigNotifier* sectionsdConfigNotifier;
- CMiscNotifier* miscNotifier;
+ COnOffNotifier* miscNotifier;
int width;
diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp
index 6f14c3d2c..b651122ee 100644
--- a/src/gui/moviebrowser.cpp
+++ b/src/gui/moviebrowser.cpp
@@ -71,6 +71,7 @@
#include
#include
#include
+#include
extern CPictureViewer * g_PicViewer;
static CProgressBar *timescale;
@@ -2976,7 +2977,8 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /*movie_info*/)
{
dirInput[i] = new CFileChooser(&m_settings.storageDir[i]);
forwarder[i] = new CMenuForwarder(LOCALE_MOVIEBROWSER_DIR, m_settings.storageDirUsed[i], m_settings.storageDir[i], dirInput[i]);
- notifier[i] = new COnOffNotifier(forwarder[i]);
+ notifier[i] = new COnOffNotifier();
+ notifier[i]->addItem(forwarder[i]);
chooser[i] = new CMenuOptionChooser(LOCALE_MOVIEBROWSER_USE_DIR , &m_settings.storageDirUsed[i] , MESSAGEBOX_YES_NO_OPTIONS, MESSAGEBOX_YES_NO_OPTIONS_COUNT, true,notifier[i]);
optionsMenuDir.addItem(chooser[i] );
optionsMenuDir.addItem(forwarder[i] );
@@ -3593,10 +3595,8 @@ int CDirMenu::exec(CMenuTarget* parent, const std::string & actionKey)
{
if(dirState[number] == DIR_STATE_SERVER_DOWN)
{
- std::string command = "ether-wake ";
- command += g_settings.network_nfs_mac[dirNfsMountNr[number]];
- printf("try to start server: %s\n",command.c_str());
- if(system(command.c_str()) != 0)
+ printf("try to start server: %s %s\n","ether-wake", g_settings.network_nfs_mac[dirNfsMountNr[number]]);
+ if(my_system("ether-wake", g_settings.network_nfs_mac[dirNfsMountNr[number]]) != 0)
perror("ether-wake failed");
dirOptionText[number]="STARTE SERVER";
diff --git a/src/gui/network_service.cpp b/src/gui/network_service.cpp
index 450c49953..23ca4bc48 100644
--- a/src/gui/network_service.cpp
+++ b/src/gui/network_service.cpp
@@ -34,6 +34,8 @@
#include
#include
+#include
+
#include
#define TOUCH_BASE "/var/etc/."
@@ -70,18 +72,17 @@ CNetworkService::CNetworkService(std::string cmd, std::string opts)
void CNetworkService::Start()
{
- std::string cmd = command + " " + options;
- printf("CNetworkService::Start: %s\n", cmd.c_str());
- system(cmd.c_str());
+ printf("CNetworkService::Start: %s %s\n", command.c_str(), options.c_str());
+ my_system( command.c_str(), options.c_str());
enabled = true;
TouchFile();
}
void CNetworkService::Stop()
{
- std::string cmd = "killall " + command;
- printf("CNetworkService::Stop: %s\n", cmd.c_str());
- system(cmd.c_str());
+ const char killall []= "killall";
+ printf("CNetworkService::Stop: %s %s\n", killall, command.c_str());
+ my_system(killall, command.c_str());
enabled = false;
TouchFile();
}
diff --git a/src/gui/network_setup.cpp b/src/gui/network_setup.cpp
index f3f6083e2..1e77d421e 100644
--- a/src/gui/network_setup.cpp
+++ b/src/gui/network_setup.cpp
@@ -709,10 +709,14 @@ void CNetworkSetup::testNetworkSettings()
char our_gateway[16];
char our_nameserver[16];
- std::string text, testsite;
+ std::string text, testsite, offset = " ";
- //set default testdomain and wiki-IP
- std::string defaultsite = "www.google.de", wiki_IP = "89.31.143.1";
+ //set default testdomain
+ std::string defaultsite = "www.google.de";
+
+ //set wiki-URL and wiki-IP
+ std::string wiki_URL = "wiki.neutrino-hd.de";
+ std::string wiki_IP = "89.31.143.1";
//get www-domain testsite from /.version
CConfigFile config('\t');
@@ -746,7 +750,7 @@ void CNetworkSetup::testNetworkSettings()
printf("testNw Broadcast: %s\n", our_broadcast);
printf("testNw Gateway: %s\n", our_gateway);
printf("testNw Nameserver: %s\n", our_nameserver);
- printf("testNw Testsite %s\n", testsite.c_str());
+ printf("testNw Testsite: %s\n", testsite.c_str());
if (our_ip[0] == 0)
{
@@ -754,26 +758,30 @@ void CNetworkSetup::testNetworkSettings()
}
else
{
- text = "Box: " + old_mac_addr + "\n ";
- text += (std::string)our_ip + " " + (std::string)mypinghost(our_ip);
- text += "\n";
- text += g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY);
- text += " (Router)\n ";
- text += (std::string)our_gateway + " " +(std::string)mypinghost(our_gateway);
- text += "\n";
- text += g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER);
- text += "\n ";
- text += (std::string)our_nameserver + " " + (std::string)mypinghost(our_nameserver);
- text += "\n";
- text += "wiki.neutrino-hd.de:\n ";
- text += "via IP (" + wiki_IP + "): " + (std::string)mypinghost(wiki_IP.c_str());
- text += ":\n ";
- if (1 == pinghost(our_nameserver))
+ //Box
+ text = "Box (" + old_mac_addr + "):\n";
+ text += offset + (std::string)our_ip + " " + (std::string)mypinghost(our_ip) + "\n";
+ //Gateway
+ text += (std::string)g_Locale->getText(LOCALE_NETWORKMENU_GATEWAY) + " (Router):\n";
+ text += offset + (std::string)our_gateway + " " + (std::string)mypinghost(our_gateway) + "\n";
+ //Nameserver
+ text += (std::string)g_Locale->getText(LOCALE_NETWORKMENU_NAMESERVER) + ":\n";
+ text += offset + (std::string)our_nameserver + " " + (std::string)mypinghost(our_nameserver) + "\n";
+ //NTPserver
+ if ( (pinghost(our_nameserver) == 1) && g_settings.network_ntpenable && (g_settings.network_ntpserver != "") )
{
- text += "via DNS: " + (std::string)mypinghost("wiki.neutrino-hd.de");
- text += "\n";
- text += testsite + ":\n ";
- text += "via DNS: " + (std::string)mypinghost(testsite.c_str()) + ":\n";
+ text += (std::string)g_Locale->getText(LOCALE_NETWORKMENU_NTPSERVER) + ":\n";
+ text += offset + g_settings.network_ntpserver + " " + (std::string)mypinghost(g_settings.network_ntpserver.c_str()) + "\n";
+ }
+ //Wiki
+ text += wiki_URL + ":\n";
+ text += offset + "via IP (" + wiki_IP + "): " + (std::string)mypinghost(wiki_IP.c_str()) + "\n";
+ if (pinghost(our_nameserver) == 1)
+ {
+ text += offset + "via DNS: " + (std::string)mypinghost(wiki_URL.c_str()) + "\n";
+ //testsite (or defaultsite)
+ text += testsite + ":\n";
+ text += offset + "via DNS: " + (std::string)mypinghost(testsite.c_str()) + "\n";
}
}
diff --git a/src/gui/nfs.cpp b/src/gui/nfs.cpp
index 79122a775..3117fba73 100644
--- a/src/gui/nfs.cpp
+++ b/src/gui/nfs.cpp
@@ -51,37 +51,9 @@
#include
#include
#include
-
+#include
#include
-class CNFSMountGuiNotifier : public CChangeObserver
-{
-private:
- CMenuForwarder *m_opt1,*m_opt2, *m_user, *m_pass;
- int *m_type;
-public:
- CNFSMountGuiNotifier( CMenuForwarder* a3, CMenuForwarder* a4 , int* type)
- {
- m_user = a3;
- m_pass = a4;
- m_type = type;
- }
- bool changeNotify(const neutrino_locale_t /*OptionName*/, void *)
- {
- if(*m_type == (int)CFSMounter::NFS)
- {
- m_user->setActive (false);
- m_pass->setActive (false);
- }
- else
- {
- m_user->setActive (true);
- m_pass->setActive (true);
- }
- return true;
- }
-};
-
CNFSMountGui::CNFSMountGui()
{
// FIXME #warning move probing from exec() to fsmounter
@@ -149,10 +121,17 @@ int CNFSMountGui::exec( CMenuTarget* parent, const std::string & actionKey )
else if(actionKey.substr(0,7)=="domount")
{
int nr=atoi(actionKey.substr(7,1).c_str());
- CFSMounter::mount(g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr],
+ CFSMounter::MountRes mres = CFSMounter::mount(
+ g_settings.network_nfs_ip[nr].c_str(), g_settings.network_nfs_dir[nr],
g_settings.network_nfs_local_dir[nr], (CFSMounter::FSType) g_settings.network_nfs_type[nr],
g_settings.network_nfs_username[nr], g_settings.network_nfs_password[nr],
g_settings.network_nfs_mount_options1[nr], g_settings.network_nfs_mount_options2[nr]);
+
+ if (mres == CFSMounter::MRES_OK || mres == CFSMounter::MRES_FS_ALREADY_MOUNTED)
+ mountMenuEntry[nr]->iconName = NEUTRINO_ICON_MOUNTED;
+ else
+ mountMenuEntry[nr]->iconName = NEUTRINO_ICON_NOT_MOUNTED;
+
// TODO show msg in case of error
returnval = menu_return::RETURN_EXIT;
}
@@ -176,15 +155,16 @@ int CNFSMountGui::menu()
{
sprintf(s2,"mountentry%d",i);
sprintf(ISO_8859_1_entry[i],ZapitTools::UTF8_to_Latin1(m_entry[i]).c_str());
- CMenuForwarderNonLocalized *forwarder = new CMenuForwarderNonLocalized(ISO_8859_1_entry[i], true, NULL, this, s2);
+ mountMenuEntry[i] = new CMenuForwarderNonLocalized("", true, ISO_8859_1_entry[i], this, s2);
+
if (CFSMounter::isMounted(g_settings.network_nfs_local_dir[i]))
{
- forwarder->iconName = NEUTRINO_ICON_MOUNTED;
+ mountMenuEntry[i]->iconName = NEUTRINO_ICON_MOUNTED;
} else
{
- forwarder->iconName = NEUTRINO_ICON_NOT_MOUNTED;
+ mountMenuEntry[i]->iconName = NEUTRINO_ICON_NOT_MOUNTED;
}
- mountMenuW.addItem(forwarder);
+ mountMenuW.addItem(mountMenuEntry[i]);
}
int ret=mountMenuW.exec(this,"");
return ret;
@@ -251,13 +231,16 @@ int CNFSMountGui::menuEntry(int nr)
CStringInputSMS options2Input(LOCALE_NFS_MOUNT_OPTIONS, options2, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_=.,:|!?/ ");
CMenuForwarder *options2_fwd = new CMenuForwarder(LOCALE_NFS_MOUNT_OPTIONS, true, options2, &options2Input);
CStringInputSMS userInput(LOCALE_NFS_USERNAME, username, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (*type==CFSMounter::CIFS || CFSMounter::LUFS), username, &userInput);
+ CMenuForwarder *username_fwd = new CMenuForwarder(LOCALE_NFS_USERNAME, (*type != (int)CFSMounter::NFS), username, &userInput);
CStringInputSMS passInput(LOCALE_NFS_PASSWORD, password, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-_.,:|!?/ ");
- CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type==CFSMounter::CIFS || CFSMounter::LUFS), NULL, &passInput);
+ CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, (*type != (int)CFSMounter::NFS), NULL, &passInput);
CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, g_settings.network_nfs_mac[nr], LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2);
CMenuForwarder * macInput_fwd = new CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, g_settings.network_nfs_mac[nr], &macInput);
-
- CNFSMountGuiNotifier notifier(username_fwd, password_fwd, type);
+ CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, !(CFSMounter::isMounted(g_settings.network_nfs_local_dir[nr])), NULL, this, cmd);
+ mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
+ COnOffNotifier notifier(CFSMounter::NFS);
+ notifier.addItem(username_fwd);
+ notifier.addItem(password_fwd);
mountMenuEntryW.addItem(new CMenuOptionChooser(LOCALE_NFS_TYPE, type, NFS_TYPE_OPTIONS, NFS_TYPE_OPTION_COUNT, typeEnabled, ¬ifier));
mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_IP , true, g_settings.network_nfs_ip[nr], &ipInput ));
@@ -269,7 +252,7 @@ int CNFSMountGui::menuEntry(int nr)
mountMenuEntryW.addItem(username_fwd);
mountMenuEntryW.addItem(password_fwd);
mountMenuEntryW.addItem(macInput_fwd);
- mountMenuEntryW.addItem(new CMenuForwarder(LOCALE_NFS_MOUNTNOW, true, NULL , this , cmd ));
+ mountMenuEntryW.addItem(mountnow_fwd);
int ret = mountMenuEntryW.exec(this,"");
return ret;
@@ -333,8 +316,10 @@ int CNFSSmallMenu::exec( CMenuTarget* parent, const std::string & actionKey )
CMenuWidget sm_menu(LOCALE_NFSMENU_HEAD, NEUTRINO_ICON_NETWORK, width);
CNFSMountGui mountGui;
CNFSUmountGui umountGui;
+ CMenuForwarder *remount_fwd = new CMenuForwarder(LOCALE_NFS_REMOUNT, true, NULL, this, "remount");
+ remount_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
sm_menu.addIntroItems();
- sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_REMOUNT, true, NULL, this, "remount"));
+ sm_menu.addItem(remount_fwd);
sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_MOUNT , true, NULL, & mountGui));
sm_menu.addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, &umountGui));
return sm_menu.exec(parent, actionKey);
diff --git a/src/gui/nfs.h b/src/gui/nfs.h
index ad5e77063..46d4469ae 100644
--- a/src/gui/nfs.h
+++ b/src/gui/nfs.h
@@ -46,7 +46,9 @@ class CNFSMountGui : public CMenuTarget
int menuEntry(int nr);
char m_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
- char ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
+ char ISO_8859_1_entry[NETWORK_NFS_NR_OF_ENTRIES][200];
+
+ CMenuForwarderNonLocalized* mountMenuEntry[NETWORK_NFS_NR_OF_ENTRIES];
CFSMounter::FS_Support m_nfs_sup;
CFSMounter::FS_Support m_cifs_sup;
diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp
index 610642622..82a6df825 100644
--- a/src/gui/osd_setup.cpp
+++ b/src/gui/osd_setup.cpp
@@ -73,6 +73,7 @@ COsdSetup::COsdSetup(bool wizard_mode)
is_wizard = wizard_mode;
width = w_max (40, 10); //%
+ show_tuner_icon = 0;
}
COsdSetup::~COsdSetup()
@@ -763,7 +764,7 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar)
// tuner icon
bool mc_active = false;
- int show_tuner_icon = 0;
+ show_tuner_icon = 0;
// show possible option if we in single box mode, but don't touch the real settings
int *p_show_tuner_icon = &show_tuner_icon;
if (CFEManager::getInstance()->getMode() != CFEManager::FE_MODE_SINGLE){
diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h
index 65429d9dc..e62f6f793 100644
--- a/src/gui/osd_setup.h
+++ b/src/gui/osd_setup.h
@@ -49,6 +49,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
int width;
bool is_wizard;
+ int show_tuner_icon;
int showOsdSetup();
void showOsdMenueColorSetup(CMenuWidget *menu_colors);
@@ -89,15 +90,4 @@ class COsdSetup : public CMenuTarget, public CChangeObserver
int showContextChanlistMenu();
};
-
-class COsdSetupChannelLogoNotifier : public CChangeObserver
-{
- private:
- CMenuForwarder* toDisable1;
- CMenuOptionChooser* toDisable2;
- public:
- COsdSetupChannelLogoNotifier( CMenuForwarder*, CMenuOptionChooser* );
- bool changeNotify(const neutrino_locale_t, void * Data);
-};
-
#endif
diff --git a/src/gui/settings_manager.cpp b/src/gui/settings_manager.cpp
index 724fac6d7..9bb4f3c60 100644
--- a/src/gui/settings_manager.cpp
+++ b/src/gui/settings_manager.cpp
@@ -40,7 +40,7 @@
#include
#include
-#include
+#include
#include
@@ -102,14 +102,13 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey)
fileBrowser.Dir_Mode = true;
if (fileBrowser.exec("/media") == true)
{
- char fname[256];
struct statfs s;
int ret = ::statfs(fileBrowser.getSelectedFile()->Name.c_str(), &s);
if(ret == 0 && s.f_type != 0x72b6L) /*jffs2*/
{
- sprintf(fname, "/bin/backup.sh %s", fileBrowser.getSelectedFile()->Name.c_str());
- printf("backup: executing [%s]\n", fname);
- system(fname);
+ const char backup_sh[] = "/bin/backup.sh";
+ printf("backup: executing [%s %s]\n",backup_sh, fileBrowser.getSelectedFile()->Name.c_str());
+ my_system( backup_sh, fileBrowser.getSelectedFile()->Name.c_str() );
}
else
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);
if(result == CMessageBox::mbrYes)
{
- char fname[256];
- sprintf(fname, "/bin/restore.sh %s", fileBrowser.getSelectedFile()->Name.c_str());
- printf("restore: executing [%s]\n", fname);
- system(fname);
+ const char restore_sh[] = "/bin/restore.sh";
+ printf("restore: executing [%s %s]\n", restore_sh, fileBrowser.getSelectedFile()->Name.c_str());
+ my_system( restore_sh, fileBrowser.getSelectedFile()->Name.c_str() );
}
}
return res;
diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp
index bb6e3aae7..d0e3419be 100644
--- a/src/gui/test_menu.cpp
+++ b/src/gui/test_menu.cpp
@@ -40,6 +40,7 @@
#include
+#include
#include
#include
#include
diff --git a/src/gui/update.cpp b/src/gui/update.cpp
index 32551ec9f..d61b0f542 100644
--- a/src/gui/update.cpp
+++ b/src/gui/update.cpp
@@ -53,6 +53,7 @@
#include
#include
+#include
#define SQUASHFS
@@ -471,7 +472,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
CFSMounter::umount();
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();
sleep(20000);
}
@@ -492,13 +493,12 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
}
else // not image, install
{
- char cmd[100];
- sprintf(cmd, "install.sh %s %s", g_settings.update_dir, filename.c_str());
+ const char install_sh[] = "/bin/install.sh";
#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
- printf("[update] calling %s\n", cmd);
- system(cmd);
+ printf("[update] calling %s %s %s\n",install_sh, g_settings.update_dir, filename.c_str() );
+ my_system( install_sh, g_settings.update_dir, filename.c_str() );
#endif
showGlobalStatus(100);
ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8
diff --git a/src/neutrino.cpp b/src/neutrino.cpp
index c633a88b8..374637e97 100644
--- a/src/neutrino.cpp
+++ b/src/neutrino.cpp
@@ -37,6 +37,9 @@
#include
#include
#include
+#include
+#include
+#include
#include
@@ -557,9 +560,18 @@ int CNeutrinoApp::loadSetup(const char * fname)
if(g_settings.auto_delete) {
if(strcmp(g_settings.timeshiftdir, g_settings.network_nfs_recordingdir)) {
- char buf[512];
- sprintf(buf, "rm -f %s/*_temp.ts %s/*_temp.xml &", timeshiftDir, timeshiftDir);
- system(buf);
+ DIR *d = opendir(timeshiftDir);
+ if(d){
+ 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 );
@@ -1879,10 +1891,12 @@ TIMER_START();
g_CamHandler->init();
#ifndef ASSUME_MDEV
- system("mkdir /media/sda1 2> /dev/null");
- system("mount /media/sda1 2> /dev/null");
- system("mkdir /media/sdb1 2> /dev/null");
- system("mount /media/sdb1 2> /dev/null");
+ const char hddsda1[] = "/media/sda1";
+ const char hddsdb1[] = "/media/sdb1";
+ mkdir(hddsda1, 0755);
+ mount("/dev/sda1", hddsda1, "ext3", 0, NULL);
+ mkdir(hddsdb1,0755);
+ mount("/dev/sdb1", hddsdb1, "ext3", 0, NULL);
#endif
CFSMounter::automount();
@@ -2684,9 +2698,7 @@ _repeat:
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) {
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);
- std::string command = "ether-wake ";
- command += g_settings.network_nfs_mac[i];
- if(system(command.c_str()) != 0)
+ if(my_system("ether-wake",g_settings.network_nfs_mac[i]) != 0)
perror("ether-wake failed");
break;
}
@@ -2946,8 +2958,8 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
//CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN));
my_system("/etc/init.d/rcK");
- system("/bin/sync");
- system("/bin/umount -a");
+ sync();
+ my_system("/bin/umount", "-a");
sleep(1);
{
fp_standby_data_t standby;
@@ -3024,7 +3036,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode)
delete &CMoviePlayerGui::getInstance();
shutdown_cs_api();
- system("/etc/init.d/rcK");
+ my_system("/etc/init.d/rcK");
CVFD::getInstance()->ShowIcon(FP_ICON_CAM1, true);
InfoClock->StopClock();
diff --git a/src/system/configure_network.cpp b/src/system/configure_network.cpp
index 7ba9342ec..6eaa20d54 100644
--- a/src/system/configure_network.cpp
+++ b/src/system/configure_network.cpp
@@ -27,11 +27,11 @@
#include "configure_network.h"
#include /* netGetNameserver, netSetNameserver */
#include /* getInetAttributes, setInetAttributes */
-#include /* system */
#include
#include
#include
#include
+#include
CNetworkConfig::CNetworkConfig()
{
@@ -218,11 +218,11 @@ void CNetworkConfig::commitConfig(void)
void CNetworkConfig::startNetwork(void)
{
- std::string cmd = "/sbin/ifup " + ifname;
+ const char _ifup[] = "/sbin/ifup";
#ifdef DEBUG
- printf("CNetworkConfig::startNetwork: %s\n", cmd.c_str());
+ printf("CNetworkConfig::startNetwork: %s %s\n",_ifup, ifname.c_str());
#endif
- system(cmd.c_str());
+ my_system(_ifup, ifname.c_str());
if (!inet_static) {
init_vars();
@@ -232,11 +232,11 @@ void CNetworkConfig::startNetwork(void)
void CNetworkConfig::stopNetwork(void)
{
- std::string cmd = "/sbin/ifdown " + ifname;
+ const char _ifdown[] = "/sbin/ifdown";
#ifdef DEBUG
- printf("CNetworkConfig::stopNetwork: %s\n", cmd.c_str());
+ printf("CNetworkConfig::stopNetwork: %s %s\n",_ifdown, ifname.c_str());
#endif
- system(cmd.c_str());
+ my_system(_ifdown, ifname.c_str());
}
diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp
index f5f1cdb96..a564982e6 100644
--- a/src/system/helpers.cpp
+++ b/src/system/helpers.cpp
@@ -191,17 +191,18 @@ int check_dir(const char * dir)
return ret;
}
-int get_fs_usage(const char * dir)
+bool get_fs_usage(const char * dir, long &btotal, long &bused)
{
- int ret = 0;
- long blocks_used;
+ btotal = bused = 0;
struct statfs s;
if (::statfs(dir, &s) == 0 && s.f_blocks) {
- blocks_used = s.f_blocks - s.f_bfree;
- ret = (blocks_used * 100ULL) / s.f_blocks;
+ btotal = s.f_blocks;
+ bused = s.f_blocks - s.f_bfree;
+ //printf("fs (%s): total %ld used %ld\n", dir, btotal, bused);
+ return true;
}
- return ret;
+ return false;
}
bool get_mem_usage(unsigned long &kbtotal, unsigned long &kbfree)
diff --git a/src/system/helpers.h b/src/system/helpers.h
index 7707cce05..c14938527 100644
--- a/src/system/helpers.h
+++ b/src/system/helpers.h
@@ -31,7 +31,7 @@ int safe_mkdir(char * path);
bool file_exists(const char *filename);
void wakeup_hdd(const char *hdd_dir);
int check_dir(const char * dir);
-int get_fs_usage(const char * dir);
+bool get_fs_usage(const char * dir, long &total, long &used);
bool get_mem_usage(unsigned long &total, unsigned long &free);
#endif
diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp
index 677b696f9..b93cbb0d1 100644
--- a/src/system/setting_helpers.cpp
+++ b/src/system/setting_helpers.cpp
@@ -88,43 +88,24 @@ extern cDemux *pcrDemux;
extern "C" int pinghost( const char *hostname );
-// gui/moviebrowser.cpp
-COnOffNotifier::COnOffNotifier( CMenuItem* a1,CMenuItem* a2,CMenuItem* a3,CMenuItem* a4,CMenuItem* a5)
+COnOffNotifier::COnOffNotifier(int OffValue)
{
- number = 0;
- if(a1 != NULL){ toDisable[0] =a1;number++;};
- if(a2 != NULL){ toDisable[1] =a2;number++;};
- if(a3 != NULL){ toDisable[2] =a3;number++;};
- if(a4 != NULL){ toDisable[3] =a4;number++;};
- if(a5 != NULL){ toDisable[4] =a5;number++;};
+ offValue = OffValue;
}
bool COnOffNotifier::changeNotify(const neutrino_locale_t, void *Data)
{
- if(*(int*)(Data) == 0)
- {
- for (int i=0; isetActive(false);
- }
- else
- {
- for (int i=0; isetActive(true);
- }
- return false;
+ bool active = (*(int*)(Data) != offValue);
+
+ for (std::vector::iterator it = toDisable.begin(); it != toDisable.end(); it++)
+ (*it)->setActive(active);
+
+ return false;
}
-//used in gui/miscsettings_menu.cpp
-CMiscNotifier::CMiscNotifier( CMenuItem* i1, CMenuItem* i2)
+void COnOffNotifier::addItem(CMenuItem* menuItem)
{
- toDisable[0]=i1;
- toDisable[1]=i2;
-}
-bool CMiscNotifier::changeNotify(const neutrino_locale_t, void *)
-{
- toDisable[0]->setActive(!g_settings.shutdown_real);
- toDisable[1]->setActive(!g_settings.shutdown_real);
- return false;
+ toDisable.push_back(menuItem);
}
bool CSectionsdConfigNotifier::changeNotify(const neutrino_locale_t, void *)
diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h
index a8eda16bc..22d0b27c9 100644
--- a/src/system/setting_helpers.h
+++ b/src/system/setting_helpers.h
@@ -55,22 +55,16 @@ class CGenericMenuActivate
};
class COnOffNotifier : public CChangeObserver
-{
- private:
- int number;
- CMenuItem* toDisable[5];
- public:
- COnOffNotifier (CMenuItem* a1,CMenuItem* a2 = NULL,CMenuItem* a3 = NULL,CMenuItem* a4 = NULL,CMenuItem* a5 = NULL);
- bool changeNotify(const neutrino_locale_t, void *Data);
-};
-
-class CMiscNotifier : public CChangeObserver
{
private:
- CMenuItem* toDisable[2];
+ int offValue;
+ std::vector toDisable;
+
public:
- CMiscNotifier( CMenuItem*, CMenuItem* );
- bool changeNotify(const neutrino_locale_t, void *);
+ COnOffNotifier(int OffValue = 0);
+ bool changeNotify(const neutrino_locale_t, void *Data);
+
+ void addItem(CMenuItem* menuItem);
};
class CSectionsdConfigNotifier : public CChangeObserver
diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h
index 492028124..43cce1eb0 100644
--- a/src/zapit/include/zapit/frontend_c.h
+++ b/src/zapit/include/zapit/frontend_c.h
@@ -25,6 +25,7 @@
#define __zapit_frontend_h__
#include
+#include
#include
#include
#include
@@ -78,8 +79,6 @@ static inline fe_rolloff_t dvbs_get_rolloff(fe_delivery_system_t delsys)
return ROLLOFF_35;
}
-#define MAX_LNBS 64 /* due to Diseqc 1.1 (2003-01-10 rasc) */
-
class CFEManager;
class CFrontend
@@ -87,12 +86,12 @@ class CFrontend
private:
/* frontend filedescriptor */
int fd;
+
+ OpenThreads::Mutex mutex;
/* use count for locking purposes */
int usecount;
/* current adapter where this frontend is on */
int adapter;
- /* current frontend instance */
- //static CFrontend *currentFe;
bool locked;
/* tuning finished flag */
bool tuned;
@@ -100,7 +99,6 @@ class CFrontend
struct dvb_frontend_info info;
/* current 22kHz tone mode */
fe_sec_tone_mode_t currentToneMode;
- int currentDiseqc;
fe_sec_voltage_t currentVoltage;
/* current satellite position */
int32_t currentSatellitePosition;
@@ -117,7 +115,6 @@ class CFrontend
int repeatUsals;
int feTimeout;
- int diseqc;
uint8_t uncommitedInput;
/* lnb offsets */
int32_t lnbOffsetLow;
@@ -125,15 +122,12 @@ class CFrontend
int32_t lnbSwitch;
/* current Transponderdata */
TP_params currentTransponder;
- FrontendParameters curfe;
bool slave;
int fenumber;
bool standby;
bool buildProperties(const FrontendParameters*, struct dtv_properties &);
- uint32_t getDiseqcReply(const int timeout_ms) const;
FrontendParameters getFrontend(void) const;
- void secResetOverload(void);
void secSetTone(const fe_sec_tone_mode_t mode, const uint32_t ms);
void secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms);
void sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms);
@@ -146,12 +140,13 @@ class CFrontend
void sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms);
int setFrontend(const FrontendParameters *feparams, bool nowait = false);
void setSec(const uint8_t sat_no, const uint8_t pol, const bool high_band);
- void set12V(bool enable);
void reset(void);
/* Private constructor */
CFrontend(int Number = 0, int Adapter = 0);
+ bool Open(bool init = false);
+ void Close(void);
+ void Init(void);
- //static CFrontend *getInstance(int Number = 0, int Adapter = 0);
friend class CFEManager;
public:
~CFrontend(void);
@@ -160,7 +155,7 @@ class CFrontend
uint8_t getDiseqcPosition(void) const { return currentTransponder.diseqc; }
uint8_t getDiseqcRepeats(void) const { return config.diseqcRepeats; }
diseqc_t getDiseqcType(void) const { return (diseqc_t) config.diseqcType; }
- uint32_t getFrequency(void) const { return curfe.dvb_feparams.frequency; }
+ uint32_t getFrequency(void) const { return currentTransponder.feparams.dvb_feparams.frequency; }
bool getHighBand() { return (int) getFrequency() >= lnbSwitch; }
static fe_modulation_t getModulation(const uint8_t modulation);
uint8_t getPolarization(void) const;
@@ -177,7 +172,7 @@ class CFrontend
int32_t getRotorSatellitePosition() { return rotorSatellitePosition; }
void setDiseqcRepeats(const uint8_t repeats) { config.diseqcRepeats = repeats; }
- void setDiseqcType(const diseqc_t type);
+ void setDiseqcType(const diseqc_t type, bool force = false);
void setTimeout(int timeout) { feTimeout = timeout; };
void configUsals(double Latitude, double Longitude, int LaDirection, int LoDirection, bool _repeatUsals)
{
@@ -197,7 +192,6 @@ class CFrontend
int setParameters(TP_params *TP, bool nowait = 0);
int tuneFrequency (FrontendParameters * feparams, uint8_t polarization, bool nowait = false);
const TP_params* getParameters(void) const { return ¤tTransponder; };
- struct dvb_frontend_event* setParametersResponse(TP_params *TP);
void setCurrentSatellitePosition(int32_t satellitePosition) {currentSatellitePosition = satellitePosition; }
void setRotorSatellitePosition(int32_t satellitePosition) {rotorSatellitePosition = satellitePosition; }
@@ -206,7 +200,6 @@ class CFrontend
void gotoXX(t_satellite_position pos);
bool tuneChannel(CZapitChannel *channel, bool nvod);
bool retuneChannel(void);
- bool retuneTP(bool nowait = true);
fe_code_rate_t getCFEC ();
transponder_id_t getTsidOnid() { return currentTransponder.TP_id; }
@@ -218,8 +211,6 @@ class CFrontend
void setTsidOnid(transponder_id_t newid) { currentTransponder.TP_id = newid; }
uint32_t getRate ();
- bool Open();
- void Close();
void Lock();
void Unlock();
diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp
index 26e669fc1..cabfe7127 100644
--- a/src/zapit/src/femanager.cpp
+++ b/src/zapit/src/femanager.cpp
@@ -170,8 +170,7 @@ bool CFEManager::loadSettings()
frontend_config_t & fe_config = fe->getConfig();
INFO("load config for fe%d", fe->fenumber);
- //fe_config.diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
- diseqc_t diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
+ fe_config.diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
fe_config.diseqcRepeats = getConfigValue(fe, "diseqcRepeats", 0);
fe_config.motorRotationSpeed = getConfigValue(fe, "motorRotationSpeed", 18);
fe_config.highVoltage = getConfigValue(fe, "highVoltage", 0);
@@ -181,7 +180,10 @@ bool CFEManager::loadSettings()
fe->setRotorSatellitePosition(getConfigValue(fe, "lastSatellitePosition", 0));
//fe->setDiseqcType((diseqc_t) fe_config.diseqcType);
+#if 0
+ diseqc_t diseqcType = (diseqc_t) getConfigValue(fe, "diseqcType", NO_DISEQC);
fe->setDiseqcType(diseqcType);
+#endif
char cfg_key[81];
sprintf(cfg_key, "fe%d_satellites", fe->fenumber);
@@ -265,27 +267,29 @@ void CFEManager::saveSettings(bool write)
void CFEManager::setMode(fe_mode_t newmode, bool initial)
{
- if(newmode == mode)
+ if(!initial && (newmode == mode))
return;
- if(femap.size() == 1) {
- mode = FE_MODE_SINGLE;
- return;
- }
mode = newmode;
- bool setslave = (mode == FE_MODE_LOOP);
+ if(femap.size() == 1)
+ mode = FE_MODE_SINGLE;
+
+ bool setslave = (mode == FE_MODE_LOOP) || (mode == FE_MODE_SINGLE);
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
+ CFrontend * fe = it->second;
if(it != femap.begin()) {
- CFrontend * fe = it->second;
INFO("Frontend %d as slave: %s", fe->fenumber, setslave ? "yes" : "no");
fe->setMasterSlave(setslave);
- }
+ } else
+ fe->Init();
}
+#if 0
if(setslave && !initial) {
CFrontend * fe = getFE(0);
fe->Close();
- fe->Open();
+ fe->Open(true);
}
+#endif
}
void CFEManager::Open()
@@ -293,7 +297,7 @@ void CFEManager::Open()
for(fe_map_iterator_t it = femap.begin(); it != femap.end(); it++) {
CFrontend * fe = it->second;
if(!fe->Locked())
- fe->Open();
+ fe->Open(true);
}
}
diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp
index 159f1895f..6b9088957 100644
--- a/src/zapit/src/frontend.cpp
+++ b/src/zapit/src/frontend.cpp
@@ -137,19 +137,6 @@ typedef enum dvb_fec {
#define TIME_STEP 200
#define TIMEOUT_MAX_MS (feTimeout*100)
/*********************************************************************************************************/
-#if 0
-// Global fe instance
-CFrontend *CFrontend::currentFe = NULL;
-
-CFrontend *CFrontend::getInstance(int Number, int Adapter)
-{
- if (!currentFe) {
- currentFe = new CFrontend(Number, Adapter);
- currentFe->Open();
- }
- return currentFe;
-}
-#endif
CFrontend::CFrontend(int Number, int Adapter)
{
printf("[fe%d] New frontend on adapter %d\n", Number, Adapter);
@@ -161,15 +148,10 @@ CFrontend::CFrontend(int Number, int Adapter)
locked = false;
usecount = 0;
-
- memset(&curfe, 0, sizeof(curfe));
- curfe.dvb_feparams.u.qpsk.fec_inner = FEC_3_4;
- curfe.dvb_feparams.u.qam.fec_inner = FEC_3_4;
- curfe.dvb_feparams.u.qam.modulation = QAM_64;
-
tuned = false;
uncommitedInput = 255;
- diseqc = 255;
+
+ memset(¤tTransponder, 0, sizeof(currentTransponder));
currentTransponder.polarization = 1;
currentTransponder.feparams.dvb_feparams.frequency = 0;
currentTransponder.TP_id = 0;
@@ -183,28 +165,22 @@ CFrontend::CFrontend(int Number, int Adapter)
config.motorRotationSpeed = 0; //in 0.1 degrees per second
feTimeout = 40;
- // to allow Open() switch it off
- currentVoltage = SEC_VOLTAGE_OFF; //SEC_VOLTAGE_13;
+ currentVoltage = SEC_VOLTAGE_OFF;
currentToneMode = SEC_TONE_ON;
}
CFrontend::~CFrontend(void)
{
printf("[fe%d] close frontend fd %d\n", fenumber, fd);
- if(fd >= 0) {
+ if(fd >= 0)
Close();
- close(fd);
- }
- //currentFe = NULL;
}
-bool CFrontend::Open(void)
+bool CFrontend::Open(bool init)
{
if(!standby)
return false;
- printf("[fe%d] open frontend\n", fenumber);
-
char filename[128];
snprintf(filename, sizeof(filename), "/dev/dvb/adapter%d/frontend%d", adapter, fenumber);
printf("[fe%d] open %s\n", fenumber, filename);
@@ -219,14 +195,9 @@ bool CFrontend::Open(void)
}
//FIXME info.type = FE_QAM;
- //currentVoltage = SEC_VOLTAGE_OFF;
- //secSetVoltage(SEC_VOLTAGE_OFF, 15);
- secSetVoltage(SEC_VOLTAGE_13, 15);
- secSetTone(SEC_TONE_OFF, 15);
- diseqc_t diseqcType = (diseqc_t) config.diseqcType;
- config.diseqcType = NO_DISEQC;
- setDiseqcType(diseqcType);
+ if (init)
+ Init();
currentTransponder.TP_id = 0;
@@ -235,6 +206,15 @@ bool CFrontend::Open(void)
return true;
}
+void CFrontend::Init(void)
+{
+ mutex.lock();
+ secSetVoltage(SEC_VOLTAGE_13, 100);
+ secSetTone(SEC_TONE_OFF, 15);
+ setDiseqcType((diseqc_t) config.diseqcType, true);
+ mutex.unlock();
+}
+
void CFrontend::Close(void)
{
if(standby)
@@ -261,16 +241,10 @@ void CFrontend::setMasterSlave(bool _slave)
if(_slave) {
secSetVoltage(SEC_VOLTAGE_OFF, 0);
secSetTone(SEC_TONE_OFF, 15);
- }
- slave = _slave;
- if(!slave) {
- secSetVoltage(SEC_VOLTAGE_13, 0);
-#if 1
- diseqc_t diseqcType = (diseqc_t) config.diseqcType;
- config.diseqcType = NO_DISEQC;
- setDiseqcType(diseqcType);
-#endif
}
+ slave = _slave;
+ if(!slave)
+ Init();
}
void CFrontend::reset(void)
@@ -293,11 +267,10 @@ void CFrontend::Unlock()
fe_code_rate_t CFrontend::getCFEC()
{
- if (info.type == FE_QPSK) {
- return curfe.dvb_feparams.u.qpsk.fec_inner;
- } else {
- return curfe.dvb_feparams.u.qam.fec_inner;
- }
+ if (info.type == FE_QPSK)
+ return currentTransponder.feparams.dvb_feparams.u.qpsk.fec_inner;
+ else
+ return currentTransponder.feparams.dvb_feparams.u.qam.fec_inner;
}
fe_code_rate_t CFrontend::getCodeRate(const uint8_t fec_inner, int system)
@@ -380,25 +353,19 @@ uint8_t CFrontend::getPolarization(void) const
uint32_t CFrontend::getRate()
{
- if (info.type == FE_QPSK) {
- return curfe.dvb_feparams.u.qpsk.symbol_rate;
- } else {
- return curfe.dvb_feparams.u.qam.symbol_rate;
- }
+ if (info.type == FE_QPSK)
+ return currentTransponder.feparams.dvb_feparams.u.qpsk.symbol_rate;
+ else
+ return currentTransponder.feparams.dvb_feparams.u.qam.symbol_rate;
}
fe_status_t CFrontend::getStatus(void) const
{
-#if 1 // FIXME FE_READ_STATUS works ?
struct dvb_frontend_event event;
fop(ioctl, FE_READ_STATUS, &event.status);
- //printf("CFrontend::getStatus: %x\n", event.status);
return (fe_status_t) (event.status & FE_HAS_LOCK);
-#else
- fe_status_t status = (fe_status_t) tuned;
- return status;
-#endif
}
+
#if 0
//never used
FrontendParameters CFrontend::getFrontend(void) const
@@ -406,6 +373,7 @@ FrontendParameters CFrontend::getFrontend(void) const
return currentTransponder.feparams;
}
#endif
+
uint32_t CFrontend::getBitErrorRate(void) const
{
uint32_t ber = 0;
@@ -452,12 +420,9 @@ struct dvb_frontend_event CFrontend::getEvent(void)
memset(&event, 0, sizeof(struct dvb_frontend_event));
- //printf("[fe%d] getEvent: max timeout: %d\n", fenumber, TIMEOUT_MAX_MS);
FE_TIMER_START();
- //while (msec <= TIMEOUT_MAX_MS ) {
while ((int) timer_msec < TIMEOUT_MAX_MS) {
- //int ret = poll(&pfd, 1, TIME_STEP);
int ret = poll(&pfd, 1, TIMEOUT_MAX_MS - timer_msec);
if (ret < 0) {
perror("CFrontend::getEvent poll");
@@ -472,7 +437,6 @@ struct dvb_frontend_event CFrontend::getEvent(void)
FE_TIMER_STOP("poll has event after");
memset(&event, 0, sizeof(struct dvb_frontend_event));
- //fop(ioctl, FE_READ_STATUS, &event.status);
ret = ioctl(fd, FE_GET_EVENT, &event);
if (ret < 0) {
perror("CFrontend::getEvent ioctl");
@@ -746,7 +710,7 @@ bool CFrontend::buildProperties(const FrontendParameters *feparams, struct dtv_p
return true;
}
-int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
+int CFrontend::setFrontend(const FrontendParameters *feparams, bool nowait)
{
struct dtv_property cmdargs[FE_COMMON_PROPS + FE_DVBS2_PROPS]; // WARNING: increase when needed more space
struct dtv_properties cmdseq;
@@ -756,7 +720,6 @@ int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
tuned = false;
- //printf("[fe%d] DEMOD: FEC %s system %s modulation %s pilot %s\n", fenumber, f, s, m, pilot == PILOT_ON ? "on" : "off");
struct dvb_frontend_event ev;
{
// Erase previous events
@@ -767,7 +730,6 @@ int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
}
}
- //printf("[fe%d] DEMOD: FEC %s system %s modulation %s pilot %s, freq %d\n", fenumber, f, s, m, pilot == PILOT_ON ? "on" : "off", p->props[FREQUENCY].u.data);
if (!buildProperties(feparams, cmdseq))
return 0;
@@ -780,6 +742,8 @@ int CFrontend::setFrontend(const FrontendParameters *feparams, bool /*nowait*/)
}
FE_TIMER_STOP("FE_SET_PROPERTY took");
}
+ if (nowait)
+ return 0;
{
FE_TIMER_INIT();
FE_TIMER_START();
@@ -832,12 +796,6 @@ void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
return;
printf("[fe%d] voltage %s\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18");
- //printf("[fe%d] voltage %s high %d\n", fenumber, voltage == SEC_VOLTAGE_OFF ? "OFF" : voltage == SEC_VOLTAGE_13 ? "13" : "18", config.highVoltage);
- //int val = config.highVoltage;
- //fop(ioctl, FE_ENABLE_HIGH_LNB_VOLTAGE, val);
-
- //FE_TIMER_INIT();
- //FE_TIMER_START();
if (config.uni_scr >= 0) {
/* see my comment in secSetTone... */
currentVoltage = voltage; /* need to know polarization for unicable */
@@ -847,34 +805,23 @@ void CFrontend::secSetVoltage(const fe_sec_voltage_t voltage, const uint32_t ms)
if (fop(ioctl, FE_SET_VOLTAGE, voltage) == 0) {
currentVoltage = voltage;
- //FE_TIMER_STOP("[frontend] FE_SET_VOLTAGE took");
- usleep(1000 * ms); // FIXME : is needed ?
+ usleep(1000 * ms);
}
}
-#if 0
-//never used
-void CFrontend::secResetOverload(void)
-{
-}
-#endif
+
void CFrontend::sendDiseqcCommand(const struct dvb_diseqc_master_cmd *cmd, const uint32_t ms)
{
+ if (slave || info.type != FE_QPSK)
+ return;
+
printf("[fe%d] Diseqc cmd: ", fenumber);
for (int i = 0; i < cmd->msg_len; i++)
printf("0x%X ", cmd->msg[i]);
printf("\n");
- if (slave || info.type != FE_QPSK)
- return;
if (fop(ioctl, FE_DISEQC_SEND_MASTER_CMD, cmd) == 0)
usleep(1000 * ms);
}
-#if 0
-//never used
-uint32_t CFrontend::getDiseqcReply(const int /*timeout_ms*/) const
-{
- return 0;
-}
-#endif
+
void CFrontend::sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms)
{
if (slave || info.type != FE_QPSK)
@@ -883,7 +830,7 @@ void CFrontend::sendToneBurst(const fe_sec_mini_cmd_t burst, const uint32_t ms)
usleep(1000 * ms);
}
-void CFrontend::setDiseqcType(const diseqc_t newDiseqcType)
+void CFrontend::setDiseqcType(const diseqc_t newDiseqcType, bool force)
{
switch (newDiseqcType) {
case NO_DISEQC:
@@ -923,19 +870,13 @@ void CFrontend::setDiseqcType(const diseqc_t newDiseqcType)
return;
}
-#if 0
- if (!slave && (config.diseqcType <= MINI_DISEQC)
- && (newDiseqcType > MINI_DISEQC)) {
+ if (force || ((config.diseqcType <= MINI_DISEQC)
+ && (newDiseqcType > MINI_DISEQC))) {
+ secSetTone(SEC_TONE_OFF, 15);
sendDiseqcPowerOn();
sendDiseqcReset();
+ secSetTone(SEC_TONE_ON, 20);
}
-#else
-
- if (config.diseqcType != newDiseqcType) {
- sendDiseqcPowerOn();
- sendDiseqcReset();
- }
-#endif
config.diseqcType = newDiseqcType;
}
@@ -966,8 +907,8 @@ void CFrontend::sendMotorCommand(uint8_t cmdtype, uint8_t address, uint8_t comma
cmd.msg_len = 3 + num_parameters;
//secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
- secSetVoltage(SEC_VOLTAGE_13, 15);
secSetTone(SEC_TONE_OFF, 15);
+ secSetVoltage(SEC_VOLTAGE_13, 100);
for(i = 0; i <= repeat; i++)
sendDiseqcCommand(&cmd, 50);
@@ -985,12 +926,12 @@ void CFrontend::positionMotor(uint8_t motorPosition)
};
if (motorPosition != 0) {
- secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
secSetTone(SEC_TONE_OFF, 25);
+ secSetVoltage(config.highVoltage ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13, 15);
cmd.msg[3] = motorPosition;
for (int i = 0; i <= repeatUsals; ++i)
- sendDiseqcCommand(&cmd, 50);
+ sendDiseqcCommand(&cmd, 50);
printf("[fe%d] motor positioning command sent.\n", fenumber);
}
@@ -999,12 +940,10 @@ void CFrontend::positionMotor(uint8_t motorPosition)
bool CFrontend::setInput(CZapitChannel * channel, bool nvod)
{
transponder_list_t::iterator tpI;
- //transponder_id_t ct = channel->getTransponderId();
transponder_id_t ct = nvod ? (channel->getTransponderId() & 0xFFFFFFFFULL) : channel->getTransponderId();
transponder_id_t current_id = nvod ? (currentTransponder.TP_id & 0xFFFFFFFFULL) : currentTransponder.TP_id;
//printf("CFrontend::setInput tuned %d nvod %d current_id %llx new %llx\n\n", tuned, nvod, current_id, ct);
- //if (tuned && (ct == currentTransponder.TP_id))
if (tuned && (ct == current_id))
return false;
@@ -1022,6 +961,7 @@ bool CFrontend::setInput(CZapitChannel * channel, bool nvod)
}
currentTransponder.TP_id = tpI->first;
+ currentTransponder.polarization = tpI->second.polarization;
currentSatellitePosition = channel->getSatellitePosition();
setInput(channel->getSatellitePosition(), tpI->second.feparams.dvb_feparams.frequency, tpI->second.polarization);
@@ -1032,11 +972,7 @@ void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t freque
{
sat_iterator_t sit = satellites.find(satellitePosition);
-#if 0
- printf("[fe%d] setInput: SatellitePosition %d -> %d\n", fenumber, currentSatellitePosition, satellitePosition);
- if (currentSatellitePosition != satellitePosition)
-#endif
- setLnbOffsets(sit->second.lnbOffsetLow, sit->second.lnbOffsetHigh, sit->second.lnbSwitch);
+ setLnbOffsets(sit->second.lnbOffsetLow, sit->second.lnbOffsetHigh, sit->second.lnbSwitch);
if (config.diseqcType != DISEQC_ADVANCED) {
setDiseqc(sit->second.diseqc, polarization, frequency);
return;
@@ -1047,7 +983,7 @@ void CFrontend::setInput(t_satellite_position satellitePosition, uint32_t freque
sendUncommittedSwitchesCommand(sit->second.uncommited);
} else {
if (sendUncommittedSwitchesCommand(sit->second.uncommited))
- diseqc = -1;
+ currentTransponder.diseqc = -1;
setDiseqcSimple(sit->second.commited, polarization, frequency);
}
}
@@ -1092,49 +1028,42 @@ uint32_t CFrontend::sendEN50494TuningCommand(const uint32_t frequency, const int
bool CFrontend::tuneChannel(CZapitChannel * /*channel*/, bool /*nvod*/)
{
-//printf("tuneChannel: tpid %llx\n", currentTransponder.TP_id);
transponder_list_t::iterator transponder = transponders.find(currentTransponder.TP_id);
if (transponder == transponders.end())
return false;
return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, false);
}
-#if 0
-//never used
-bool CFrontend::retuneTP(bool nowait)
-{
- /* used in pip only atm */
- tuneFrequency(&curfe, currentTransponder.polarization, nowait);
- return 0;
-}
bool CFrontend::retuneChannel(void)
{
- setFrontend(¤tTransponder.feparams);
- return 0;
+ mutex.lock();
+ setInput(currentSatellitePosition, currentTransponder.feparams.dvb_feparams.frequency, currentTransponder.polarization);
+ transponder_list_t::iterator transponder = transponders.find(currentTransponder.TP_id);
+ if (transponder == transponders.end())
+ return false;
+ mutex.unlock();
+ return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, true);
}
-#endif
+
int CFrontend::tuneFrequency(FrontendParameters * feparams, uint8_t polarization, bool nowait)
{
TP_params TP;
- //printf("[fe%d] tune to frequency %d pol %s srate %d\n", fenumber, feparams->dvb_feparams.frequency, polarization ? "Vertical/Right" : "Horizontal/Left", feparams->dvb_feparams.u.qpsk.symbol_rate);
- memmove(&curfe, feparams, sizeof(struct dvb_frontend_parameters));
+ memmove(¤tTransponder.feparams, feparams, sizeof(struct dvb_frontend_parameters));
memmove(&TP.feparams, feparams, sizeof(struct dvb_frontend_parameters));
TP.polarization = polarization;
return setParameters(&TP, nowait);
}
-int CFrontend::setParameters(TP_params *TP, bool /*nowait*/)
+int CFrontend::setParameters(TP_params *TP, bool nowait)
{
int freq_offset = 0, freq;
- TP_params currTP;
- FrontendParameters *feparams;
+ FrontendParameters feparams;
/* Copy the data for local use */
- currTP = *TP;
- feparams = &currTP.feparams;
- freq = (int) feparams->dvb_feparams.frequency;
+ memcpy(&feparams, &TP->feparams, sizeof(feparams));
+ freq = (int) feparams.dvb_feparams.frequency;
char * f, *s, *m;
if (info.type == FE_QPSK) {
@@ -1148,49 +1077,18 @@ int CFrontend::setParameters(TP_params *TP, bool /*nowait*/)
freq_offset = lnbOffsetHigh;
}
- feparams->dvb_feparams.frequency = abs(freq - freq_offset);
+ feparams.dvb_feparams.frequency = abs(freq - freq_offset);
setSec(TP->diseqc, TP->polarization, high_band);
- getDelSys(feparams->dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams->dvb_feparams.u.qpsk.fec_inner), f, s, m);
+ getDelSys(feparams.dvb_feparams.u.qpsk.fec_inner, dvbs_get_modulation(feparams.dvb_feparams.u.qpsk.fec_inner), f, s, m);
} else if (info.type == FE_QAM) {
if (freq < 1000*1000)
- feparams->dvb_feparams.frequency = freq * 1000;
- getDelSys(feparams->dvb_feparams.u.qam.fec_inner,feparams->dvb_feparams.u.qam.modulation, f, s, m);
-#if 0
- switch (TP->feparams.dvb_feparams.inversion) {
- case INVERSION_OFF:
- TP->feparams.dvb_feparams.inversion = INVERSION_ON;
- break;
- case INVERSION_ON:
- default:
- TP->feparams.dvb_feparams.inversion = INVERSION_OFF;
- break;
- }
-#endif
+ feparams.dvb_feparams.frequency = freq * 1000;
+ getDelSys(feparams.dvb_feparams.u.qam.fec_inner, feparams.dvb_feparams.u.qam.modulation, f, s, m);
}
- //printf("[fe%d] tuner to frequency %d (offset %d timeout %d)\n", fenumber, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
- //printf("[fe%d] tune to frequency %d (tuner %d offset %d timeout %d)\n", fenumber, freq, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
printf("[fe%d] tune to %d %s %s %s %s srate %d (tuner %d offset %d timeout %d)\n", fenumber, freq, s, m, f,
- TP->polarization & 1 ? "V/R" : "H/L", feparams->dvb_feparams.u.qpsk.symbol_rate, feparams->dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
- setFrontend(feparams);
-
-#if 0
- if (tuned) {
- ret = diff(event.parameters.frequency, TP->feparams.dvb_feparams.frequency);
- /* if everything went ok, then it is a good idea to copy the real
- * frontend parameters, so we can update the service list, if it differs.
- * TODO: set a flag to indicate a change in the service list */
- memmove(¤tTransponder.feparams, &event.parameters, sizeof(struct dvb_frontend_parameters));
- }
-#endif
-
-#if 0
- /* add the frequency offset to the frontend parameters again
- * because they are used for the channel list and were given
- * to this method as a pointer */
- if (info.type == FE_QPSK)
- TP->feparams.dvb_feparams.frequency += freq_offset;
-#endif
+ TP->polarization & 1 ? "V/R" : "H/L", feparams.dvb_feparams.u.qpsk.symbol_rate, feparams.dvb_feparams.frequency, freq_offset, TIMEOUT_MAX_MS);
+ setFrontend(&feparams, nowait);
return tuned;
}
@@ -1216,7 +1114,6 @@ bool CFrontend::sendUncommittedSwitchesCommand(int input)
/* off = low band, on - hi band , vertical 13v, horizontal 18v */
bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t frequency)
{
- //for monoblock
fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
//fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A;
bool high_band = ((int)frequency >= lnbSwitch);
@@ -1225,20 +1122,15 @@ bool CFrontend::setDiseqcSimple(int sat_no, const uint8_t pol, const uint32_t fr
{0xe0, 0x10, 0x38, 0x00, 0x00, 0x00}, 4
};
- INFO("[fe%d] diseqc input %d -> %d", fenumber, diseqc, sat_no);
+ INFO("[fe%d] diseqc input %d -> %d", fenumber, currentTransponder.diseqc, sat_no);
currentTransponder.diseqc = sat_no;
if (slave)
return true;
- if ((sat_no >= 0) && (diseqc != sat_no)) {
- diseqc = sat_no;
- printf("[fe%d] diseqc no. %d\n", fenumber, sat_no);
-
+ if ((sat_no >= 0) /* && (diseqc != sat_no)*/) {
cmd.msg[3] = 0xf0 | (((sat_no * 4) & 0x0f) | (high_band ? 1 : 0) | ((pol & 1) ? 0 : 2));
- //for monoblock - needed ??
- secSetVoltage(v, 15);
- //secSetVoltage(SEC_VOLTAGE_13, 15);//FIXME for test
secSetTone(SEC_TONE_OFF, 20);
+ secSetVoltage(v, 100);
sendDiseqcCommand(&cmd, 100);
return true;
@@ -1259,21 +1151,23 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
uint8_t loop;
bool high_band = ((int)frequency >= lnbSwitch);
struct dvb_diseqc_master_cmd cmd = { {0xE0, 0x10, 0x38, 0xF0, 0x00, 0x00}, 4 };
- //fe_sec_voltage_t polarity = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
- //fe_sec_tone_mode_t tone = high_band ? SEC_TONE_ON : SEC_TONE_OFF;//seems needed?
fe_sec_mini_cmd_t b = (sat_no & 1) ? SEC_MINI_B : SEC_MINI_A;
int delay = 0;
- printf("[fe%d] diseqc input %d -> %d\n", fenumber, diseqc, sat_no);
+ if ((config.diseqcType == NO_DISEQC) || sat_no < 0)
+ return;
+
+ printf("[fe%d] diseqc input %d -> %d\n", fenumber, currentTransponder.diseqc, sat_no);
+ currentTransponder.diseqc = sat_no;
if (slave)
return;
- //secSetVoltage(polarity, 15); /* first of all set the "polarization" */
- //secSetTone(tone, 1); /* set the "band" */
-
- //secSetVoltage(SEC_VOLTAGE_13, 15);//FIXME for test
secSetTone(SEC_TONE_OFF, 20);
-
+#if 1
+ fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
+ secSetVoltage(v, 100);
+#endif
+ sendDiseqcReset();
for (loop = 0; loop <= config.diseqcRepeats; loop++) {
//usleep(50*1000); /* sleep at least 50 milli seconds */
@@ -1316,13 +1210,6 @@ void CFrontend::setDiseqc(int sat_no, const uint8_t pol, const uint32_t frequenc
if (config.diseqcType == SMATV_REMOTE_TUNING)
sendDiseqcSmatvRemoteTuningCommand(frequency);
-
-#if 0 // setSec do this, when tune called
- if (high_band)
- secSetTone(SEC_TONE_ON, 20);
-#endif
- //secSetTone(tone, 20);
- currentTransponder.diseqc = sat_no;
}
void CFrontend::setSec(const uint8_t /*sat_no*/, const uint8_t pol, const bool high_band)
@@ -1330,33 +1217,29 @@ void CFrontend::setSec(const uint8_t /*sat_no*/, const uint8_t pol, const bool h
fe_sec_voltage_t v = (pol & 1) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
fe_sec_tone_mode_t t = high_band ? SEC_TONE_ON : SEC_TONE_OFF;
- secSetVoltage(v, 15);
+ currentTransponder.polarization = pol;
secSetTone(t, 15);
- currentTransponder.polarization = pol;// & 1;
+ secSetVoltage(v, 100);
}
void CFrontend::sendDiseqcPowerOn(void)
{
// FIXME power on can take a while. Should be wait
// more time here ? 15 ms enough for some switches ?
-#if 1
printf("[fe%d] diseqc power on\n", fenumber);
sendDiseqcZeroByteCommand(0xe0, 0x10, 0x03);
-#else
- struct dvb_diseqc_master_cmd cmd = {
- {0xE0, 0x10, 0x03, 0x00, 0x00, 0x00}, 3
- };
- sendDiseqcCommand(&cmd, 100);
-#endif
}
void CFrontend::sendDiseqcReset(void)
{
printf("[fe%d] diseqc reset\n", fenumber);
+#if 0
/* Reset && Clear Reset */
sendDiseqcZeroByteCommand(0xe0, 0x10, 0x00);
sendDiseqcZeroByteCommand(0xe0, 0x10, 0x01);
- //sendDiseqcZeroByteCommand(0xe0, 0x00, 0x00); // enigma
+#else
+ sendDiseqcZeroByteCommand(0xe0, 0x00, 0x00); // enigma
+#endif
}
void CFrontend::sendDiseqcStandby(void)
@@ -1402,7 +1285,6 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
//if(config.diseqcType == DISEQC_ADVANCED) //FIXME testing
{
- //printf("[fe%d] SatellitePosition %d -> %d\n", fenumber, rotorSatellitePosition, satellitePosition);
bool moved = false;
sat_iterator_t sit = satellites.find(satellitePosition);
@@ -1417,7 +1299,6 @@ int CFrontend::driveToSatellitePosition(t_satellite_position satellitePosition,
if (sit != satellites.end())
old_position = sit->second.motor_position;
- //printf("[fe%d] motorPosition %d -> %d usals %s\n", fenumber, old_position, new_position, use_usals ? "on" : "off");
printf("[fe%d] sat pos %d -> %d motor pos %d -> %d usals %s\n", fenumber, rotorSatellitePosition, satellitePosition, old_position, new_position, use_usals ? "on" : "off");
if (rotorSatellitePosition == satellitePosition)
diff --git a/src/zapit/src/scannit.cpp b/src/zapit/src/scannit.cpp
index 762960867..756750c84 100644
--- a/src/zapit/src/scannit.cpp
+++ b/src/zapit/src/scannit.cpp
@@ -293,12 +293,17 @@ bool CNit::ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, Tran
newSat += ((sd->getOrbitalPosition() >> 8) & 0xF) * 100;
newSat += ((sd->getOrbitalPosition() >> 4) & 0xF) * 10;
newSat += ((sd->getOrbitalPosition()) & 0xF);
- if (newSat && (!sd->getWestEastFlag()))
+
+ if (newSat > 1800)
newSat = 3600 - newSat;
+ if (!sd->getWestEastFlag())
+ newSat = -newSat;
+ if (abs(newSat - satellitePosition) < 5)
+ newSat = satellitePosition;
if(satellitePosition != newSat) {
- printf("NIT: different satellite position: our %d nit %d\n",
- satellitePosition, sd->getOrbitalPosition());
+ printf("NIT: different satellite position: our %d nit %d (%X)\n",
+ satellitePosition, newSat, sd->getOrbitalPosition());
return false;
}
@@ -320,7 +325,7 @@ bool CNit::ParseSatelliteDescriptor(SatelliteDeliverySystemDescriptor * sd, Tran
break;
default:
#ifdef DEBUG_NIT
- printf("NIT: undefined modulation system %08x\n", modulation_system;
+ printf("NIT: undefined modulation system %08x\n", modulation_system);
#endif
feparams.delsys = SYS_UNDEFINED;
break;
diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp
index 5b02a78f6..8c7f49a22 100644
--- a/src/zapit/src/zapit.cpp
+++ b/src/zapit/src/zapit.cpp
@@ -2140,10 +2140,6 @@ static bool zapit_parse_command(CBasicMessage::Header &rmsg, int connfd)
void CZapit::run()
{
-#if 0
- time_t stime = time(0);
- time_t curtime;
-#endif
printf("[zapit] starting... tid %ld\n", syscall(__NR_gettid));
abort_zapit = 0;
@@ -2192,14 +2188,15 @@ void CZapit::run()
/* yuck, don't waste that much cpu time :) */
usleep(0);
#if 0
- if(!standby && !CServiceScan::getInstance()->Scanning() &¤t_channel) {
- curtime = time(0);
+ static time_t stime = time(0);
+ if(!standby && !CServiceScan::getInstance()->Scanning() && current_channel) {
+ time_t curtime = time(0);
+ //FIXME check if sig_delay needed */
if(sig_delay && (curtime - stime) > sig_delay) {
stime = curtime;
- uint16_t sig = live_fe->getSignalStrength();
- //if(sig < 8000)
- if(sig < 28000) {
- printf("[monitor] signal %d, trying to re-tune...\n", sig);
+ fe_status_t status = live_fe->getStatus();
+ printf("[zapit] frontend status %d\n", status);
+ if (status != FE_HAS_LOCK) {
live_fe->retuneChannel();
}
}