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

Honza Petrouš jpetrous at gmail.com
Tue Oct 9 20:02:43 CEST 2012


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/dvblast.c b/dvblast.c
index 0866cd6..630b7e7 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:" );
@@ -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