#!/bin/sh # # lircd Linux Infrared Remote Control daemon # # chkconfig: 2345 65 35 # description: LIRC is a package that allows you to decode and send # infrared signals of many (but not all) commonly used # remote controls. # # processname: lircd # pidfile: /var/run/lircd.pid # config: /etc/lircd.conf # config: /etc/sysconfig/lircd ### BEGIN INIT INFO # Provides: lircd # Should-Start: $syslog dkms # Should-Stop: $syslog # Default-Start: 2 3 4 5 # Short-Description: Linux Infrared Remote Control daemon # Description: LIRC is a package that allows you to decode and send # infrared signals of many (but not all) commonly used # remote controls. ### END INIT INFO # Source function library . /etc/rc.d/init.d/functions # Get service config [ -f /etc/sysconfig/lircd ] && . /etc/sysconfig/lircd # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/lircd ]; then # Release serial port. if [ "${HWMOD}" = "lirc_serial" ]; then if lsmod | grep -q ^serial; then modprobe -r serial else setserial ${COM_PORT} uart none fi fi # Load the hardwaredriver if [ -z "$HWMOD" ] || lsmod | grep -q ${HWMOD} ; then true else modprobe ${HWMOD} ${DRIVER_OPTS} > /dev/null fi gprintf "Starting Linux Infrared Remote Control daemon:" OPTIONS="" [ -n "${DRIVER}" ] && OPTIONS="--driver=${DRIVER}" [ -n "${DEVICE}" ] && OPTIONS="${OPTIONS} --device=${DEVICE}" daemon lircd ${OPTIONS} RETVAL=$? [ ${RETVAL} -eq 0 ] && touch /var/lock/subsys/lircd else gprintf "Starting Linux Infrared Remote Control daemon:" failure fi echo ;; stop) # Stop daemons. if [ -f /var/lock/subsys/lircd ]; then gprintf "Stopping Linux Infrared Remote Control daemon:" killproc lircd rm -f /var/lock/subsys/lircd >/dev/null 2>&1 # Unload the hardwaredriver if [ -z "$HWMOD" ] || lsmod | grep -q ${HWMOD} ; then modprobe -r ${HWMOD} > /dev/null fi echo else gprintf "Stopping Linux Infrared Remote Control daemon:" failure echo exit 1 fi ;; status) status lircd ;; restart) test -f /var/lock/subsys/irexec && RESTART_IREXEC=yes test -n "${RESTART_IREXEC}" && /etc/rc.d/init.d/irexec stop test -f /var/lock/subsys/lircmd && RESTART_LIRCMD=yes test -n "${RESTART_LIRCMD}" && /etc/rc.d/init.d/lircmd stop $0 stop $0 start test -n "${RESTART_LIRCMD}" && /etc/rc.d/init.d/lircmd start test -n "${RESTART_IREXEC}" && /etc/rc.d/init.d/irexec start ;; reload) gprintf "Reloading Linux Infrared Remote Control daemon:" killproc lircd -HUP echo ;; *) gprintf "$0 {start|stop|status|restart|reload}\n" exit 1 ;; esac exit ${RETVAL}