2016-06-30 21:18:56 +08:00
|
|
|
.. -*- coding: utf-8; mode: rst -*-
|
|
|
|
|
2016-07-12 17:12:32 +08:00
|
|
|
.. _lirc-write:
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-10 08:03:57 +08:00
|
|
|
************
|
|
|
|
LIRC write()
|
|
|
|
************
|
|
|
|
|
|
|
|
Name
|
|
|
|
====
|
|
|
|
|
|
|
|
lirc-write - Write to a LIRC device
|
|
|
|
|
|
|
|
|
|
|
|
Synopsis
|
|
|
|
========
|
|
|
|
|
|
|
|
.. code-block:: c
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
2016-08-19 23:00:43 +08:00
|
|
|
.. c:function:: ssize_t write( int fd, void *buf, size_t count )
|
2016-08-20 03:59:31 +08:00
|
|
|
:name: lirc-write
|
2016-07-10 08:03:57 +08:00
|
|
|
|
|
|
|
Arguments
|
|
|
|
=========
|
|
|
|
|
|
|
|
``fd``
|
|
|
|
File descriptor returned by ``open()``.
|
|
|
|
|
|
|
|
``buf``
|
2016-08-20 03:59:31 +08:00
|
|
|
Buffer with data to be written
|
2016-07-10 08:03:57 +08:00
|
|
|
|
2016-08-20 03:59:31 +08:00
|
|
|
``count``
|
|
|
|
Number of bytes at the buffer
|
2016-07-10 08:03:57 +08:00
|
|
|
|
|
|
|
Description
|
|
|
|
===========
|
|
|
|
|
2016-07-12 17:12:32 +08:00
|
|
|
:ref:`write() <lirc-write>` writes up to ``count`` bytes to the device
|
2016-07-10 08:03:57 +08:00
|
|
|
referenced by the file descriptor ``fd`` from the buffer starting at
|
|
|
|
``buf``.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
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
|
2016-07-03 22:53:09 +08:00
|
|
|
is provided than the hardware can send, the driver returns ``EINVAL``.
|
2016-07-10 08:03:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
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.
|