divzeroweb

2f30.org website
git clone git://git.2f30.org/divzeroweb.git
Log | Files | Refs | README | LICENSE

commit b7989ea874be8b00e90802fc5489732f544c44a1
parent dd9220f252443bf2e743b7286468710a63b2350f
Author: lostd <lostd@2f30.org>
Date:   Mon Mar 30 12:37:39 +0300

Switch to ceckb for the remote control part

Diffstat:
guides/rpi-tv.md | 49+++++++++++++++++++------------------------------
1 file changed, 19 insertions(+), 30 deletions(-)
diff --git a/guides/rpi-tv.md b/guides/rpi-tv.md @@ -14,48 +14,37 @@ capability through the HDMI connection. This lets us control other devices (such as the Raspberry Pi) using our remote. The available buttons for CEC on my TV remote control are: Up, Down, Left, Right, Select, Exit. The idea is to map those buttons to keyboard events using -a `libcec` client and have programs configured to handle them. We will -use the `libcec-daemon` client that does exactly that: - - https://github.com/bramp/libcec-daemon - -First of all I added some keypresses to the CEC events, like this: - - --- a/src/main.cpp - +++ b/src/main.cpp - @@ -231,7 +231,7 @@ const std::vector<list<__u16>> & Main::setupUinputMap() { - - if (uinputCecMap.empty()) { - uinputCecMap.resize(CEC_USER_CONTROL_CODE_MAX + 1, {}); - - uinputCecMap[CEC_USER_CONTROL_CODE_SELECT ] = { KEY_OK }; - + uinputCecMap[CEC_USER_CONTROL_CODE_SELECT ] = { KEY_OK, KEY_ENTER }; - uinputCecMap[CEC_USER_CONTROL_CODE_UP ] = { KEY_UP }; - uinputCecMap[CEC_USER_CONTROL_CODE_DOWN ] = { KEY_DOWN }; - uinputCecMap[CEC_USER_CONTROL_CODE_LEFT ] = { KEY_LEFT }; - @@ -244,7 +244,7 @@ const std::vector<list<__u16>> & Main::setupUinputMap() { - uinputCecMap[CEC_USER_CONTROL_CODE_SETUP_MENU ] = { KEY_SETUP }; - uinputCecMap[CEC_USER_CONTROL_CODE_CONTENTS_MENU ] = { KEY_MENU }; - uinputCecMap[CEC_USER_CONTROL_CODE_FAVORITE_MENU ] = { KEY_FAVORITES }; - - uinputCecMap[CEC_USER_CONTROL_CODE_EXIT ] = { KEY_EXIT }; - + uinputCecMap[CEC_USER_CONTROL_CODE_EXIT ] = { KEY_EXIT, KEY_Q }; - uinputCecMap[CEC_USER_CONTROL_CODE_NUMBER0 ] = { KEY_0 }; - uinputCecMap[CEC_USER_CONTROL_CODE_NUMBER1 ] = { KEY_1 }; - uinputCecMap[CEC_USER_CONTROL_CODE_NUMBER2 ] = { KEY_2 }; +a `libcec` client and have programs configured to handle them. Previous +versions of this guide were using the `libcec-daemon` client but we have now +switched to `ceckb` which is simpler and easy to build natively: + + http://git.2f30.org/ceckb/ + +At the moment of writing, the default configuration in `config.h` is this: + + struct map bindings[] = { + { CEC_USER_CONTROL_CODE_EXIT, KEY_Q }, + { CEC_USER_CONTROL_CODE_SELECT, KEY_ENTER }, + { CEC_USER_CONTROL_CODE_UP, KEY_UP }, + { CEC_USER_CONTROL_CODE_DOWN, KEY_DOWN }, + { CEC_USER_CONTROL_CODE_LEFT, KEY_LEFT }, + { CEC_USER_CONTROL_CODE_RIGHT, KEY_RIGHT }, + }; And made the program start automatically as a service using our beloved init system. -`/usr/local/lib/systemd/system/libcec-daemon.service`: +`/usr/local/lib/systemd/system/ceckb.service`: [Unit] - Description = CEC to uinput mapper + Description = libcec to uinput key event mapper After = remote-fs.target [Service] User = root Group = root Type = simple - ExecStart = /home/tv/bin/libcec-daemon + ExecStart = /home/tv/bin/ceckb Restart = always Note that similar results can be achieved using a LIRC setup. LIRC may