Closed jrobichaud closed 2 years ago
Hey @jrobichaud, I appreciate the detailed bug report! I’ll try to find some time today to take a look at this and try to reproduce it and get back to you 🙂
A quick question I had was that does this problem occur if you don’t do the “client.close()” calls?
“close()” closes the underlying socket so I assume that may be why restarting lircd via systemd fixes your problem (re-opens the socket).
https://docs.python.org/3/library/socket.html#socket.socket.close https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html#
I think the docstring for the ”client.close()” call could probably be made clearer.
I had the same problem without the close.
eugene@pi:~$ uname -a
Linux pi 5.13.0-1026-raspi #28-Ubuntu SMP PREEMPT Mon Apr 25 15:22:19 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
eugene@pi:~$ sudo systemctl status lircd.socket
● lircd.socket
Loaded: loaded (/lib/systemd/system/lircd.socket; enabled; vendor preset: enabl>
Active: active (listening) since Wed 2022-05-11 22:30:18 UTC; 1s ago
Triggers: ● lircd.service
Listen: /run/lirc/lircd (Stream)
CGroup: /system.slice/lircd.socket
May 11 22:30:18 pi systemd[1]: Listening on lircd.socket.
(.venv) eugene@pi:~$ pip list
Package Version
------------- -------
lirc 2.0.1
pip 20.3.4
pkg-resources 0.0.0
setuptools 44.1.1
(.venv) eugene@pi:~$ python -c "import lirc;client = lirc.Client(); client.close()"
(.venv) eugene@pi:~$ python -c "import lirc;client = lirc.Client(); client.close()"
(.venv) eugene@pi:~$ python -c "import lirc;client = lirc.Client(); client.close()"
(.venv) eugene@pi:~$ sudo systemctl status lircd.socket
● lircd.socket
Loaded: loaded (/lib/systemd/system/lircd.socket; enabled; vendor preset: enabl>
Active: active (running) since Wed 2022-05-11 22:30:18 UTC; 2min 13s ago
Triggers: ● lircd.service
Listen: /run/lirc/lircd (Stream)
CGroup: /system.slice/lircd.socket
May 11 22:30:18 pi systemd[1]: Listening on lircd.socket.
(.venv) eugene@pi:~$ python
Python 3.9.7 (default, Sep 10 2021, 14:59:43)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lirc
>>> client1 = lirc.Client()
>>> client1.version()
'0.10.1'
>>> client1.close()
>>> client2 = lirc.Client()
>>> client2.version()
'0.10.1'
>>> client2.close()
eugene@pi:~$ cat /etc/lirc/lirc_options.conf
# These are the default options to lircd, if installed as
# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8)
# manpages for info on the different options.
#
# Some tools including mode2 and irw uses values such as
# driver, device, plugindir and loglevel as fallback values
# in not defined elsewhere.
[lircd]
nodaemon = False
driver = devinput
device = auto
output = /var/run/lirc/lircd
pidfile = /var/run/lirc/lircd.pid
plugindir = /usr/lib/aarch64-linux-gnu/lirc/plugins
permission = 666
allow-simulate = No
repeat-max = 600
#effective-user =
#listen = [address:]port
#connect = host[:port]
#loglevel = 6
#release = true
#release_suffix = _EVUP
#logfile = ...
#driver-options = ...
[lircmd]
uinput = False
nodaemon = False
# [modinit]
# code = /usr/sbin/modprobe lirc_serial
# code1 = /usr/bin/setfacl -m g:lirc:rw /dev/uinput
# code2 = ...
# [lircd-uinput]
# add-release-events = False
# release-timeout = 200
# release-suffix = _EVUP
eugene@pi:~$ ps aux | grep lircd
root 4568 0.0 0.1 9412 3972 ? Ss 22:32 0:00 /usr/sbin/lircd --nodaemon
eugene 4608 0.0 0.0 8000 1892 pts/0 S+ 22:36 0:00 grep --color=auto lircd
@jrobichaud I haven't been able to reproduce this. Am I missing something or doing something wrong here?
I know I am using "default" driver.
Ill test with the rest of your config tonight.
I have this issue only with the default
driver.
I haven't been able to send infrared commands yet, there might be something wrong with my configurations.
I suppose I can close this ticket. Thanks.
@jrobichaud No worries! It's not always the most straight forward to setup. It'd be hard for me to give much advice that might help without more information on the environment (hardware being used, remote control file, etc.).
But that is correct. If you want to send IR signals, you should use the default
driver (I wasn't having that issue with the "default" driver either though so I suspect it is likely configuration/setup related).
Instead of using systemd, running lircd
directly with possibly a more verbose log level may help.
They do also have a configuration guide that may help: https://www.lirc.org/html/configuration-guide.html
These also might be some useful utilities for debugging
There is also an open source list of remote files if it is possibly related to an issue there
If you need to create that file from scratch, there is an irrecord utility, but I've had a lot more luck with using RedRat's IR Signal Database utility.
Hope that helps! If you find it ends up being an issue with something in this package, feel free to re-open it.
I got this error when start my program, stop it and then start again:
To reproduce:
Running on raspberry pi OS:
The workaround I found is to restart lircd.socket between each run of my program.