[vlc-commits] Linux DVB: show libvlc and kernel API versions in debug

Rémi Denis-Courmont git at videolan.org
Sun Mar 11 18:21:04 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar 11 18:55:37 2012 +0200| [0c9d696d4d2224a35b7e85c366e361a126352ce3] | committer: Rémi Denis-Courmont

Linux DVB: show libvlc and kernel API versions in debug

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0c9d696d4d2224a35b7e85c366e361a126352ce3
---

 modules/access/dtv/linux.c |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/modules/access/dtv/linux.c b/modules/access/dtv/linux.c
index 70ee4b0..2a07d62 100644
--- a/modules/access/dtv/linux.c
+++ b/modules/access/dtv/linux.c
@@ -435,12 +435,13 @@ void dvb_remove_pid (dvb_device_t *d, uint16_t pid)
 static unsigned dvb_probe_frontend (dvb_device_t *d, int fd)
 {
 #if DVBv5(5)
-    struct dtv_property prop = {
-        .cmd = DTV_ENUM_DELSYS
+    struct dtv_property prop[2] = {
+        { .cmd = DTV_API_VERSION },
+        { .cmd = DTV_ENUM_DELSYS },
     };
     struct dtv_properties props = {
-        .num = 1,
-        .props = &prop
+        .num = 2,
+        .props = prop
     };
 
     if (ioctl (fd, FE_GET_PROPERTY, &props) < 0)
@@ -472,11 +473,13 @@ static unsigned dvb_probe_frontend (dvb_device_t *d, int fd)
     };
     unsigned systems = 0;
 
-    msg_Dbg (d->obj, "probing frontend");
+    msg_Dbg (d->obj, "probing frontend (kernel API v%u.%u, user API v%u.%u)",
+             prop[0].u.data >> 8, prop[0].u.data & 0xFF,
+             DVB_API_VERSION, DVB_API_VERSION_MINOR);
 
-    for (size_t i = 0; i < prop.u.buffer.len; i++)
+    for (size_t i = 0; i < prop[1].u.buffer.len; i++)
     {
-        unsigned sys = prop.u.buffer.data[i];
+        unsigned sys = prop[1].u.buffer.data[i];
 
         if (sys >= (sizeof (systab) / sizeof (systab[0])) || !systab[sys])
         {
@@ -487,15 +490,30 @@ static unsigned dvb_probe_frontend (dvb_device_t *d, int fd)
         systems |= systab[sys];
     }
 #else
-    struct dvb_frontend_info info;
+    struct dtv_property prop[1] = {
+        { .cmd = DTV_API_VERSION },
+    };
+    struct dtv_properties props = {
+        .num = 1,
+        .props = prop
+    };
 
+    if (ioctl (fd, FE_GET_PROPERTY, &props) < 0)
+    {
+        msg_Err (d->obj, "unsupported kernel DVB version 3 or older (%m)");
+        return 0;
+    }
+
+    msg_Dbg (d->obj, "probing frontend (kernel API v%u.%u, user API v%u.%u)",
+             prop[0].u.data >> 8, prop[0].u.data & 0xFF,
+             DVB_API_VERSION, DVB_API_VERSION_MINOR);
+    struct dvb_frontend_info info;
     if (ioctl (fd, FE_GET_INFO, &info) < 0)
     {
         msg_Err (d->obj, "cannot get frontend info: %m");
         return 0;
     }
-
-    msg_Dbg (d->obj, "probing frontend: %s", info.name);
+    msg_Dbg (d->obj, " name %s", info.name);
     msg_Dbg (d->obj, " type %u, capabilities 0x%08X", info.type, info.caps);
     msg_Dbg (d->obj, " frequencies %10"PRIu32" to %10"PRIu32,
              info.frequency_min, info.frequency_max);



More information about the vlc-commits mailing list