~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/media/rc/lirc-write.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
  2 .. c:namespace:: RC
  3 
  4 .. _lirc-write:
  5 
  6 ************
  7 LIRC write()
  8 ************
  9 
 10 Name
 11 ====
 12 
 13 lirc-write - Write to a LIRC device
 14 
 15 Synopsis
 16 ========
 17 
 18 .. code-block:: c
 19 
 20     #include <unistd.h>
 21 
 22 .. c:function:: ssize_t write( int fd, void *buf, size_t count )
 23 
 24 Arguments
 25 =========
 26 
 27 ``fd``
 28     File descriptor returned by ``open()``.
 29 
 30 ``buf``
 31     Buffer with data to be written
 32 
 33 ``count``
 34     Number of bytes at the buffer
 35 
 36 Description
 37 ===========
 38 
 39 :c:func:`write()` writes up to ``count`` bytes to the device
 40 referenced by the file descriptor ``fd`` from the buffer starting at
 41 ``buf``.
 42 
 43 The exact format of the data depends on what mode a driver is in, use
 44 :ref:`lirc_get_features` to get the supported modes and use
 45 :ref:`lirc_set_send_mode` set the mode.
 46 
 47 When in :ref:`LIRC_MODE_PULSE <lirc-mode-PULSE>` mode, the data written to
 48 the chardev is a pulse/space sequence of integer values. Pulses and spaces
 49 are only marked implicitly by their position. The data must start and end
 50 with a pulse, therefore, the data must always include an uneven number of
 51 samples. The write function blocks until the data has been transmitted
 52 by the hardware. If more data is provided than the hardware can send, the
 53 driver returns ``EINVAL``.
 54 
 55 When in :ref:`LIRC_MODE_SCANCODE <lirc-mode-scancode>` mode, one
 56 ``struct lirc_scancode`` must be written to the chardev at a time, else
 57 ``EINVAL`` is returned. Set the desired scancode in the ``scancode`` member,
 58 and the :ref:`IR protocol <Remote_controllers_Protocols>` in the
 59 :c:type:`rc_proto`: member. All other members must be
 60 set to 0, else ``EINVAL`` is returned. If there is no protocol encoder
 61 for the protocol or the scancode is not valid for the specified protocol,
 62 ``EINVAL`` is returned. The write function blocks until the scancode
 63 is transmitted by the hardware.
 64 
 65 Return Value
 66 ============
 67 
 68 On success, the number of bytes written is returned. It is not an error if
 69 this number is smaller than the number of bytes requested, or the amount
 70 of data required for one frame.  On error, -1 is returned, and the ``errno``
 71 variable is set appropriately. The generic error codes are described at the
 72 :ref:`Generic Error Codes <gen-errors>` chapter.

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php