Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardware | LIRC does not work with current RPi 4.19 kernel #3481

Closed
AlexanderBykin opened this issue Apr 21, 2020 · 39 comments
Closed

Hardware | LIRC does not work with current RPi 4.19 kernel #3481

AlexanderBykin opened this issue Apr 21, 2020 · 39 comments
Labels
External bug 🐞 For bugs which are not caused by DietPi. Known Issue 🐛 Raspberry Pi Workaround available 🆗 Workaround is available/has been implemented, but a definite solution should be found when possible.
Milestone

Comments

@AlexanderBykin
Copy link

Creating a bug report/issue

Required Information

  • DietPi version |
G_DIETPI_VERSION_CORE=6
G_DIETPI_VERSION_SUB=28
G_DIETPI_VERSION_RC=0
  • Distro version | 10.2
  • Kernel version | Linux DietPi 4.19.93-v7+ #1290 SMP Fri Jan 10 16:39:50 GMT 2020 armv7l GNU/Linux
  • SBC device | RPi 3 Model A+ (armv7l)
  • Power supply used | 5V 1A RAVpower

Additional Information (if applicable)

  • Software title | Lirc - installed by APT
  • Was the software title installed freshly or updated/migrated? - fresh install
  • Can this issue be replicated on a fresh installation of DietPi? - yes

Steps to reproduce

  1. Install LIRC package
  2. setup configs
  3. send some IR-command by irsend

Expected behaviour

lircd receive signal and broadcast to clients

Actual behaviour

nothing received, also in logs Cannot configure the rc device for /dev/lirc0

Extra details

setup was done by this instruction without luck: https://github.com/mtraver/rpi-ir-remote
Used IR-receiver TSOP31238 and IR-led TSAL6200

Possible solution: downgrade kernel to 4.14 because many users told that LIRC work fine with that kernel version

How to downgrade kernel to 4.14 ?

@Joulinar
Copy link
Collaborator

Hi,

many thanks for your report. Basically this could be an answer on your question. But I never did this by my own. So don't know if this will work.

https://isahatipoglu.com/2015/09/29/how-to-upgrade-or-downgrade-raspberrypis-kernel-servoblaster-problem-raspberry-pi2/

@AlexanderBykin
Copy link
Author

dietpi doesn't have rpi-update utility

@Joulinar
Copy link
Collaborator

yes, you would need to install it as described an the link

apt-get update
apt-get install rpi-update

@AlexanderBykin
Copy link
Author

missed that part
ok, found kernel version 4.14.98 after run
sudo rpi-update a08ece3d48c3c40bf1b501772af9933249c11c5b
after success install and reboot i see uname -a outputs
Linux DietPi 4.19.93-v8+ #1290 SMP PREEMPT Fri Jan 10 16:51:04 GMT 2020 aarch64 GNU/Linux

it doesn't work

@Joulinar
Copy link
Collaborator

Joulinar commented Apr 21, 2020

hmm probably something to ask on the raspberry board as DietPi is not providing any own kernel. Maybe guys at raspberry knows whats going on. As I see it updated to 64Bit (aarch64), which is quite strange. Maybe is an issue to display current version correctly.

root@DietPi3:~# rpi-update a08ece3d48c3c40bf1b501772af9933249c11c5b
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
#############################################################
This update bumps to rpi-4.14.y linux tree
Be aware there could be compatibility issues with some drivers
Discussion here:
https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=197689
##############################################################
 *** Downloading specific firmware revision (this will take a few minutes)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   168  100   168    0     0    437      0 --:--:-- --:--:-- --:--:--   437
100 56.3M    0 56.3M    0     0  1800k      0 --:--:--  0:00:32 --:--:-- 2388k
 *** Updating firmware
 *** Updating kernel modules
 *** depmod 4.14.98-v7+
 *** depmod 4.14.98+
 *** Updating VideoCore libraries
 *** Using HardFP libraries
 *** Updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to a08ece3d48c3c40bf1b501772af9933249c11c5b
 *** A reboot is needed to activate the new firmware
root@DietPi3:~# reboot

available kernel modules should be visible at ls -la /lib/modules/

@AlexanderBykin
Copy link
Author

ls shown this

root@DietPi:/# ls -la /lib/modules/
total 32
drwxr-xr-x  8 root root 4096 Apr 21 11:38 .
drwxr-xr-x 17 root root 4096 Apr 21 11:37 ..
drwxr-xr-x  3 root root 4096 Apr 21 11:39 4.14.98+
drwxr-xr-x  3 root root 4096 Apr 21 11:38 4.14.98-v7+
drwxr-xr-x  3 root root 4096 Jan 25 17:03 4.19.93+
drwxr-xr-x  3 root root 4096 Jan 25 17:12 4.19.93-v7+
drwxr-xr-x  3 root root 4096 Jan 25 17:03 4.19.93-v7l+
drwxr-xr-x  3 root root 4096 Jan 25 17:03 4.19.93-v8+

