diff --git a/lirc.init b/lirc.init index f5ebb92..6c918c9 100755 --- a/lirc.init +++ b/lirc.init @@ -30,40 +30,13 @@ prog2=$(basename $exec2) lockfile=/var/lock/subsys/lirc -build_lirc_args () -{ - local LIRC_ARGS="$*" - - # For remote only detection support, we need - # LIRC_DEVICE undefined - if [ -z "$LIRC_DEVICE" ] ; then - for dev in /dev/lirc0; do - if [ -c $dev ]; then - LIRC_DEVICE="$dev" - break - fi - done - fi - - # If we have a LIRC_DEVICE or LIRC_DRIVER defined (either because - # no devices were defined, OR if we explicitly did), then - # populate LIRC_ARGS - if [ ! -z "$LIRC_DEVICE" ] || [ ! -z "$LIRC_DRIVER" ]; then - if [ -n "$LIRC_DEVICE" ] && [ "$LIRC_DEVICE" != "none" ]; then - LIRC_ARGS="--device=$LIRC_DEVICE $LIRC_ARGS" - fi - if [ -n "$LIRC_DRIVER" ] && [ "$LIRC_DRIVER" != "none" ]; then - LIRC_ARGS="--driver=$LIRC_DRIVER $LIRC_ARGS" - fi - fi - echo $LIRC_ARGS -} +# Default to first lirc character device and the lirc chardev driver +LIRC_DEVICE=${LIRC_DEVICE:-/dev/lirc0} +LIRC_DRIVER=${LIRC_DRIVER:-default} start() { - LIRC_ARGS=`build_lirc_args $LIRC_ARGS` - echo -n $"Starting infrared remote control daemon ($prog): " - daemon $exec $LIRC_ARGS $LIRCD_OPTIONS + daemon $exec --driver=$LIRC_DRIVER --device=$LIRC_DEVICE $LIRCD_OPTIONS retval=$? echo status $prog >/dev/null 2>&1 @@ -77,14 +50,14 @@ start() { # To prevent double key events w/both in-kernel and lirc decode, # we disable the in-kernel decoding when lircd is started up - # successfully + # successfully with a raw IR rc-core receiver if [ $retval -eq 0 ]; then - if [ $(echo "$LIRC_DRIVER" | grep -c "dev.*input") -lt 1 ]; then - rcs=$(find -L /sys/class/rc/ -maxdepth 2 -name protocols 2> /dev/null) - for rc in $rcs - do - (echo lirc > ${rc}) 2> /dev/null - done + if [ $(echo "$LIRC_DRIVER" | grep -c "default") -ge 1 ]; then + lircdev=$(basename $LIRC_DEVICE) + rcdev=$(find -L /sys/class/rc/ -maxdepth 2 -name $lircdev 2> /dev/null) + if [ ! -z ${rcdev} ]; then + (echo lirc > ${rcdev}/../protocols) 2> /dev/null + fi fi fi @@ -108,16 +81,17 @@ stop() { [ $retval -eq 0 ] && rm -f $lockfile # On lircd shutdown, turn all the in-kernel IR decoders back on - rcs=$(find -L /sys/class/rc/ -maxdepth 2 -name protocols 2> /dev/null) - for rc in $rcs - do - echo none > ${rc} - protos=$(cat ${rc}) + lircdev=$(basename $LIRC_DEVICE) + rcdev=$(find -L /sys/class/rc/ -maxdepth 2 -name $lircdev 2> /dev/null) + if [ ! -z ${rcdev} ]; then + protonode=${rcdev}/../protocols + echo none > ${protonode} + protos=$(cat ${protonode}) for p in $protos do - (echo "+${p}" > ${rc}) 2> /dev/null + (echo "+${p}" > ${protonode}) 2> /dev/null done - done + fi return $retval } diff --git a/lirc.spec b/lirc.spec index 16a0b93..9fcf289 100644 --- a/lirc.spec +++ b/lirc.spec @@ -24,7 +24,7 @@ Name: lirc Version: 0.9.0 %if 0%{?released} -Release: 6%{?dist} +Release: 7%{?dist} %else Release: 0.1.%{pre}%{?dist} %endif @@ -307,6 +307,10 @@ fi %changelog +* Tue Jun 21 2011 Jarod Wilson 0.9.0-7 +- Only alter protocols for the device lirc is configured to talk to + and don't try to poke protocols on non-rc-core lirc devices + * Mon Jun 06 2011 Jarod Wilson 0.9.0-6 - And now take out the libusb1-devel bit, its actually the removal of libusb-config from libusb-devel that broke things, so we need some