LIRC: Difference between revisions

From VDR Wiki
Jump to navigation Jump to search
(merge i18n)
(Kernel LIRC driver, and Raspberry Pi GPIO)
Line 1: Line 1:
==Description==
==Description==
'''LIRC''' ('''''L'''inux '''I'''nfrared '''R'''emote '''C'''ontrol'') is a software to control ones computer through nearly every (unused) [[remote control]]. Therefor a small electronic device is necessary. You can buy one for ca. 15 Euro, or you can build your own. It consists of only a few components and schematics are on the LIRC homepage.
'''LIRC''' ('''''L'''inux '''I'''nfrared '''R'''emote '''C'''ontrol'') is a software to control ones computer through nearly every (unused) [[remote control]]. Therefore a small electronic device is necessary. You can buy one for ca. 15 Euro, or you can build your own. It consists of only a few components and schematics are on the LIRC homepage.


==Miscellaneous==
==Miscellaneous==

=== Kernel driver /dev/lirc* and ir-keytable ===

LIRC was initially developed as a user-space driver based on various bit-banging interfaces, such as some flow control lines of RS-232 interfaces. The Linux kernel also includes drivers on its own that can directly interface with various types of hardware. The Linux kernel driver includes both an input event driver (similar to a keyboard) and a lower-level <code>/dev/lirc*</code> driver. The driver can be configured by installing the package <code>ir-keytable</code> and editing the file <code>/etc/rc_maps.cfg</code>.

The sophisticated <code>LIRC_MODE_SCANCODE</code> mode that was introduced in Linux 4.16 includes both timing information, raw scancodes and decoded keycodes. It is supported by VDR since version 2.6.2:
<code>vdr --no-kbd --lirc=/dev/lirc0</code>. The earliest Linux kernel version where it was confirmed to work is 5.10. On Linux 5.4 on a 32-bit ARM system, the interface would not deliver any data in this mode.

==== Raspberry Pi gpio-ir ====

On the Raspberry Pi, you can connect a TSOP38238 receiver to the GPIO header: 3.3V, ground, and GPIO pin 18 (or 17). You can enable the hardware by adding the following line to <code>/boot/config.txt</code>:
<pre>dtoverlay=gpio-ir,gpio_pin=18</pre>
For example, to use the remote control unit of an old Hauppauge tuner, you can add the following line to <code>/etc/rc_maps.cfg</code>:
<pre>* * hauppauge.toml</pre>
You can test it with the following command:
<pre>ir-keytable -t</pre>

===Cable length===
===Cable length===
The length of the cable between receiver and computer can be up to 25m.
The length of the cable between receiver and computer can be up to 25m.
Line 30: Line 47:
| [1]
| [1]
| http://www.lirc.org
| http://www.lirc.org
| LIRC projekt homepage
| LIRC project homepage
|-
|-
| [2]
| [2]
Line 39: Line 56:
| http://www.zapway.de
| http://www.zapway.de
| Commercial infrared receiver (~ 14 Euro)
| Commercial infrared receiver (~ 14 Euro)
|-
| [4]
| https://learn.adafruit.com/using-an-ir-remote-with-a-raspberry-pi-media-center
| How to connect a TSOP38238 receiver to a Raspberry Pi
|}
|}



Revision as of 18:51, 28 December 2022

Description

LIRC (Linux Infrared Remote Control) is a software to control ones computer through nearly every (unused) remote control. Therefore a small electronic device is necessary. You can buy one for ca. 15 Euro, or you can build your own. It consists of only a few components and schematics are on the LIRC homepage.

Miscellaneous

Kernel driver /dev/lirc* and ir-keytable

LIRC was initially developed as a user-space driver based on various bit-banging interfaces, such as some flow control lines of RS-232 interfaces. The Linux kernel also includes drivers on its own that can directly interface with various types of hardware. The Linux kernel driver includes both an input event driver (similar to a keyboard) and a lower-level /dev/lirc* driver. The driver can be configured by installing the package ir-keytable and editing the file /etc/rc_maps.cfg.

The sophisticated LIRC_MODE_SCANCODE mode that was introduced in Linux 4.16 includes both timing information, raw scancodes and decoded keycodes. It is supported by VDR since version 2.6.2: vdr --no-kbd --lirc=/dev/lirc0. The earliest Linux kernel version where it was confirmed to work is 5.10. On Linux 5.4 on a 32-bit ARM system, the interface would not deliver any data in this mode.

Raspberry Pi gpio-ir

On the Raspberry Pi, you can connect a TSOP38238 receiver to the GPIO header: 3.3V, ground, and GPIO pin 18 (or 17). You can enable the hardware by adding the following line to /boot/config.txt:

dtoverlay=gpio-ir,gpio_pin=18

For example, to use the remote control unit of an old Hauppauge tuner, you can add the following line to /etc/rc_maps.cfg:

* * hauppauge.toml

You can test it with the following command:

ir-keytable -t

Cable length

The length of the cable between receiver and computer can be up to 25m.

Parallel operation of two LIRC receiver

It is possible to operate LIRC with two infrared receiver devices at one COM port. But not independently from one another, only in parallel.

                 o +12V 
                 |
                 -
                | | 10k
                | |
                 -  
Output 1         |   Input
o----------|<----*----o
                 |
Output 2         |
o----------|<----

Ground               Ground
o---------------------o

Links

[1] http://www.lirc.org LIRC project homepage
[2] http://lnx.manoweb.com/lirc/?partType=section&partName=introduction Detailed construction manual with source for a complete infrared receiver
[3] http://www.zapway.de Commercial infrared receiver (~ 14 Euro)
[4] https://learn.adafruit.com/using-an-ir-remote-with-a-raspberry-pi-media-center How to connect a TSOP38238 receiver to a Raspberry Pi