如果我编译 LIRCthis patched lirc
然后安装使用make install
它工作正常并且启动没有任何错误。但是,重新启动后,同一命令失败并出现以下错误:
root@NAS:~# lircd --device=/dev/ttyACM0 --driver=usb_irtoy
lircd: can't open or create /var/run/lirc/lircd.pid
lircd: No such file or directory
root@NAS:~#
有什么想法可能是什么原因吗?
答案1
好的,我找到了解决方案。我们需要/var/run/lirc/
在每次启动时手动创建目录。我编辑了lirc初始化文件下面的脚本将使用 code 创建目录(如果不存在)[ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
。
#! /bin/sh
#
# This is an init script for Debian 2.1 Slink distribution.
# Copy it to /etc/init.d/lirc and type
# > update-rc.d lirc defaults 20
#
test -f /usr/local/sbin/lircd || exit 0
test -f /usr/local/sbin/lircmd || exit 0
case "$1" in
start)
[ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
echo -n "Starting lirc daemon: lircd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --listen --driver=usb_irtoy --device=/dev/ttyACM0
echo -n " lircmd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd
echo "."
;;
stop)
echo -n "Stopping lirc daemon: lircmd"
start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
echo -n " lircd"
start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircd
echo "."
;;
reload|force-reload)
start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircd
start-stop-daemon --stop --quiet --signal 1 --exec /usr/local/sbin/lircmd
;;
restart)
echo -n "Stopping lirc daemon: lircmd"
start-stop-daemon --stop --quiet --exec /usr/local/sbin/lircmd
echo " lircd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --listen --driver=usb_irtoy --device=/dev/ttyACM0
sleep 1
echo -n "Starting lirc daemon: lircd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircd -- --listen --driver=usb_irtoy --device=/dev/ttyACM0
echo -n " lircmd"
start-stop-daemon --start --quiet --exec /usr/local/sbin/lircmd
echo "."
;;
*)
echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}"
exit 1
esac
exit 0