func-write.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <refentry id="func-write">
  2. <refmeta>
  3. <refentrytitle>V4L2 write()</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>v4l2-write</refname>
  8. <refpurpose>Write to a V4L2 device</refpurpose>
  9. </refnamediv>
  10. <refsynopsisdiv>
  11. <funcsynopsis>
  12. <funcsynopsisinfo>#include &lt;unistd.h&gt;</funcsynopsisinfo>
  13. <funcprototype>
  14. <funcdef>ssize_t <function>write</function></funcdef>
  15. <paramdef>int <parameter>fd</parameter></paramdef>
  16. <paramdef>void *<parameter>buf</parameter></paramdef>
  17. <paramdef>size_t <parameter>count</parameter></paramdef>
  18. </funcprototype>
  19. </funcsynopsis>
  20. </refsynopsisdiv>
  21. <refsect1>
  22. <title>Arguments</title>
  23. <variablelist>
  24. <varlistentry>
  25. <term><parameter>fd</parameter></term>
  26. <listitem>
  27. <para>&fd;</para>
  28. </listitem>
  29. </varlistentry>
  30. <varlistentry>
  31. <term><parameter>buf</parameter></term>
  32. <listitem>
  33. <para></para>
  34. </listitem>
  35. </varlistentry>
  36. <varlistentry>
  37. <term><parameter>count</parameter></term>
  38. <listitem>
  39. <para></para>
  40. </listitem>
  41. </varlistentry>
  42. </variablelist>
  43. </refsect1>
  44. <refsect1>
  45. <title>Description</title>
  46. <para><function>write()</function> writes up to
  47. <parameter>count</parameter> bytes to the device referenced by the
  48. file descriptor <parameter>fd</parameter> from the buffer starting at
  49. <parameter>buf</parameter>. When the hardware outputs are not active
  50. yet, this function enables them. When <parameter>count</parameter> is
  51. zero, <function>write()</function> returns
  52. <returnvalue>0</returnvalue> without any other effect.</para>
  53. <para>When the application does not provide more data in time, the
  54. previous video frame, raw VBI image, sliced VPS or WSS data is
  55. displayed again. Sliced Teletext or Closed Caption data is not
  56. repeated, the driver inserts a blank line instead.</para>
  57. </refsect1>
  58. <refsect1>
  59. <title>Return Value</title>
  60. <para>On success, the number of bytes written are returned. Zero
  61. indicates nothing was written. On error, <returnvalue>-1</returnvalue>
  62. is returned, and the <varname>errno</varname> variable is set
  63. appropriately. In this case the next write will start at the beginning
  64. of a new frame. Possible error codes are:</para>
  65. <variablelist>
  66. <varlistentry>
  67. <term><errorcode>EAGAIN</errorcode></term>
  68. <listitem>
  69. <para>Non-blocking I/O has been selected using the <link
  70. linkend="func-open"><constant>O_NONBLOCK</constant></link> flag and no
  71. buffer space was available to write the data immediately.</para>
  72. </listitem>
  73. </varlistentry>
  74. <varlistentry>
  75. <term><errorcode>EBADF</errorcode></term>
  76. <listitem>
  77. <para><parameter>fd</parameter> is not a valid file
  78. descriptor or is not open for writing.</para>
  79. </listitem>
  80. </varlistentry>
  81. <varlistentry>
  82. <term><errorcode>EBUSY</errorcode></term>
  83. <listitem>
  84. <para>The driver does not support multiple write streams and the
  85. device is already in use.</para>
  86. </listitem>
  87. </varlistentry>
  88. <varlistentry>
  89. <term><errorcode>EFAULT</errorcode></term>
  90. <listitem>
  91. <para><parameter>buf</parameter> references an inaccessible
  92. memory area.</para>
  93. </listitem>
  94. </varlistentry>
  95. <varlistentry>
  96. <term><errorcode>EINTR</errorcode></term>
  97. <listitem>
  98. <para>The call was interrupted by a signal before any
  99. data was written.</para>
  100. </listitem>
  101. </varlistentry>
  102. <varlistentry>
  103. <term><errorcode>EIO</errorcode></term>
  104. <listitem>
  105. <para>I/O error. This indicates some hardware problem.</para>
  106. </listitem>
  107. </varlistentry>
  108. <varlistentry>
  109. <term><errorcode>EINVAL</errorcode></term>
  110. <listitem>
  111. <para>The <function>write()</function> function is not
  112. supported by this driver, not on this device, or generally not on this
  113. type of device.</para>
  114. </listitem>
  115. </varlistentry>
  116. </variablelist>
  117. </refsect1>
  118. </refentry>