<refentry id="cec-ioc-adap-g-caps">
  <refmeta>
    <refentrytitle>ioctl CEC_ADAP_G_CAPS</refentrytitle>
    &manvol;
  </refmeta>

  <refnamediv>
    <refname>CEC_ADAP_G_CAPS</refname>
    <refpurpose>Query device capabilities</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <funcsynopsis>
      <funcprototype>
	<funcdef>int <function>ioctl</function></funcdef>
	<paramdef>int <parameter>fd</parameter></paramdef>
	<paramdef>int <parameter>request</parameter></paramdef>
	<paramdef>struct cec_caps *<parameter>argp</parameter></paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Arguments</title>

    <variablelist>
      <varlistentry>
	<term><parameter>fd</parameter></term>
	<listitem>
	  <para>File descriptor returned by
	  <link linkend='cec-func-open'><function>open()</function></link>.</para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter>request</parameter></term>
	<listitem>
	  <para>CEC_ADAP_G_CAPS</para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter>argp</parameter></term>
	<listitem>
	  <para></para>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>
      Note: this documents the proposed CEC API. This API is not yet finalized and
      is currently only available as a staging kernel module.
    </para>

    <para>All cec devices must support the <constant>CEC_ADAP_G_CAPS</constant>
    ioctl. To query device information, applications call the ioctl with a
    pointer to a &cec-caps;. The driver fills the structure and returns
    the information to the application.
    The ioctl never fails.</para>

    <table pgwide="1" frame="none" id="cec-caps">
      <title>struct <structname>cec_caps</structname></title>
      <tgroup cols="3">
	&cs-str;
	<tbody valign="top">
	  <row>
	    <entry>char</entry>
	    <entry><structfield>driver[32]</structfield></entry>
	    <entry>The name of the cec adapter driver.</entry>
	  </row>
	  <row>
	    <entry>char</entry>
	    <entry><structfield>name[32]</structfield></entry>
	    <entry>The name of this CEC adapter. The combination <structfield>driver</structfield>
	    and <structfield>name</structfield> must be unique.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>capabilities</structfield></entry>
	    <entry>The capabilities of the CEC adapter, see <xref
		linkend="cec-capabilities" />.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>version</structfield></entry>
	    <entry>CEC Framework API version, formatted with the
	    <constant>KERNEL_VERSION()</constant> macro.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <table pgwide="1" frame="none" id="cec-capabilities">
      <title>CEC Capabilities Flags</title>
      <tgroup cols="3">
	&cs-def;
	<tbody valign="top">
	  <row>
	    <entry><constant>CEC_CAP_PHYS_ADDR</constant></entry>
	    <entry>0x00000001</entry>
	    <entry>Userspace has to configure the physical address by
	    calling &CEC-ADAP-S-PHYS-ADDR;. If this capability isn't set,
	    then setting the physical address is handled by the kernel
	    whenever the EDID is set (for an HDMI receiver) or read (for
	    an HDMI transmitter).</entry>
	  </row>
	  <row>
	    <entry><constant>CEC_CAP_LOG_ADDRS</constant></entry>
	    <entry>0x00000002</entry>
	    <entry>Userspace has to configure the logical addresses by
	    calling &CEC-ADAP-S-LOG-ADDRS;. If this capability isn't set,
	    then the kernel will have configured this.</entry>
	  </row>
	  <row>
	    <entry><constant>CEC_CAP_TRANSMIT</constant></entry>
	    <entry>0x00000004</entry>
	    <entry>Userspace can transmit CEC messages by calling &CEC-TRANSMIT;. This
	    implies that userspace can be a follower as well, since being able to
	    transmit messages is a prerequisite of becoming a follower. If this
	    capability isn't set, then the kernel will handle all CEC transmits
	    and process all CEC messages it receives.
	    </entry>
	  </row>
	  <row>
	    <entry><constant>CEC_CAP_PASSTHROUGH</constant></entry>
	    <entry>0x00000008</entry>
	    <entry>Userspace can use the passthrough mode by
	    calling &CEC-S-MODE;.</entry>
	  </row>
	  <row>
	    <entry><constant>CEC_CAP_RC</constant></entry>
	    <entry>0x00000010</entry>
	    <entry>This adapter supports the remote control protocol.</entry>
	  </row>
	  <row>
	    <entry><constant>CEC_CAP_MONITOR_ALL</constant></entry>
	    <entry>0x00000020</entry>
	    <entry>The CEC hardware can monitor all messages, not just directed and
	    broadcast messages.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>
  </refsect1>

  <refsect1>
    &return-value;
  </refsect1>
</refentry>
