Closed berni123 closed 6 months ago
I would guess that's an oversight from https://github.com/flathub/tv.kodi.Kodi/commit/899d34823ed144a27a6ef406178bd57c8767106c
I would guess that's an oversight from 899d348
Probably I am the only one in the world trying to use lirc with flathub/kodi ...
I can prepare a test build later today
It's unfortunatly not as easy as we hoped for, the library needs to be patched, as it tries to write to the system, I think.
Well, hope you can fix it, because it would be nice to use kodi with a remote control connected via lirc
Is there any chance to patch the lirc package to get it running? Would love to run it with lirc and remote control ... In the log of the pull request the error occurs on running the install script because it want to create a systemctl service which is quite normal for a service ...
You'll need to write a patch disabling systemd
Well I as the error in the build log is at "/usr/bin/mkdir: cannot create directory ‘/lib/systemd’: Read-only file system", I might think to "disable", you only have to remove it from the automake feature. So modify Makefile.am and configure.ac, rerun aclocal, autoconf, automake and the build process with ./configure, make, make install will run without systemd installation.
vdr@vdr1:~/KODI/lirc-0.10.2_patched$ diff Makefile.am ../lirc-0.10.2/Makefile.am
39,40c39,40
< ##AM_DISTCHECK_CONFIGURE_FLAGS = \
< ## --with-systemdsystemunitdir=$${dc_install_base}/lib/systemd/system
---
> AM_DISTCHECK_CONFIGURE_FLAGS = \
> --with-systemdsystemunitdir=$${dc_install_base}/lib/systemd/system
44,46c44,46
< ##if WITH_SYSTEMDSYSTEMUNITDIR
< ## SYSTEMD_DIR = systemd
< ##endif
---
> if WITH_SYSTEMDSYSTEMUNITDIR
> SYSTEMD_DIR = systemd
> endif
vdr@vdr1:~/KODI/lirc-0.10.2_patched$ diff configure.ac ../lirc-0.10.2/configure.ac
210c210
< #AH_TEMPLATE([HAVE_SYSTEMD], [defined if systemd API is available])
---
> AH_TEMPLATE([HAVE_SYSTEMD], [defined if systemd API is available])
422,427c422,427
< #PKG_CHECK_MODULES([SYSTEMD],[libsystemd-daemon],,[true])
< #test -n "$SYSTEMD_LIBS" || PKG_CHECK_MODULES([SYSTEMD],[libsystemd],,[true])
< #if test -n "$SYSTEMD_LIBS"; then
< # CFLAGS="$CFLAGS $SYSTEMD_CFLAGS"
< # AC_DEFINE(HAVE_SYSTEMD)
< #fi
---
> PKG_CHECK_MODULES([SYSTEMD],[libsystemd-daemon],,[true])
> test -n "$SYSTEMD_LIBS" || PKG_CHECK_MODULES([SYSTEMD],[libsystemd],,[true])
> if test -n "$SYSTEMD_LIBS"; then
> CFLAGS="$CFLAGS $SYSTEMD_CFLAGS"
> AC_DEFINE(HAVE_SYSTEMD)
> fi
437,446c437,446
< #dnl Ubuntu's systemd pkg-config seems broken beyond repair. So:
< #kernelversion=`cat /proc/version || echo "non-linux"`
< #AS_CASE([$kernelversion],
< # [*Ubuntu*],[
< # AC_MSG_NOTICE([Hardwiring Ubuntu systemd setup])
< # AC_SUBST([systemdsystemunitdir], [/lib/systemd/system])
< # AM_CONDITIONAL([WITH_SYSTEMDSYSTEMUNITDIR], [true])
< # ],[*],[
< # SYSTEMD_SYSTEMUNITDIR
< #])
---
> dnl Ubuntu's systemd pkg-config seems broken beyond repair. So:
> kernelversion=`cat /proc/version || echo "non-linux"`
> AS_CASE([$kernelversion],
> [*Ubuntu*],[
> AC_MSG_NOTICE([Hardwiring Ubuntu systemd setup])
> AC_SUBST([systemdsystemunitdir], [/lib/systemd/system])
> AM_CONDITIONAL([WITH_SYSTEMDSYSTEMUNITDIR], [true])
> ],[*],[
> SYSTEMD_SYSTEMUNITDIR
> ])
528a529
> systemd/Makefile
then run: aclocal autoconf automake
... perhaps that helps ...
Unfortunately I don't know how to patch this under flatpak to get it running with the three commands building the new autoconf files ...
Again: just trying to build kodi with flatpak-builder via make build and while compiling the build.log shows:
Building module lirc in /home/vdr/KODI/tv.kodi.Kodi/.flatpak-builder/build/lirc-1
========================================================================
checking for a BSD-compatible install... /usr/bin/install -c
[...]
make[4]: Entering directory '/run/build/lirc'
make[4]: Leaving directory '/run/build/lirc'
make[3]: Leaving directory '/run/build/lirc'
make[2]: Leaving directory '/run/build/lirc'
make[1]: Leaving directory '/run/build/lirc'
but it automatically skips the make install in systemd section without any patching ... Perhaps this might be a hint too?
I have the same problem. The remote is working with the ppa debian version. But now, as I need to switch to flatpack as of 20.3 because ppa is no longer supported ... Is there any chance to get lirc working with the flatpak? Or is there another remote (available for buying) that is working and recommended?
This is the output of ir-keytable on my system:
/sys/class/rc/rc0/ gefunden mit:
Name: Media Center Ed. eHome Infrared Remote Transceiver (0471:060d)
Treiber mceusb
Standardschlüsselcodeabbildung: rc-rc6-mce
Eingabegerät: /dev/input/event4
Linux-Infrarotfernbedienung : /dev/lirc0
tangefügte BPF-Protokolle: Vorgang wird nicht unterstützt
unterstützte Kernelprotokolle: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
Aktivierte Kernelprotokolle: lirc rc-6
bus: 3, Anbieter/Produkt: 0471:060d, Version: 0x0101
Wiederholungsverzögerung = 500 ms, Wiederholungsperiode = 125 ms
The problem is, that lirc does not compile in flatpack (see above), so there is no lirc at all until somebody who know how to write a patch disabling systemd in lirc to compile it in flatpack.
I don't think we need the complete Lirc in the flatpak. Usually the lirc receiver is installed on the host and Kodi just needs the Lirc client.
Can somebody check if https://github.com/flathub/tv.kodi.Kodi/pull/218#issuecomment-1894820348 does LIRC stuff?
Can somebody check if #218 (comment) does LIRC stuff?
Didn't get it to recognize my remote. :(
Can you try the lastest build?
Ok, I installed latest build 78929 and it recognizes the remote.
By default only left, right, up and down key are working. I was able to assign a key from the remote as back key using keymap editor addon. I was not able to do so for a number of other keys (Info, Enter, Menu). Enter on the remote starts Celulloid, it works on my old installation (ppa).
Problems:
sudo ir-keytable -c -p rc-6 --write=/etc/rc_keymaps/rc6_mce --sysdev=rc0
but it seems as if these mappings are not available inside the flatpak. I'm also not sure about what of lirc is now included in the kodi flatpak. I believe that it just needs the lirc client as the driver, app, etc are running on the system. In my setup above it says Linux-Infrarotfernbedienung : /dev/lirc0
which (I assume) means, that a lirc is running on my system and Kodi just need the client to connect to /dev/lirc0
.
Is there a way on how to test if the flatpak sees the rc device? Maybe an included shell (as AddOn?)
You can login to the shell that the flatpak runs in with flatpak enter
if that helps
@razzeee Thank you
I did a few test and I see the following:
flatpak enter tv.kodi.Kodi ir-keytable
gives me the output as seen in the above comment.
flatpak enter tv.kodi.Kodi ir-keytable -r
and flatpak enter tv.kodi.Kodi ir-keytable -t
both gives a /dev/input/event4: Permission denied
.
On the host system I see the following entries:
kodi@tv-kodi:~$ ls -la /dev/lirc0
crw-rw---- 1 root video 240, 0 Feb 23 11:42 /dev/lirc0
kodi@tv-kodi:~$ ls -la /dev/input/event4
crw-rw---- 1 root input 13, 68 Feb 23 11:42 /dev/input/event4
So I believe I have to add some permissions to the flatpak. How do I do that?
Easiest way is to use https://flathub.org/apps/com.github.tchx84.Flatseal or kde settings if you are on kde (can't help with the later)
In theory I thought this should work, as we set device=all
, there's also device=input
now (it's new) but I don't think that should help here.
Hmm. The limited user kodi does not get access, but sudo user with sudo does. As user kodi is able to use the remote when using Kodi from ppa, the problem must be something else.
I tried FlatSeal and dev=input is disabled. Even if I run it as root.
I may do some more testing later ...
I tried FlatSeal and dev=input is disabled. Even if I run it as root.
You can enable it via flatseal, but need to restart the app then.
Running stuff as root, shouldn't change these afaik
In theory I thought this should work, as we set device=all, there's also device=input now (it's new) but I don't think that should help here.
There is no stable release of flatpak that support device=input
.
Also don't confuse flatpak permision (expose the devices inside the flatpak) and system permissions (can I read/write the device). There is no way for the latter to be set by flatpak. In that case you should make sure the user running the flatpak is in the input
group.
I have to actual amend what I said: exposed devices INSIDE the sandbox have nfsnobody
permissions and the user inside the sandbox belong to nfsnobody
.
So --device=all
should work.
$ ls -l /dev/input/
total 0
drwxr-xr-x. 2 nfsnobody nfsnobody 60 Feb 11 16:17 by-id
drwxr-xr-x. 2 nfsnobody nfsnobody 220 Feb 11 16:17 by-path
crw-rw----. 1 nfsnobody nfsnobody 13, 64 Jan 27 00:05 event0
crw-rw----. 1 nfsnobody nfsnobody 13, 65 Jan 27 00:05 event1
crw-rw----. 1 nfsnobody nfsnobody 13, 74 Jan 27 00:05 event10
crw-rw----. 1 nfsnobody nfsnobody 13, 75 Jan 27 00:05 event11
[...]
$ id
uid=1000(hub) gid=1000(hub) groups=1000(hub),65534(nfsnobody)
I don't think so - it would mean flatpak bypasses host file access protections. If you don't have access on host they you don't have it in flatpak. Usually systemd gives uaccess for devices to logged user but I guess this setup is different because kodi is run as separate user.
So you need to add kodi user to all groups it may need.
I will do a few more tests when I have time. I will also try to solve this on my host system. As far as I see, I have two mappings: the ir-keytable mapping ir codes to keys and the Keymap in Kodi. Changing the first to give the standard Kodi keys for actions should solve the problem. At least up, right, down, left are working, should also be possible with others.
Also
My lircd socket is avalable to anyone: srw-rw-rw- 1 root root 0 18. Sep 08:39 /var/run/lirc/lircd
This is not available inside the sandbox. xdg-run/lirc
likely need to be added as a permission
I was able to change one key from remote with keymapeditor add-on.
But other buttons are still not regocnized by kodi. Also the socket /var/run/lirc/lircd
is still not visible inside the sandbox.
Adding xdg-run/lirc
with FlatSeal did nothing.
To me it seems that keyboard keys mapped with ir-keytable are passed to / work in the sandbox. Whereas the lirc socket which is used by kodi is not available, thus lirc still not working.
You need to add --filesystem=/var/run/lirc
or --filesystem=/run/lirc
if /var/run
is symlink. xdg-run is for user subdir.
You need to add
--filesystem=/var/run/lirc
or--filesystem=/run/lirc
if/var/run
is symlink. xdg-run is for user subdir.
@Erick555 And this fixed it. 👯
My remote is now working fully with the Kodi flatpak. Thank you very much. 😃
I did try with /var/run/lirc
already but it prevented Kodi from starting. Didn't realise the symlink was the problem.
Learned something. 😄
So kodi flatpak needs to add --filesystem=/run/lirc
then this can be closed.
I have a working LIRC with an Hauppauge_350 remote, running under vdr, and created Lircmap.xml according to: https://kodi.wiki/view/HOW-TO:Set_up_LIRC But it is not working with flathub kodi 19.2 oder 20.2 ... Looking in tv.kodi.yml: '# - modules/lirc/lirc.json '# - -DENABLE_LIRCCLIENT=ON has been commented out.
Why is lirc disabled? If it is disabled, can you reenable it please? My lircd socket is avalable to anyone: srw-rw-rw- 1 root root 0 18. Sep 08:39 /var/run/lirc/lircd
Regards, Bernd