[dvblast-devel] [PATCH] Add CA device addressing

Honza Petrouš jpetrous at gmail.com
Tue Oct 9 20:27:35 CEST 2012


> Thanks, you need to update dvblast.1 file with the new option, also remove
> "y" from the free flags (there is a comment in dvblast.c that lists them).
> NEWS entry would also be welcome.

Fixed:

Add CA device addressing

Some devices has special meaning for /dev/dvb/adapterX/caY
CA device (like fixed TS port input or so). To allow to use
other then /dev/dvb/adapterX/ca0 device there, the command
line option -y or --ca-number were added.

Signed-off-by: Honza Petrous <jpetrous at smartimp.cz>
---

diff --git a/NEWS b/NEWS
index dda0a5f..4b46d02 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Changes between 2.2 and 2.3:
   * Added support for building DVBlast on OS X.
   * Added support for uncommitted diseqc switches.
   * Fixed ECM pid selection.
+  * Added CA device addressing

 Changes between 2.1 and 2.2:
 ----------------------------
diff --git a/dvblast.1 b/dvblast.1
index 1ed569c..36ada8a 100644
--- a/dvblast.1
+++ b/dvblast.1
@@ -4,7 +4,7 @@ DVBlast \- Simple and powerful dvb streaming application
 .SH SYNOPSIS
 .B dvblast
 [\fI-q\fR] [\fI-c <config_file>\fR] [\fI-r <remote_socket>\fR] [\fI-t
<ttl>\fR] [\fI-o <SSRC_IP>\fR]
-[\fI-i <RT_priority>\fR] [\fI-a <adapter>\fR] [\fI-n
<frontend_number>\fR] [\fI-S <diseqc>\fR] [\fI-k <uncommitted
port>\fR]
+[\fI-i <RT_priority>\fR] [\fI-a <adapter>\fR] [\fI-n
<frontend_number>\fR] [\fI-y <ca_number>\fR] [\fI-S <diseqc>\fR]
[\fI-k <uncommitted port>\fR]
 [\fI-f <frequency>\fR] [\fI-D
<src_host>[:<src_port>][[@<src_mcast>][:<port>]][/<opts>]\fR] [\fI-A
<ASI_adapter>\fR]
 [\fI-s <symbol_rate>\fR] [\fI-v <0|13|18>\fR] [\fI-p\fR] [\fI-b
<bandwidth>\fR] [\fI-I <inversion>\fR]
 [\fI-F <fec_inner>\fR] [\fI-m <modulation>\fR] [\fI-R <rolloff>\fR]
[\fI-P <pilot>\fR] [\fI-K <fec_lp>\fR]
@@ -126,6 +126,9 @@ DVB network name to declare in the NIT
 \fB\-n\fR, \fB\-\-frontend\-number\fR <frontend number>
 The frontend number
 .TP
+\fB\-y\fR, \fB\-\-ca\-number\fR <ca number>
+The ca number
+.TP
 \fB\-N\fR, \fB\-\-network-id\fR <ID>
 DVB network ID to declare in the NIT
 .TP
diff --git a/dvblast.c b/dvblast.c
index 0866cd6..2dfefa2 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -61,6 +61,7 @@ char *psz_srv_socket = NULL;
 static int i_priority = -1;
 int i_adapter = 0;
 int i_fenum = 0;
+int i_canum = 0;
 int i_frequency = 0;
 int i_inversion = -1;
 int i_srate = 27500000;
@@ -490,6 +491,7 @@ void usage()
     msg_Raw( NULL, "  -v --voltage          voltage to apply to the
LNB (QPSK)" );
     msg_Raw( NULL, "  -w --select-pmts      set a PID filter on all PMTs" );
     msg_Raw( NULL, "  -O --lock-timeout     timeout for the lock
operation (in ms)" );
+    msg_Raw( NULL, "  -y --ca-number        <ca number>" );
 #endif

     msg_Raw( NULL, "Output:" );
@@ -545,7 +547,7 @@ int main( int i_argc, char **pp_argv )
         usage();

     /*
-     * The only short options left are: y0123456789
+     * The only short options left are: 0123456789
      * Use them wisely.
      */
     static const struct option long_options[] =
@@ -601,10 +603,11 @@ int main( int i_argc, char **pp_argv )
         { "help",            no_argument,       NULL, 'h' },
         { "version",         no_argument,       NULL, 'V' },
         { "mrtg-file",       required_argument, NULL, 'Z' },
+        { "ca-number",       required_argument, NULL, 'y' },
         { 0, 0, 0, 0 }
     };

-    while ( (c = getopt_long(i_argc, pp_argv,
"q::c:r:t:o:i:a:n:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:",
long_options, NULL)) != -1 )
+    while ( (c = getopt_long(i_argc, pp_argv,
"q::c:r:t:o:i:a:n:f:F:R:s:S:k:v:pb:I:m:P:K:G:H:X:O:uwUTL:E:d:D:A:lg:zCWYeM:N:j:J:B:x:Q:hVZ:y:",
long_options, NULL)) != -1 )
     {
         switch ( c )
         {
@@ -664,6 +667,10 @@ int main( int i_argc, char **pp_argv )
             i_fenum = strtol( optarg, NULL, 0 );
             break;

+        case 'y':
+            i_canum = strtol( optarg, NULL, 0 );
+            break;
+
         case 'f':
             i_frequency = strtol( optarg, NULL, 0 );
             if ( pf_Open != NULL )
diff --git a/dvblast.h b/dvblast.h
index ca89b12..3d685ce 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -135,6 +135,7 @@ extern char *psz_srv_socket;
 extern int i_comm_fd;
 extern int i_adapter;
 extern int i_fenum;
+extern int i_canum;
 extern int i_frequency;
 extern int i_srate;
 extern int i_satnum;
diff --git a/en50221.c b/en50221.c
index 0724fb3..f2f1523 100644
--- a/en50221.c
+++ b/en50221.c
@@ -1940,7 +1940,7 @@ void en50221_Init( void )

     memset( &caps, 0, sizeof( ca_caps_t ));

-    sprintf( psz_tmp, "/dev/dvb/adapter%d/ca0", i_adapter );
+    sprintf( psz_tmp, "/dev/dvb/adapter%d/ca%d", i_adapter, i_canum );
     if( (i_ca_handle = open(psz_tmp, O_RDWR | O_NONBLOCK)) < 0 )
     {
         msg_Warn( NULL, "failed opening CAM device %s (%s)",


More information about the dvblast-devel mailing list