]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
capmt: fix problems with capmt not being properly enabled
authorAdam Sutton <dev@adamsutton.me.uk>
Wed, 11 Sep 2013 20:04:30 +0000 (21:04 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Wed, 11 Sep 2013 20:04:30 +0000 (21:04 +0100)
This was due to failure to properly reported which adapters have
been enabled. There are other problems with the capmt setup code
that really need addressing, but I don't have the time right now!

src/descrambler/capmt.c
src/input/mpegts/linuxdvb/linuxdvb_adapter.c

index 982379400e0e4e255524707a283ce7aca0848493..e7c175f07cc3233270413e446b3a1cd1c4688276 100644 (file)
@@ -530,7 +530,7 @@ capmt_create_udp_socket(int *socket, int port)
 
   if (bind(*socket, (const struct sockaddr*)&serv_addr, sizeof(serv_addr)) != 0)
   {
-    perror("[CapmtServer] ERROR binding to ca0");
+    tvherror("capmt", "failed to bind to ca0 (port %d)", port);
     return 0;
   }
   else
index b2fadf60bc890c6848bcb0237d16b9dc95f93ade..9b0e60c05abd8095caa72015eeed3d29ec58a8bd 100644 (file)
@@ -104,6 +104,21 @@ linuxdvb_adapter_current_weight ( linuxdvb_adapter_t *la )
   return 0;
 }
 
+/*
+ * Enabled
+ */
+static int
+linuxdvb_adapter_is_enabled ( mpegts_input_t *mi )
+{
+  linuxdvb_adapter_t *la = (linuxdvb_adapter_t*)mi;
+  linuxdvb_hardware_t *lh;
+
+  LIST_FOREACH(lh, &la->lh_children, lh_parent_link)
+    if (lh->mi_is_enabled && lh->mi_is_enabled((mpegts_input_t*)lh))
+      return 1;
+  return 0;
+}
+
 /*
  * Create
  */
@@ -124,8 +139,9 @@ linuxdvb_adapter_create0
   }
 
   LIST_INSERT_HEAD(&ld->lh_children, (linuxdvb_hardware_t*)la, lh_parent_link);
-  la->lh_parent  = (linuxdvb_hardware_t*)ld;
-  la->mi_enabled = 1;
+  la->lh_parent     = (linuxdvb_hardware_t*)ld;
+  la->mi_is_enabled = linuxdvb_adapter_is_enabled;
+  la->mi_enabled    = 1;
 
   /* No conf */
   if (!conf)