@MichaIng
Copy link
Owner

@AlexanderShniperson
Kernel 4.14 is installed but 4.19 is still there as well. To see which is active: ls -Al /boot
One problem is indeed that you enabled 64 bit kernel and the 64 bit kernel modules might not be compatible with 32 bit user space software, like lircd. There is a /DietPi/config.txt to enable/disable 64 bit kernel and this is what I would try first before downgrading the kernel.

@AlexanderBykin
Copy link
Author

@MichaIng today i also try to setup LIRC by instrunction from elmicha commented on 30 May 2019
when i try to send signal
irsend --device=/var/run/lirc/lircd-tx SEND_ONCE TANK-64 KEY_0
i got message

Apr 22 11:06:21 DietPi lircd[3352]: lircd-0.10.1[3352]: Error: error processing command: SEND_ONCE TANK-64 KEY_0
Apr 22 11:06:21 DietPi lircd[3352]: lircd-0.10.1[3352]: Error: transmission failed
Apr 22 11:06:21 DietPi lircd[3352]: lircd-0.10.1[3352]: Info: removed client
Apr 22 11:06:21 DietPi lircd-0.10.1[3352]: Error: invalid send buffer
Apr 22 11:06:21 DietPi lircd-0.10.1[3352]: Error: this remote configuration cannot be used to 
transmit
Apr 22 11:06:21 DietPi lircd-0.10.1[3352]: Error: error processing command: SEND_ONCE TANK-64 
KEY_0
Apr 22 11:06:21 DietPi lircd-0.10.1[3352]: Error: transmission failed

@AlexanderBykin
Copy link
Author

and also try to patch LIRC with that instruction from Raspbian Buster section without luck
also try to run on a fresh DietPi install on RPI Zero and updated Kernel without luck
Linux DietPi 4.19.115+ #1305 Fri Apr 17 11:47:30 BST 2020 armv6l GNU/Linux

@AlexanderBykin
Copy link
Author

@MichaIng do you have any success story with LIRC?

@AlexanderBykin
Copy link
Author

i run lircd --nodaemon -Dtrace2 and see logs, looks like LIRC can't find needed device as it say

Apr 25 13:49:39 DietPi lircd[862]: lircd-0.10.1[862]: Debug: No device found: /sys/class/rc/rc1/lirc0
Apr 25 13:49:39 DietPi lircd[862]: lircd-0.10.1[862]: Debug: Cannot open protocol file: /sys/class/rc/rc
0/protocols for read
Apr 25 13:49:39 DietPi lircd[862]: lircd-0.10.1[862]: Info: Cannot configure the rc device for /dev/lirc
0
Apr 25 13:49:39 DietPi lircd[862]: lircd-0.10.1[862]: Trace: driver supports sending
Apr 25 13:49:39 DietPi lircd-0.10.1[862]: Trace: registering inet client
Apr 25 13:49:39 DietPi lircd-0.10.1[862]: Notice: accepted new client from 127.0
.0.1
Apr 25 13:49:39 DietPi lircd-0.10.1[862]: Debug: No device found: /sys/class/rc/
rc1/lirc0
Apr 25 13:49:39 DietPi lircd-0.10.1[862]: Debug: Cannot open protocol file: /sys
/class/rc/rc0/protocols for read
Apr 25 13:49:39 DietPi lircd-0.10.1[862]: Info: Cannot configure the rc device for /dev/lirc0
Apr 25 13:49:39 DietPi lircd-0.10.1[862]: Trace: driver supports sending

@AlexanderBykin
Copy link
Author

so looks like i got working config and placed setup at the repo
seems to be working and data sends but receiver decode signal wrong, that we can see at journalctl -fu lircd

@MichaIng
Copy link
Owner

@AlexanderShniperson
Great that it finally works and for shairing your solution.

@MichaIng do you have any success story with LIRC?

Sadly I personally never used LIRC/IR on the Raspberry Pi. I would have expected that enabling the related dtoverlay and installing the lirc package should basically do the job, sad that it isn't hat easy.


On RPi we have this "JustBoom IR remote" option in dietpi-config > Display Options, for MPD remote control. I never tested it or worked on it (was done by prior devs), but what we do is:

Even that it is a special use case, probably it helps. The other way round probably our remote control implementation is outdated or does not work OOTB for the same reason.

