small fixes for loopthrough
[enigma2.git] / lib / dvb / frontend.cpp
index 8bfe48583ae12642c853bfdade8137b813f7ee18..bfbd9b57934ee89dc89c9febcf5ab079b05c5449 100644 (file)
@@ -1276,14 +1276,15 @@ void eDVBFrontend::getTransponderData(ePyObject dest, bool original)
                        case feTerrestrial:
                        {
                                FRONTENDPARAMETERS front;
                        case feTerrestrial:
                        {
                                FRONTENDPARAMETERS front;
-                               if (!original)
+                               if (m_fd == -1 && !original)
+                                       original = true;
+                               else if (ioctl(m_fd, FE_GET_FRONTEND, &front)<0)
                                {
                                {
-                                       if (!m_simulate && m_fd != -1 && ioctl(m_fd, FE_GET_FRONTEND, &front)<0)
-                                               eDebug("FE_GET_FRONTEND (%m)");
+                                       eDebug("FE_GET_FRONTEND failed (%m)");
+                                       original = true;
                                }
                                }
-                               else
                                {
                                {
-                                       const FRONTENDPARAMETERS &parm = original ? this->parm : front;
+                                       const FRONTENDPARAMETERS &parm = original || m_simulate ? this->parm : front;
                                        const char *tmp = "INVERSION_AUTO";
                                        switch(parm_inversion)
                                        {
                                        const char *tmp = "INVERSION_AUTO";
                                        switch(parm_inversion)
                                        {
@@ -1417,11 +1418,13 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                tmp = prev->m_frontend->m_data[LINKED_PREV_PTR];
                if (tmp == -1 && sec_fe != this && !prev->m_inuse) {
                        int state = sec_fe->m_state;
                tmp = prev->m_frontend->m_data[LINKED_PREV_PTR];
                if (tmp == -1 && sec_fe != this && !prev->m_inuse) {
                        int state = sec_fe->m_state;
+                       // workaround to put the kernel frontend thread into idle state!
                        if (state != eDVBFrontend::stateIdle && state != stateClosed)
                        {
                                sec_fe->closeFrontend(true);
                                state = sec_fe->m_state;
                        }
                        if (state != eDVBFrontend::stateIdle && state != stateClosed)
                        {
                                sec_fe->closeFrontend(true);
                                state = sec_fe->m_state;
                        }
+                       // sec_fe is closed... we must reopen it here..
                        if (state == eDVBFrontend::stateClosed)
                        {
                                regFE = prev;
                        if (state == eDVBFrontend::stateClosed)
                        {
                                regFE = prev;