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