Path: blob/master/Documentation/DocBook/dvb/ca.xml
10823 views
<title>DVB CA Device</title>1<para>The DVB CA device controls the conditional access hardware. It can be accessed through2<emphasis role="tt">/dev/dvb/adapter0/ca0</emphasis>. Data types and and ioctl definitions can be accessed by3including <emphasis role="tt">linux/dvb/ca.h</emphasis> in your application.4</para>56<section id="ca_data_types">7<title>CA Data Types</title>8910<section id="ca_slot_info_t">11<title>ca_slot_info_t</title>12<programlisting>13/⋆ slot interface types and info ⋆/1415typedef struct ca_slot_info_s {16int num; /⋆ slot number ⋆/1718int type; /⋆ CA interface this slot supports ⋆/19#define CA_CI 1 /⋆ CI high level interface ⋆/20#define CA_CI_LINK 2 /⋆ CI link layer level interface ⋆/21#define CA_CI_PHYS 4 /⋆ CI physical layer level interface ⋆/22#define CA_SC 128 /⋆ simple smart card interface ⋆/2324unsigned int flags;25#define CA_CI_MODULE_PRESENT 1 /⋆ module (or card) inserted ⋆/26#define CA_CI_MODULE_READY 227} ca_slot_info_t;28</programlisting>2930</section>31<section id="ca_descr_info_t">32<title>ca_descr_info_t</title>33<programlisting>34typedef struct ca_descr_info_s {35unsigned int num; /⋆ number of available descramblers (keys) ⋆/36unsigned int type; /⋆ type of supported scrambling system ⋆/37#define CA_ECD 138#define CA_NDS 239#define CA_DSS 440} ca_descr_info_t;41</programlisting>4243</section>44<section id="ca_cap_t">45<title>ca_cap_t</title>46<programlisting>47typedef struct ca_cap_s {48unsigned int slot_num; /⋆ total number of CA card and module slots ⋆/49unsigned int slot_type; /⋆ OR of all supported types ⋆/50unsigned int descr_num; /⋆ total number of descrambler slots (keys) ⋆/51unsigned int descr_type;/⋆ OR of all supported types ⋆/52} ca_cap_t;53</programlisting>5455</section>56<section id="ca_msg_t">57<title>ca_msg_t</title>58<programlisting>59/⋆ a message to/from a CI-CAM ⋆/60typedef struct ca_msg_s {61unsigned int index;62unsigned int type;63unsigned int length;64unsigned char msg[256];65} ca_msg_t;66</programlisting>6768</section>69<section id="ca_descr_t">70<title>ca_descr_t</title>71<programlisting>72typedef struct ca_descr_s {73unsigned int index;74unsigned int parity;75unsigned char cw[8];76} ca_descr_t;77</programlisting>78</section></section>79<section id="ca_function_calls">80<title>CA Function Calls</title>818283<section id="ca_fopen">84<title>open()</title>85<para>DESCRIPTION86</para>87<informaltable><tgroup cols="1"><tbody><row><entry88align="char">89<para>This system call opens a named ca device (e.g. /dev/ost/ca) for subsequent use.</para>90<para>When an open() call has succeeded, the device will be ready for use.91The significance of blocking or non-blocking mode is described in the92documentation for functions where there is a difference. It does not affect the93semantics of the open() call itself. A device opened in blocking mode can later94be put into non-blocking mode (and vice versa) using the F_SETFL command95of the fcntl system call. This is a standard system call, documented in the Linux96manual page for fcntl. Only one user can open the CA Device in O_RDWR97mode. All other attempts to open the device in this mode will fail, and an error98code will be returned.</para>99</entry>100</row></tbody></tgroup></informaltable>101<para>SYNOPSIS102</para>103<informaltable><tgroup cols="1"><tbody><row><entry104align="char">105<para>int open(const char ⋆deviceName, int flags);</para>106</entry>107</row></tbody></tgroup></informaltable>108<para>PARAMETERS109</para>110<informaltable><tgroup cols="2"><tbody><row><entry111align="char">112<para>const char113*deviceName</para>114</entry><entry115align="char">116<para>Name of specific video device.</para>117</entry>118</row><row><entry119align="char">120<para>int flags</para>121</entry><entry122align="char">123<para>A bit-wise OR of the following flags:</para>124</entry>125</row><row><entry126align="char">127</entry><entry128align="char">129<para>O_RDONLY read-only access</para>130</entry>131</row><row><entry132align="char">133</entry><entry134align="char">135<para>O_RDWR read/write access</para>136</entry>137</row><row><entry138align="char">139</entry><entry140align="char">141<para>O_NONBLOCK open in non-blocking mode</para>142</entry>143</row><row><entry144align="char">145</entry><entry146align="char">147<para>(blocking mode is the default)</para>148</entry>149</row></tbody></tgroup></informaltable>150<para>ERRORS151</para>152<informaltable><tgroup cols="2"><tbody><row><entry153align="char">154<para>ENODEV</para>155</entry><entry156align="char">157<para>Device driver not loaded/available.</para>158</entry>159</row><row><entry160align="char">161<para>EINTERNAL</para>162</entry><entry163align="char">164<para>Internal error.</para>165</entry>166</row><row><entry167align="char">168<para>EBUSY</para>169</entry><entry170align="char">171<para>Device or resource busy.</para>172</entry>173</row><row><entry174align="char">175<para>EINVAL</para>176</entry><entry177align="char">178<para>Invalid argument.</para>179</entry>180</row></tbody></tgroup></informaltable>181182</section>183<section id="ca_fclose">184<title>close()</title>185<para>DESCRIPTION186</para>187<informaltable><tgroup cols="1"><tbody><row><entry188align="char">189<para>This system call closes a previously opened audio device.</para>190</entry>191</row></tbody></tgroup></informaltable>192<para>SYNOPSIS193</para>194<informaltable><tgroup cols="1"><tbody><row><entry195align="char">196<para>int close(int fd);</para>197</entry>198</row></tbody></tgroup></informaltable>199<para>PARAMETERS200</para>201<informaltable><tgroup cols="2"><tbody><row><entry202align="char">203<para>int fd</para>204</entry><entry205align="char">206<para>File descriptor returned by a previous call to open().</para>207</entry>208</row></tbody></tgroup></informaltable>209<para>ERRORS210</para>211<informaltable><tgroup cols="2"><tbody><row><entry212align="char">213<para>EBADF</para>214</entry><entry215align="char">216<para>fd is not a valid open file descriptor.</para>217</entry>218</row></tbody></tgroup></informaltable>219</section>220</section>221222223