| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 1 | <title>DVB CA Device</title> |
| 2 | <para>The DVB CA device controls the conditional access hardware. It can be accessed through |
| 3 | <emphasis role="tt">/dev/dvb/adapter0/ca0</emphasis>. Data types and and ioctl definitions can be accessed by |
| 4 | including <emphasis role="tt">linux/dvb/ca.h</emphasis> in your application. |
| 5 | </para> |
| 6 | |
| 7 | <section id="ca_data_types"> |
| 8 | <title>CA Data Types</title> |
| 9 | |
| 10 | |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 11 | <section id="ca-slot-info"> |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 12 | <title>ca_slot_info_t</title> |
| 13 | <programlisting> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 14 | typedef struct ca_slot_info { |
| 15 | int num; /⋆ slot number ⋆/ |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 16 | |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 17 | int type; /⋆ CA interface this slot supports ⋆/ |
| 18 | #define CA_CI 1 /⋆ CI high level interface ⋆/ |
| 19 | #define CA_CI_LINK 2 /⋆ CI link layer level interface ⋆/ |
| 20 | #define CA_CI_PHYS 4 /⋆ CI physical layer level interface ⋆/ |
| 21 | #define CA_DESCR 8 /⋆ built-in descrambler ⋆/ |
| 22 | #define CA_SC 128 /⋆ simple smart card interface ⋆/ |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 23 | |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 24 | unsigned int flags; |
| 25 | #define CA_CI_MODULE_PRESENT 1 /⋆ module (or card) inserted ⋆/ |
| 26 | #define CA_CI_MODULE_READY 2 |
| 27 | } ca_slot_info_t; |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 28 | </programlisting> |
| 29 | |
| 30 | </section> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 31 | <section id="ca-descr-info"> |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 32 | <title>ca_descr_info_t</title> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 33 | <programlisting> |
| 34 | typedef struct ca_descr_info { |
| 35 | unsigned int num; /⋆ number of available descramblers (keys) ⋆/ |
| 36 | unsigned int type; /⋆ type of supported scrambling system ⋆/ |
| 37 | #define CA_ECD 1 |
| 38 | #define CA_NDS 2 |
| 39 | #define CA_DSS 4 |
| 40 | } ca_descr_info_t; |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 41 | </programlisting> |
| 42 | |
| 43 | </section> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 44 | <section id="ca-caps"> |
| 45 | <title>ca_caps_t</title> |
| 46 | <programlisting> |
| Mauro Carvalho Chehab | cde291d | 2011-06-08 11:34:31 -0300 | [diff] [blame] | 47 | typedef struct ca_caps { |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 48 | unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/ |
| 49 | unsigned int slot_type; /⋆ OR of all supported types ⋆/ |
| 50 | unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/ |
| 51 | unsigned int descr_type;/⋆ OR of all supported types ⋆/ |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 52 | } ca_cap_t; |
| 53 | </programlisting> |
| 54 | |
| 55 | </section> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 56 | <section id="ca-msg"> |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 57 | <title>ca_msg_t</title> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 58 | <programlisting> |
| 59 | /⋆ a message to/from a CI-CAM ⋆/ |
| 60 | typedef struct ca_msg { |
| 61 | unsigned int index; |
| 62 | unsigned int type; |
| 63 | unsigned int length; |
| 64 | unsigned char msg[256]; |
| 65 | } ca_msg_t; |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 66 | </programlisting> |
| 67 | |
| 68 | </section> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 69 | <section id="ca-descr"> |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 70 | <title>ca_descr_t</title> |
| Mauro Carvalho Chehab | 2b680d1 | 2011-06-08 11:29:27 -0300 | [diff] [blame] | 71 | <programlisting> |
| 72 | typedef struct ca_descr { |
| 73 | unsigned int index; |
| 74 | unsigned int parity; |
| 75 | unsigned char cw[8]; |
| 76 | } ca_descr_t; |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 77 | </programlisting> |
| Mauro Carvalho Chehab | cde291d | 2011-06-08 11:34:31 -0300 | [diff] [blame] | 78 | </section> |
| 79 | |
| 80 | <section id="ca-pid"> |
| 81 | <title>ca-pid</title> |
| 82 | <programlisting> |
| 83 | typedef struct ca_pid { |
| 84 | unsigned int pid; |
| 85 | int index; /⋆ -1 == disable⋆/ |
| 86 | } ca_pid_t; |
| 87 | </programlisting> |
| 88 | </section></section> |
| 89 | |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 90 | <section id="ca_function_calls"> |
| 91 | <title>CA Function Calls</title> |
| 92 | |
| 93 | |
| 94 | <section id="ca_fopen"> |
| 95 | <title>open()</title> |
| 96 | <para>DESCRIPTION |
| 97 | </para> |
| 98 | <informaltable><tgroup cols="1"><tbody><row><entry |
| 99 | align="char"> |
| 100 | <para>This system call opens a named ca device (e.g. /dev/ost/ca) for subsequent use.</para> |
| 101 | <para>When an open() call has succeeded, the device will be ready for use. |
| 102 | The significance of blocking or non-blocking mode is described in the |
| 103 | documentation for functions where there is a difference. It does not affect the |
| 104 | semantics of the open() call itself. A device opened in blocking mode can later |
| 105 | be put into non-blocking mode (and vice versa) using the F_SETFL command |
| 106 | of the fcntl system call. This is a standard system call, documented in the Linux |
| 107 | manual page for fcntl. Only one user can open the CA Device in O_RDWR |
| 108 | mode. All other attempts to open the device in this mode will fail, and an error |
| 109 | code will be returned.</para> |
| 110 | </entry> |
| 111 | </row></tbody></tgroup></informaltable> |
| 112 | <para>SYNOPSIS |
| 113 | </para> |
| 114 | <informaltable><tgroup cols="1"><tbody><row><entry |
| 115 | align="char"> |
| 116 | <para>int open(const char ⋆deviceName, int flags);</para> |
| 117 | </entry> |
| 118 | </row></tbody></tgroup></informaltable> |
| 119 | <para>PARAMETERS |
| 120 | </para> |
| 121 | <informaltable><tgroup cols="2"><tbody><row><entry |
| 122 | align="char"> |
| 123 | <para>const char |
| 124 | *deviceName</para> |
| 125 | </entry><entry |
| 126 | align="char"> |
| 127 | <para>Name of specific video device.</para> |
| 128 | </entry> |
| 129 | </row><row><entry |
| 130 | align="char"> |
| 131 | <para>int flags</para> |
| 132 | </entry><entry |
| 133 | align="char"> |
| 134 | <para>A bit-wise OR of the following flags:</para> |
| 135 | </entry> |
| 136 | </row><row><entry |
| 137 | align="char"> |
| 138 | </entry><entry |
| 139 | align="char"> |
| 140 | <para>O_RDONLY read-only access</para> |
| 141 | </entry> |
| 142 | </row><row><entry |
| 143 | align="char"> |
| 144 | </entry><entry |
| 145 | align="char"> |
| 146 | <para>O_RDWR read/write access</para> |
| 147 | </entry> |
| 148 | </row><row><entry |
| 149 | align="char"> |
| 150 | </entry><entry |
| 151 | align="char"> |
| 152 | <para>O_NONBLOCK open in non-blocking mode</para> |
| 153 | </entry> |
| 154 | </row><row><entry |
| 155 | align="char"> |
| 156 | </entry><entry |
| 157 | align="char"> |
| 158 | <para>(blocking mode is the default)</para> |
| 159 | </entry> |
| 160 | </row></tbody></tgroup></informaltable> |
| Mauro Carvalho Chehab | 3de530f | 2011-07-05 12:36:01 -0300 | [diff] [blame] | 161 | <para>RETURN VALUE</para> |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 162 | <informaltable><tgroup cols="2"><tbody><row><entry |
| 163 | align="char"> |
| 164 | <para>ENODEV</para> |
| 165 | </entry><entry |
| 166 | align="char"> |
| 167 | <para>Device driver not loaded/available.</para> |
| 168 | </entry> |
| 169 | </row><row><entry |
| 170 | align="char"> |
| 171 | <para>EINTERNAL</para> |
| 172 | </entry><entry |
| 173 | align="char"> |
| 174 | <para>Internal error.</para> |
| 175 | </entry> |
| 176 | </row><row><entry |
| 177 | align="char"> |
| 178 | <para>EBUSY</para> |
| 179 | </entry><entry |
| 180 | align="char"> |
| 181 | <para>Device or resource busy.</para> |
| 182 | </entry> |
| 183 | </row><row><entry |
| 184 | align="char"> |
| 185 | <para>EINVAL</para> |
| 186 | </entry><entry |
| 187 | align="char"> |
| 188 | <para>Invalid argument.</para> |
| 189 | </entry> |
| 190 | </row></tbody></tgroup></informaltable> |
| 191 | |
| 192 | </section> |
| 193 | <section id="ca_fclose"> |
| 194 | <title>close()</title> |
| 195 | <para>DESCRIPTION |
| 196 | </para> |
| 197 | <informaltable><tgroup cols="1"><tbody><row><entry |
| 198 | align="char"> |
| 199 | <para>This system call closes a previously opened audio device.</para> |
| 200 | </entry> |
| 201 | </row></tbody></tgroup></informaltable> |
| 202 | <para>SYNOPSIS |
| 203 | </para> |
| 204 | <informaltable><tgroup cols="1"><tbody><row><entry |
| 205 | align="char"> |
| 206 | <para>int close(int fd);</para> |
| 207 | </entry> |
| 208 | </row></tbody></tgroup></informaltable> |
| 209 | <para>PARAMETERS |
| 210 | </para> |
| 211 | <informaltable><tgroup cols="2"><tbody><row><entry |
| 212 | align="char"> |
| 213 | <para>int fd</para> |
| 214 | </entry><entry |
| 215 | align="char"> |
| 216 | <para>File descriptor returned by a previous call to open().</para> |
| 217 | </entry> |
| 218 | </row></tbody></tgroup></informaltable> |
| Mauro Carvalho Chehab | 3de530f | 2011-07-05 12:36:01 -0300 | [diff] [blame] | 219 | <para>RETURN VALUE</para> |
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 220 | <informaltable><tgroup cols="2"><tbody><row><entry |
| 221 | align="char"> |
| 222 | <para>EBADF</para> |
| 223 | </entry><entry |
| 224 | align="char"> |
| 225 | <para>fd is not a valid open file descriptor.</para> |
| 226 | </entry> |
| 227 | </row></tbody></tgroup></informaltable> |
| 228 | </section> |
| 229 | </section> |