Architecture and Customization

Version 9 (christian, 01/01/2015 03:31 pm)

1 2 christian
{{toc}}
2 2 christian
3 1
h1. Background
4 2 christian
5 2 christian
LinHES 7 introduced a number of changes to the way remotes and associated devices are handled. This is largely being picked up from changes in the Linux base. The way remotes are now handled is significantly different and also requires a different tool set to build and diagnose an implementation. In general this new implementation is a significant improvement in what was previously a rather adhoc structure.
6 2 christian
7 2 christian
This guide will attempt to introduce you to the new architecture and tool sets relevant to LinHES.
8 2 christian
9 2 christian
h1. Architecture
10 7 christian
11 5 christian
The following picture is a logical representation of how various blocks in LinHES are connected.
12 8 christian
13 6 christian
!LinHES-Remote-Arch4.1.jpg!
14 5 christian
15 5 christian
As of LinHES 7, the remote drivers are included in the kernel whereas previously they were part of the lirc subsystem. If Lircd is not running then by default the Remote Driver will issue keyboard and/or mouse events. These events will be seen by higher level applications such as X and MythTV as if normal keyboard and mouse events occurred. Thus if you do not require certain lirc functions such as irexec then you can quite happily not use lirc at all. Note, some remotes actually do issue mouse events such as certain imon remotes.
16 9 christian
17 9 christian
h2. Remote Receiver
18 9 christian
19 9 christian
Each Remote Receiver will be identified by a unique device ID which will be associated by a driver that recognizes that ID. In most cases this should automatically make the needed associations. In some rare cases more than one driver may try to associate with the device which can cause conflicts. In these exceptional cases, this device can be blacklisted from the driver or the driver itself can be blacklisted.
20 9 christian
21 9 christian
The device ID can normally be found using tools such "lsusb" where you may see an entry similar to:
22 9 christian
<pre>Bus 003 Device 002: ID 15c2:0043 SoundGraph Inc.</pre>
23 9 christian
24 9 christian
h2. Remote Driver
25 9 christian
26 9 christian
The driver does not actually know about the remote, it only sees the IR codes received by and translated by the Remote Receiver. The Remote Receiver may use any number of protocols (e.g. RC6, imon, etc) and its associated driver will normally understand all of the protocol variants that the Remote Receiver supports.
27 9 christian
28 9 christian
The Remote Driver will interact with the Remote Receiver in order to maintain the device and of course receive information from the remote itself. Depending on the Remote Receiver and associated Remote, the driver may separate the events as keyboard and mouse events. In this case you may see entries in "/dev/input/by-id" with entries such as "usb-15c2_0043-event-if00" and "usb-15c2_0043-event-mouse". Note in customization it is generally safer to specify a driver using its "/dev/input/by-id" path rather than the "/dev/input" path.
29 9 christian
30 9 christian
h2. ir-keytable
31 9 christian
32 9 christian
ir-keytable interacts with the driver and normalizes its output. It utilizes a keymap file normally found in "/etc/rc_keymaps" and the default association with the driver will be defined by "/etc/rc_maps.cfg"
33 9 christian
34 9 christian
There are a number of things that you can do with ir-keytable including:
35 9 christian
* Identify the driver and its protocols (eg. ir-keytable)
36 9 christian
* Monitor the driver output of received events from the Remote Receiver (eg. ir-keytable -t)
37 9 christian
* configure the driver for items such as protocols (eg. ir-keytable -p RC6, LIRC, etc)
38 9 christian
* Load a specific or custom keymap for a driver (eg. ir-keytable -w /etc/rc_keymaps/imon_mce)
39 9 christian
40 9 christian
For example, in one of my systems ir-keytable returns:
41 9 christian
<pre># ir-keytable
42 9 christian
Found /sys/class/rc/rc0/ (/dev/input/event7) with:
43 9 christian
        Driver imon, table rc-imon-pad
44 9 christian
        Supported protocols: RC-6 other
45 9 christian
        Enabled protocols: RC-6
46 9 christian
        Repeat delay = 500 ms, repeat period = 33 ms</pre>
47 9 christian
48 9 christian
I also force my imon receiver to use the RC6 protocol and the imon_mce keytable instead of the default imon protocol and imon keymap using:
49 9 christian
<pre>/usr/bin/ir-keytable -c -p RC6 -w /etc/rc_keymaps/imon_mce</pre>
50 9 christian
51 9 christian
52 9 christian
h1. Tools
53 9 christian
54 9 christian
Mode2 is no longer relevant.
55 9 christian
56 9 christian
h2. lsusb
57 9 christian
h2. ir-keytable
58 9 christian
h2. irw