Posts by HiassofT

    Just verified: the tools/lirc-make-devinput from the lirc source is picking up headers from the build host and due to cross-compiling the generated input_map.inc won't overwrite the shipped input_map.inc files (as a normal build would do) - so there's another risk of differing files during compilation.

    I'm already working on a patch, will drop you a line tomorrow after I ran some tests.

    so long,

    Hias


    Hmm, I had now tested the 7.95.2 image from website and this image is working...
    A clean build of the tag 7.95.2 does not work...

    Which OS are you running on your build system?

    Could you check the build files - here with Debian Jessie (and ancient kernel headers) it looks like this:

    Code
    hias@tv:~/rpi/libreelec-8.0$ grep -r -l KEY_RIGHT_UP build.LibreELEC-RPi2.arm-7.95.2/lirc-0.9.4c/.armv7ve-libreelec-linux-gnueabi/
    hias@tv:~/rpi/libreelec-8.0$ grep -r -l KEY_RIGHT build.LibreELEC-RPi2.arm-7.95.2/lirc-0.9.4c/.armv7ve-libreelec-linux-gnueabi/
    build.LibreELEC-RPi2.arm-7.95.2/lirc-0.9.4c/.armv7ve-libreelec-linux-gnueabi/lib/input_map.inc
    build.LibreELEC-RPi2.arm-7.95.2/lirc-0.9.4c/.armv7ve-libreelec-linux-gnueabi/lib/.libs/input_map.o
    build.LibreELEC-RPi2.arm-7.95.2/lirc-0.9.4c/.armv7ve-libreelec-linux-gnueabi/lib/.libs/liblirc.so.0.0.0

    The lirc build might be picking up headers from the build host, that could explain the differences.

    so long,

    Hias

    Thanks for the feedback, I was just able to reproduce this too (by doing a hard reset from the libreelec setttings addon).

    But this is another, one-off thing that most certainly doesn't have anything to do with the KEY_RIGHT issue.

    It's not a race between lircd and lircd-uinput, the condition is not on the socket (IIRC it was some time before, but that's not the case here).

    Although annoying, just do another reboot and it should be fine. Let's ignore that for now and focus on the KEY_RIGHT issue. Anything odd at systemctl status or input grabbing would be interesting to look at.

    so long,

    Hias


    I found another problem, which breaks some tests. When start with a new image (over img.gz), the complete remote is not working in first boot. (lircd-uinput is not running, condition file does not exist). after the second boot, all services are up and remote is working.
    This is independent from the LEFT/RIGHT-key problem, but some test, i had to repeat.
    :sick:


    This is very interesting info - I've suspected before that the lircd systemd config is racy and could lead to such things.

    If lircd-uinput is scheduled to start before lircd has created the socket the ConditionPathExist (on the socket) will fail and lircd-uinput won't start. The upstream systemd config does this differently, the socket is create via an independent systemd config (lircd.socket): LIRC / Git / [0d26f0] /systemd

    Could you please try to reproduce this and when it happens grab the systemctl status of the services? the boot log would also be interesting:

    Code
    systemctl status lircd@lirc0
    systemctl status lircd-uinput@lirc0
    systemctl status eventlircd
    journalctl -a | paste

    It could be that we have another race between eventlircd and kodi grabbing the event input device. If kodi grabs it before eventlircd the button presses should show up as keyboard input instead of LIRC input in kodi.log and systemctl status eventlircd will contain an error message that the input device has already been grabbed by another process. So far I haven't seen this in the wild but could provoke it manually by stopping and then starting eventlircd while kodi is running.

    so long,

    Hias
    [hr]
    Please check another thing in addition to the stuff I just posted:

    With lsof and grep we can quickly verify who grabbed which input device. So if there's a race between kodi and eventlircd we should be able to verify it:

    First find out which event device is which physical/virtual device:

    Code
    LibreELEC:~ # grep . /sys/class/input/event?/device/name
    /sys/class/input/event0/device/name:Logitech K400
    /sys/class/input/event1/device/name:lircd-uinput
    /sys/class/input/event2/device/name:eventlircd

    Now run lsof to see which process is using which input device:

    Code
    LibreELEC:~ # lsof | grep /dev/input/event
    268     /usr/sbin/eventlircd    /dev/input/event1
    436     /usr/lib/kodi/kodi.bin  /dev/input/event0
    436     /usr/lib/kodi/kodi.bin  /dev/input/event2


    Here we see that kodi is using event0 (my logitech keyboard) and event2 (eventlircd, for receiving BTN_events) while eventlircd is reading from lircd-uinput. That's fine so far.

    But if I restart eventlircd while kodi is running kodi will grab the lircd-uinput device, and eventlircd can't grab it and errors out. So eventlircd is bypassed.

    Code
    LibreELEC:~ # systemctl stop eventlircd
    LibreELEC:~ # systemctl start eventlircd
    LibreELEC:~ # lsof | grep /dev/input/event
    436     /usr/lib/kodi/kodi.bin  /dev/input/event1
    436     /usr/lib/kodi/kodi.bin  /dev/input/event0


    And we can see eventlircd status is failed:

    Of course we shouldn't manually restart eventlircd while kodi is running as this will provoke issues - this was just to illustrate the error scenario that could happen when there's a race between eventlircd and kodi grabbing the lircd-uinput device.

    so long,

    Hias

    I ran some tests with 7.95.2 but unfortunatley couldn't reproduce the issue locally. But I have a few more things for you to try to narrow down the issue.

    First of all, the --release=XXX settings of lircd and lircd-uinput have to match, otherwise we get repeating keys. lircd defaults to no release lirc event, lircd-uinput defaults to _UP.

    The --release option of eventlircd can be dropped though, kodi doesn't seem to know what to do with that.

    For testing, install the system tools addon (in the LibreELEC programs addon catetory), that'll give you evtest (you can also use ir-keytable to monitor input events but you need to know which input event device to monitor - evtest will display a nice list on startup you can select from).

    Then, stop kodi, eventlircd, lircd and lircd-uinput: and verify they are really gone (stopping lircd via systemctl doesn't seem to work, therefore killall was needed):

    Code
    LibreELEC:~ # systemctl stop kodi
    LibreELEC:~ # systemctl stop eventlircd
    LibreELEC:~ # systemctl stop lircd-uinput@lirc0
    LibreELEC:~ # systemctl stop lircd@lirc0
    LibreELEC:~ # killall lircd
    LibreELEC:~ # ps | grep lirc
      590 root       0:00 grep lirc

    Now start lircd manually. I did this via the following command line (you need to use /etc/lirc/lircd.conf.rpi as a configuration file):

    Code
    LibreELEC:~ # /usr/sbin/lircd --loglevel=debug --release=_UP --nodaemon --driver=default --device=/dev/lirc0 --output=/run/lirc/lircd-lirc0 --pidfile=/run/lirc/lircd-lirc0.pid /storage/.config/lircd.conf
    Warning: cannot open /etc/lirc/lirc_options.conf
    lircd-0.9.4c[592]: Debug: lircd:  Opening log, level: Debug
    lircd-0.9.4c[592]: Warning: Running as root
    lircd-0.9.4c[592]: Info: Using remote: hauppaugeHias.
    lircd-0.9.4c[592]: Notice: lircd(default) ready, using /run/lirc/lircd-lirc0


    In another terminal verify that lircd is running correctly. Start irw, press a few keys and then stop irw with ctrl-c


    The count (second value) should go up if you hold down the key and it's repeating. When releasing the key you should see a "virtual" release key with the KEYNAME_UP event (_UP as configured with --release=_UP)

    If that's working fine, stop irw and run lircd-uinput. Again press some keys:


    Here note that event code at the end: 106:1 means keycode 106, pressed, 106:0 means released.

    If the --release setting doesn't match the one from lircd lircd-uinput won't generate a input release event, resulting in endlessly repeating keys.

    You can verify that using evtest. With lircd and lircd-uinput both set to _UP you should get this:


    value 1 (at the very end) means initial keypress, 2 is repeating keypress, 0 is release.

    In the snipped part evtest reports all the key/eventcodes it'll handle, but doesn't show a symbolic name for keycode 614 decimal / 0x266 hex etc - evtest seems to be too old to know about these.

    Doing the same test with ir-keytable instead of evtest results in this output:

    Code
    LibreELEC:~ # ir-keytable -d /dev/input/event1 -t
    Testing events. Please, press CTRL-C to abort.
    1486155236.010594: event type EV_KEY(0x01) key_down: KEY_RIGHT(0x0001)
    1486155236.010594: event type EV_SYN(0x00).
    1486155237.015482: event type EV_KEY(0x01) key_down: KEY_RIGHT(0x0001)
    1486155237.015482: event type EV_SYN(0x00).
    1486155237.052144: event type EV_KEY(0x01) key_down: KEY_RIGHT(0x0001)
    1486155237.052144: event type EV_SYN(0x00).
    1486155237.074032: event type EV_KEY(0x01) key_up: KEY_RIGHT(0x0001)
    1486155237.074032: event type EV_SYN(0x00).


    It's basically the same output like with evtest, but the press/hold/release value isn't reported.

    Once we've verified that lircd-uinput is working correctly we can bring eventlircd into play. Let's do that without the --release option first:

    Code
    LibreELEC:~ # /usr/sbin/eventlircd -f -vvv --evmap=/etc/eventlircd.d --socket=/run/lirc/lircd
    eventlircd[648]: input device /dev/input/event1: events of unsupported event type EV_REP will be discarded
    eventlircd[648]: input device /dev/input/event1: grabbed
    eventlircd[648]: input device /dev/input/event1: created output event device

    Now let's verify with irw that eventlircd correctly translates the input events into lirc events:


    Here I pressed right two times for a longer period. During repeats the second value counts up, after release the next keypress with start with count 0 (here it counted from 0-8 two times).

    If you start eventlircd with the --release option you should also get the "virtual" lirc up events (here I used _UP_FROM_EVENTLIRCD just to make it clear where they are coming from):

    Code
    LibreELEC:~ # /usr/sbin/eventlircd -f -vvv --evmap=/etc/eventlircd.d --socket=/run/lirc/lircd --release=_UP_FROM_EVENTLIRCD
    eventlircd[657]: input device /dev/input/event1: events of unsupported event type EV_REP will be discarded
    eventlircd[657]: input device /dev/input/event1: grabbed
    eventlircd[657]: input device /dev/input/event1: created output event device
    Code
    LibreELEC:~ # irw /run/lirc/lircd
    6a 0 KEY_RIGHT devinput
    6a 1 KEY_RIGHT devinput
    6a 2 KEY_RIGHT devinput
    6a 0 KEY_RIGHT_UP_FROM_EVENTLIRCD devinput

    Please repeat these steps and compare the output with mine. Then repeat the test with lircd and lircd-uinput both started with --release=_FAKEUP (or something like that that's not _UP). Please post all the outputs so I can also have a closer look at them.

    so long,

    Hias


    EDIT: in /usr/include/linux/input-event-codes.h is KEY_RIGHT_UP and KEY_LEFT_UP defined... may we need an other SUFFIX, then _UP?
    (edit1.b: was introduced with v4.7-rc6)


    Cool, this looks like a very possible explanation for your issues!

    I'll run some tests myself and see if I can reproduce - not sure why I haven't seen any issues yet (if KEY_RIGHT_UP is now a valid event I should be able to see some odd behaviour).

    I'll report back after I finished my tests (could maybe take until tomorrow or so).

    so long & thanks a lot for digging into this,

    Hias


    @ Hias - will test that sure!

    Only thing is though - why would that I2S thing effect the Pi Zero but not the Pi B+ or any of the others?

    Phil added that I2S thingy (actually changing the DMA priorities) because under some conditions the I2S stream would get out of sync and result in garbage output (mostly noise or so). That only happened on the RPi3 and only with the downstream DMA code but not the upstream one - so that was very mysterious as well (at least to me).

    I might be barking up the wrong tree, but the mysteriousness of the RPi0 issue remembered me of the other mysterious one :)

    BTW: Another interesting test would be to check if you get the same issues on Raspbian if you use kernel 4.9 (sudo BRANCH=next rpi-update).

    so long,

    Hias

    Thanks again for testing!

    I'm not quite sure if the lirc socket check is actually the culprit, so could you please also test the milhouse builds in between? Do a simple bisect until you found the first build that introduces the issue (for example #0101 OK, #0102 not OK) - that should help us narrow down the exact cause.

    Full list of builds with easy access is here: LibreELEC Testbuilds for RaspberryPi (Kodi 18.0)

    so long,

    Hias


    Both configs tested with 7.95.2 Hiassofts is working, my not...
    Very confusing..


    Thanks a lot for testing, and it's good to know that gpio-ir-recv is working fine!

    Did you add some special customizations or config settings?

    Please run a test with a clean installation of 7.95.2 and only the following line added to config.txt (keep everything else stock):

    Code
    dtoverlay=lirc-rpi


    Then, run the following command and post the output (we should see that lircd is running and using /etc/lirc/lircd.conf.rpi):

    Code
    ps | grep lirc

    It could well be that something's not 100% working correctly with userspace lircd. As I've tested with a different remote I can't rule out that something's wrong with the MCE remotes or lircd.conf.rpi config file. But that's just a guess,it would be great if we could narrow it down. Unfortunately I don't have an MCE remote so we'll need your help.

    Or it could also be that you need to add some lirc-rpi parameters to config.txt like gpio_in_pull=up.

    so long,

    Hias

    Thanks a lot for the feedback!

    MagnaVis  JustBoom could you run a test with my 7.0.3 build with Cirrus Logic audio card drivers?
    LibreELEC-RPi.arm-7.0.3-HiassofT.tar

    This build is official 7.0.3 version plus kernel 4.9 (as opposed to 4.4 in official 7.0.3) plus drivers for the cirrus card (the latter shouldn't hurt you in testing).

    I'm suspecting it could be something in the kernel, quite a lot has changed between 4.4 and 4.9. For example 4.4 includes an additional patch to the I2S driver that's not in 4.9 - not sure if this could be the culprit
    bcm2835-i2s: Reduce the TX DREQ threshold · raspberrypi/linux@3de2328 · GitHub

    so long,

    Hias

    I just did a test with a clean install of the latest preview of the upcoming 7.95.2 version and my remote worked fine.

    I've been using an RPi2, a gpio IR receiver, lirc-rpi overlay in the kernel plus a custom lircd.conf for my hauppauge remote (the default lircd.conf.rpi doesn't support that).

    Please run a test when the new 7.95.2 version is out, it should be released very soon.

    BTW: instead of using the lircd-rpi overlay you could also try using the gpio-ir overlay (the latter doesn't need userspace lirc but uses in-kernel decoding like most of the USB IR receivers do). To use it add the following line to config.txt (and remove the lirc-rpi overlay):

    Code
    dtoverlay=gpio-ir,gpio_pin=18,gpio_pull=1,rc-map-name=rc-rc6-mce

    adjust the gpio_pin and gpio_pull parameters as needed (they have the same meaning as the corresponding lirc-rpi parameters), if you want to use something else than a RC6 MCE remote change the rc-map-name parameter as well (see the module files in /lib/modules/<kernelversion>/kernel/drivers/media/rc/keymaps).

    so long,

    Hias

    Thanks a lot for testing!

    I've been in contact with popcornmix, he could reproduce the issue and told me Phil Elwell will have a look at it. Something really strange seems to be going on with the RPi zero - it's almost identical to the RPi1 B+ so it's rather puzzling why the RPi1 works fine but not the RPi0.

    I'll keep you posted if I hear of any updates on that issue.

    so long,

    Hias

    There's currently no option to disable eventlircd, the service will be started unconditionally.

    But eventlircd is configurable via udev rules - it'll only grab the input devices matched by the udev rules and translate their input events into lirc events (the current udev rules basically matches all IR receivers, i.e. all remote commands are run through this translation service).

    So another possibility to (logically) disable eventlircd is to create an empty udev rule file - the button-presses should then show up as input/keyboard events in kodi instead of lirc events.

    Code
    : > /storage/.config/udev.rules.d/98-eventlircd.rules

    One benefit of not using eventlircd is that long-press button handling should work in kodi. I haven't checked for quite a while, but about half a year ago there was no longpress support for lirc remotes, but it did work well if eventlircd was bypassed.

    But there are also several drawbacks:

    Most importantly bypassing eventlircd isn't tested too well in LibreELEC so there could be bugs.

    One issue I ran into was that Kodi couldn't handle quite a lot of the default input events on the RPi - most prominently "KEY_OK" but also KEY_CHANNELUP/DOWN and several other ones don't work. I've posted some more info on this issue on the XBMC/Kodi bugtracker half a year ago: #15797 (XBMCK_UNKNOWN returned for some key codes, unable to map with key id=xxx) – Kodi - TRAC

    x86 and RPi are quite different though, on x86 you have X11 running and probably some additional input/event translation in between (not 100% sure, never tried running OpenELEC/LibreELEC on x86). On the RPi there's no X11 and Kodi will be directly talking to the Linux input/event interface.

    So: if you see some unsupported key messages in kodi.log you'll probably have to change the ir-keytable.

    It's still quite puzzling why you have a non-working remote after every other reboot.

    Could you enable debug logging in Kodi and then post the kodi.log after you got a non-working remote?

    Also, when the remote is not working, try stopping kodi and see if you can receive any events with ir-keytable -t.

    Maybe the culprit is also some X11 service or configuration - I won't rule out anything at this point:)

    so long,

    Hias

    According to the infos on the hifiberry site the DAC+ Light uses a different DAC chip (ESS sabre) than the standard DAC+ (pcm5122). This means the hifiberry-dacplus overlay most certainly won't work.

    Not sure what the correct dtoverlay would be, there doesn't seem to be any matching one in the official RPi 4.4 and 4.9 kernels. Better contact the hifiberry guys about that.

    so long,

    Hias


    Unfortunately I don't have a RPi Zero (they still seem to be impossible to get) so can't test myself.

    Could you run a test with the latest Milhouse build? LibreELEC Testbuilds for RaspberryPi (Kodi 18.0)
    Testing with a kernel 4.10-rc Milhouse build would also be interesting LibreELEC Testbuilds for RaspberryPi (Kodi 18.0)

    If they also fail please post the output of tvservice -s before and after the display blanks and please also post the dmesg log after display blank.

    so long,

    Hias


    Also one more question : did anybody notice that when we connect RPi2 and Wolfson, some of the 8 big pins from Wolfson make contact with elements on the Pi board ? Is it supposed to be like this? I put some tape there not to short anything.


    This sounds like you are trying to use the original Wolfson card for the RPi1 (with 26 pin GPIO connector plus 8 pogo-pins for the P5 connetor). If that's the case - sorry, that won't work, you need to use the Cirrus card (with 40 pin GPIO and no pogo pins) on RPi2 (and all other B+ models with 40-pin GPIO connector).

    so long,

    Hias