@AlexanderBykin
Copy link
Author

i've inspected output of ir-keytable

Found /sys/class/rc/rc0/ (/dev/input/event4) with:
	Name: gpio_ir_recv
	Driver: gpio_ir_recv, table: rc-rc6-mce
	LIRC device: /dev/lirc1
	Attached BPF protocols: Operation not supported
	Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon 
	Enabled kernel protocols: lirc rc-6 
	bus: 25, vendor/product: 0001:0001, version: 0x0100
	Repeat delay = 500 ms, repeat period = 125 ms

and see that by default is enabled lirc rc-6 protocols, i think should be used related protocol to send and receive data, because now is see output of journalctl -fu lircd

Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: expecting pulse: 9000
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: +p208
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: unget: 1
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace: failed on header
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace: decoding failed for all remotes
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: pending pulse: 0
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: pending space: 0
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace: trying "TEST" remote
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: pending pulse: 0
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: pending space: 0
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: <p208
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace1: space expected
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace: failed on sync
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace: decoding failed for all remotes
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: c18530
Apr 25 20:54:24 DietPi lircd-0.10.1[384]: Trace2: pending pulse: 0
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace2: pending space: 0
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace: trying "TEST" remote
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace2: pending pulse: 0
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace2: pending space: 0
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace2: <p18530
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace1: space expected
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace: failed on sync
Apr 25 20:54:26 DietPi lircd-0.10.1[384]: Trace: decoding failed for all remotes

@MichaIng
Copy link
Owner

@AlexanderShniperson

Attached BPF protocols: Operation not supported

That is btw expected on RPi. BPF is a new kernel packet filter (firewall) that has not been enabled on recent RPi kernels yet. They just enabled nftables not too long ago.

Enabled kernel protocols: lirc rc-6

Looks right to me, although I have no deeper knowledge about those protocols and especially how to configure the adapters to use a certain protocol.

LIRC device: /dev/lirc1

Interesting that it's lirc1 and not lirc0.

And another think I just found:

/etc/lirc/lircd.conf.d README
=============================

Files in this directory are as distributed included by the main
/etc/lirc/lircd.conf. Only files matching '*.conf' are included.

As distributed, here is a single file devinput.lircd.conf. This should
be used with the devinput driver which is enabled by default. When using
another driver, disable the devinput file e. g., by renaming it to
devinput.lircd.dist.

lircd normally (tries to) sort the remotes so the ones which decodes fastest
are used first. If you want to sort your configs manually, see the
Configuration Guide on using multiple remotes.

@AlexanderBykin
Copy link
Author

i start thinking that send and receive signal on the same Raspberry is impossible in case of usage Raspberry Zero that have 1 core, i will check with two devices, one send signal and second receive.
just checked devinput driver and see a lof of false positive signals sending from nowhere

@AlexanderBykin
Copy link
Author

Hooray, its works, connected to socket opened at RPi that receive IR data and got message, updated configs at my repo

@GlennFR
Copy link

GlennFR commented Apr 27, 2020

Hi, I'm glad you got something working! Can you please resume your step-by-step installation so that I, and others, can follow? I can't even get lircd to run, it always fails.
Thanks, in advance!

@AlexanderBykin
Copy link
Author

@GlennFR hi, i summarized all my work in repo
just install lirc apt-get install lirc and then read steps at my readme file, also as would be needed install patched lirc, it's also there

@GlennFR
Copy link

GlennFR commented Apr 27, 2020 via email

@AlexanderBykin
Copy link
Author

if you need help i've recommend you to open issue at my Repo, because it's not related to this thread.
will try to help as i can.

@MichaIng MichaIng added Workaround available 🆗 Workaround is available/has been implemented, but a definite solution should be found when possible. External bug 🐞 For bugs which are not caused by DietPi. and removed Question ❔ Kernel related 🧬 labels Apr 27, 2020
@MichaIng MichaIng changed the title LIRC does not work with 4.19 kernel Hardware | LIRC does not work with current RPi 4.19 kernel Apr 27, 2020
@AlexanderBykin
Copy link
Author

maybe is there a way to get source of 0.10.1-6-1 version to build them at Raspberry with Buster ?

@MichaIng
Copy link
Owner

@AlexanderShniperson
They are available at the links above as well:

However I think the packages you have with patch included are fine already, the upstream source is still the same anyway.

@AlexanderBykin
Copy link
Author

oh, a lot of work needs to be done to compile 0.10.1-6-1 version, in case of existing patched and working 0.10.1-5.2 version this work demotivates me.
before i requested source i think there is already patched version that just need to be compiled

@MichaIng
Copy link
Owner

