frontend.cpp: Use old code detection when DTV_ENUM_DELSYS ioctl fails
authorAthanasios Oikonomou <athoik@gmail.com>
Sun, 7 Dec 2014 17:32:19 +0000 (19:32 +0200)
committerErik Slagter <erik@openpli.org>
Sun, 7 Dec 2014 18:03:35 +0000 (19:03 +0100)
Using the latest linux-libc-headers the DTV_ENUM_DELSYS is defined
so it fails to properly identify supportsDeliverySystem.

Instead check if DTV_ENUM_DELSYS ioctl returns Invalid Argument (EINVAL)
and use old code detection.

Also print a debug message when unknown error occurs.

Signed-off-by: Erik Slagter <erik@openpli.org>

lib/dvb/frontend.cpp

index a838ee0..9668634 100644 (file)
@@ -528,7 +528,6 @@ int eDVBFrontend::openFrontend()
                        }
                        strncpy(m_description, fe_info.name, sizeof(m_description));
 
-#ifdef DTV_ENUM_DELSYS
                        struct dtv_property p[1];
                        p[0].cmd = DTV_ENUM_DELSYS;
                        struct dtv_properties cmdseq;
@@ -543,41 +542,46 @@ int eDVBFrontend::openFrontend()
                                        m_delsys[delsys] = true;
                                }
                        }
-#else
-                       /* old DVB API, fill delsys map with some defaults */
-                       switch (fe_info.type)
+                       else if (errno == EINVAL)
                        {
-                               case FE_QPSK:
+                               /* old DVB API, fill delsys map with some defaults */
+                               switch (fe_info.type)
                                {
-                                       m_delsys[SYS_DVBS] = true;
+                                       case FE_QPSK:
+                                       {
+                                               m_delsys[SYS_DVBS] = true;
 #if DVB_API_VERSION >= 5
-                                       if (fe_info.caps & FE_CAN_2G_MODULATION) m_delsys[SYS_DVBS2] = true;
+                                               if (fe_info.caps & FE_CAN_2G_MODULATION) m_delsys[SYS_DVBS2] = true;
 #endif
-                                       break;
-                               }
-                               case FE_QAM:
-                               {
+                                               break;
+                                       }
+                                       case FE_QAM:
+                                       {
 #if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 6
-                                       m_delsys[SYS_DVBC_ANNEX_A] = true;
+                                               m_delsys[SYS_DVBC_ANNEX_A] = true;
 #else
-                                       m_delsys[SYS_DVBC_ANNEX_AC] = true;
+                                               m_delsys[SYS_DVBC_ANNEX_AC] = true;
 #endif
-                                       break;
-                               }
-                               case FE_OFDM:
-                               {
-                                       m_delsys[SYS_DVBT] = true;
+                                               break;
+                                       }
+                                       case FE_OFDM:
+                                       {
+                                               m_delsys[SYS_DVBT] = true;
 #if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 3
-                                       if (fe_info.caps & FE_CAN_2G_MODULATION) m_delsys[SYS_DVBT2] = true;
+                                               if (fe_info.caps & FE_CAN_2G_MODULATION) m_delsys[SYS_DVBT2] = true;
 #endif
-                                       break;
-                               }
-                               case FE_ATSC:   // placeholder to prevent warning
-                               {
-                                       break;
+                                               break;
+                                       }
+                                       case FE_ATSC:   // placeholder to prevent warning
+                                       {
+                                               break;
+                                       }
                                }
                        }
-#endif
+                       else
+                       {
+                               eDebug("FE_GET_PROPERTY DTV_ENUM_DELSYS failed (%m)");
+                       }
                }
 
                if (m_simulate_fe)