summaryrefslogtreecommitdiffstats
path: root/Documentation/media/uapi/rc/lirc-write.rst
blob: dcba3b1bee6ec1f397de0d59f942d74c797fda97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.. -*- coding: utf-8; mode: rst -*-

.. _lirc-write:

************
LIRC write()
************

Name
====

lirc-write - Write to a LIRC device


Synopsis
========

.. code-block:: c

    #include <unistd.h>


.. cpp:function:: ssize_t write( int fd, void *buf, size_t count )


Arguments
=========

``fd``
    File descriptor returned by ``open()``.

``buf``
``count``


Description
===========

:ref:`write() <lirc-write>` writes up to ``count`` bytes to the device
referenced by the file descriptor ``fd`` from the buffer starting at
``buf``.

The data written to the chardev is a pulse/space sequence of integer
values. Pulses and spaces are only marked implicitly by their position.
The data must start and end with a pulse, therefore, the data must
always include an uneven number of samples. The write function must
block until the data has been transmitted by the hardware. If more data
is provided than the hardware can send, the driver returns ``EINVAL``.


Return Value
============

On success, the number of bytes read is returned. It is not an error if
this number is smaller than the number of bytes requested, or the amount
of data required for one frame.  On error, -1 is returned, and the ``errno``
variable is set appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.