@AlexanderShniperson
I think the debhelper tools build with the patches automatically. However yeah probably not worth it to do the effort as long as we have working packages already. Probably I'll do that by times when the patches are not backported to Buster soon.

@MichaIng MichaIng modified the milestones: v6.30, v6.31 May 10, 2020
@MichaIng MichaIng modified the milestones: v6.31, v6.32 Jun 24, 2020
@MichaIng
Copy link
Owner

MichaIng commented Jul 3, 2020

@AlexanderShniperson
To switch over here, did you try to resolve by going forward to current Linux 5.4 branch?

apt install rpi-update
rpi-update

And here is as well a solution going back to the "deprecated" kernel module: https://gist.github.com/prasanthj/c15a5298eb682bde34961c322c95378b
The discussion around this issue on RPi forum: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=235256

@AlexanderBykin
Copy link
Author

AlexanderBykin commented Jul 3, 2020

To switch over here, did you try to resolve by going forward to current Linux 5.4 branch?

No i don't but will try.

The code in my repository is the union of several articles and solutions, also in my repo i was linked last link as a base solution

@AlexanderBykin
Copy link
Author

AlexanderBykin commented Jul 12, 2020

@MichaIng experiment end without luck, success update to kernel 5.4 doesn't give positive effect with original lirc library and also with patched.
so i did a trick and installed dietpi-stretch and downgrade kernel to 4.14 by

  1. rpi-update a08ece3d48c3c40bf1b501772af9933249c11c5b
  2. installed lirc by default for stretch is coming lirc 0.9.4.c and setup them just write to /Dietpi/config.txt line dtoverlay=lirc-rpi,gpio_in_pin=17,gpio_out_pin=18
  3. also used default driver and lirc0 as receiver/transmitter device at /etc/lirc/lirc_options.conf
driver          = default
device          = /dev/lirc0

so now all works as expected!

@MichaIng
Copy link
Owner

Doesn't work the "new" dtoverlay gpio-ir with kernel 4.14? Ah, better not mess with a running system 😄.

There seem to be other IR issues with RPi4, failing irrecord: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=235256&start=50#p1686574
Also some other solutions (installing, then removing lirc package again) don't look like something that will work in every case and sustainable. With my limited IR experience it all looks like one needs to to try&error to find a solution that works for the particular case with the particular RPi model, but sadly not just a single bug with a single patch that we could apply to recover generic IR for all RPi users 😢. I can only hope the devs come up with a broader rework to make dtverlays and userland packages work again as expected. Probably its already in making or done but not yet released to stable APT repositories (dtoverlays/kernel as well as userland tools).

@AlexanderBykin
Copy link
Author

gpio-ir is part of kernel starting from 4.19.x so at 4.14.x we should use lirc-rpi
yes, something was broken starting from kernel 4.19.x and someone should try to fix that, until that fixed we will have a problem

@MichaIng
Copy link
Owner

gpio-ir is part of kernel starting from 4.19.x so at 4.14.x we should use lirc-rpi

Ah okay makes sense somehow, although I'm confused now whether gpio-ir then was buggy right from the start, so this new dtoverlay is the issue and not so much kernel 4.19... From my end I'll wait for for the new 5.4 kernel release before investigating deeper, to not waste time for a solution which might then be obsolete.

@AlexanderBykin
Copy link
Author

@MichaIng
looks like after kernel downgrade i've lost access to my camera, because when i run raspistill i got error message failed to open vchiq instance and no device with that name exists at dev

do you have any idea why?

@AlexanderBykin
Copy link
Author

AlexanderBykin commented Jul 19, 2020

by googling i found similar problem where folks talk about wrong kernel mailboxing bcm2835_vchiq 2000b840.mailbox: Missing firmware node and the problem related to wrong DTB files when downgrade kernel, so i just take this commit and

  1. replaced all files at /boot folder and removed /boot/bcm2708-rpi-zero-w.dtb
  2. replaced /lib/modules
  3. replaced /opt/vc folder

now camera and lirc works fine together at kernel 4.14.x

@MichaIng
Copy link
Owner

MichaIng commented Sep 28, 2020

Meanwhile lirc v0.10.1-6.2 has been merged into Buster, so probably the issue is fixed with current kernel and APT packages: https://packages.debian.org/buster/lirc

@MichaIng
Copy link
Owner

I mark this as closed. Feel free to reopen if issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External bug 🐞 For bugs which are not caused by DietPi. Known Issue 🐛 Raspberry Pi Workaround available 🆗 Workaround is available/has been implemented, but a definite solution should be found when possible.
Projects
None yet
Development

No branches or pull requests

4 participants