[mythtv-users] Disabling iMON IR Receiver but not iMON VFD?
Ben Lancaster
mail at benlancaster.co.uk
Mon May 4 23:00:22 UTC 2009
Hey,
I have an mceusb2 remote, and a case with a built-in iMON VFD & IR
receiver. I've managed to get an lircd instance for each remote on
boot as-per the lirc documentation (http://www.lirc.org/html/configure.html
), using /dev/lircd and /dev/lircd1. IRW confirms that both daemons
are working properly and accepting input.
Here's the problem; I only want to use the mceusb2 remote, and not the
iMON remote. Sometimes the machine assigns the iMON IR to /dev/lircd
and mceusb2 to /dev/lircd2, but sometimes its the other way around,
and MythTV only seems to work with the device on /dev/lircd. It seems
that a hard restart or boot from cold assigns mceusb2 to /dev/lircd1,
but a soft-reboot assigns mceusb2 to /dev/lircd. My question is in
three parts I suppose:
1. Can I set it so mceusb2 is always bound to /dev/lircd and iMON IR
to /dev/lircd1
2. If not, can i disable the iMON IR completely without disabling the
VFD?
3. If neither, can I tell mythfronted to accept lirc commands from
both daemons?
I found this page on the wiki (http://www.mythtv.org/wiki/MultiLIRC)
but I can't see that's doing anything other than I've already
achieved, and doesn't prevent the seemingly random remote/lircd-device
assignment.
Thanks in advance. Spec and LIRC Config files follow.
System:
MythBuntu Intrepid
lircd 0.8.3
kernel: 2.6.27-11-generic (with lirc_imon and lirc_mceusb2 modules)
# /etc/lirc/hardware.conf
#
#Chosen Remote Control
REMOTE="Windows Media Center Remotes (new version Philips et al.)"
REMOTE_MODULES="lirc_dev lirc_mceusb2"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_LIRCD_CONF="mceusb/lircd.conf.mceusb"
REMOTE_LIRCD_ARGS="-d /dev/lirc1 --output=/dev/lircd1 --listen"
REMOTE_LIRCD2_ARGS="-d /dev/lirc0 --output=/dev/lircd --
connect=localhost:8765 --pidfile=/var/run/lircd2.pid"
#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
#Enable lircd
START_LIRCD="true"
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"
#Try to load appropriate kernel modules
LOAD_MODULES="true"
# Default configuration files for your hardware if any
LIRCMD_CONF=""
#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
START_LIRCMD=""
# -- END /etc/lirc/hardware.conf
#! /bin/sh
# /etc/init.d/lirc
### BEGIN INIT INFO
# Provides: lirc
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts LIRC daemon.
# Description: LIRC is used to control different
# infrared receivers and transceivers.
### END INIT INFO
load_modules ()
{
local MODULES_MISSING=false
log_daemon_msg "Loading LIRC modules"
for mod in $*
do
if [ $mod = "udev" ]; then
log_end_msg 0
log_success_msg "Restarted via udev, don't reload modules"
break
else
modprobe -k $mod 2> /dev/null || MODULES_MISSING=true
fi
done
log_end_msg $?
if $MODULES_MISSING; then
log_failure_msg "Unable to load LIRC kernel modules. Verify
your"
log_failure_msg "selected kernel modules in /etc/lirc/
hardware.conf"
START_LIRCMD=false
START_LIRCD=false
fi
}
build_remote_args ()
{
local REMOTE_ARGS="$*"
#For remote only detection support, we need
#both REMOTE_DEVICE and TRANSMITTER_DEVICE undefined
if [ -z "$REMOTE_DEVICE" ] && [ -z "$TRANSMITTER_DEVICE" ]; then
for dev in /dev/lirc0; do
if [ -c $dev ]; then
REMOTE_DEVICE="$dev"
break
fi
done
fi
#If we have a REMOTE_DEVICE or REMOTE_DRIVER defined (either
because no devices
#were defined, OR if we explicitly did), then populate REMOTE_ARGS
if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
if [ -n "$REMOTE_DEVICE" ] && [ "$REMOTE_DEVICE" != "none" ];
then
REMOTE_ARGS="--device=$REMOTE_DEVICE $REMOTE_ARGS"
fi
if [ -n "$REMOTE_DRIVER" ] && [ "$REMOTE_DRIVER" != "none" ];
then
REMOTE_ARGS="--driver=$REMOTE_DRIVER $REMOTE_ARGS"
fi
#Now, if we ALSO have a transmitter defined, add some args
#To make the first lircd listen up
if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z
"$TRANSMITTER_DRIVER" ]; then
REMOTE_ARGS="$REMOTE_ARGS --output=/dev/lircd --listen"
fi
fi
echo $REMOTE_ARGS
}
build_transmitter_args ()
{
local TRANSMITTER_ARGS="$*"
#Transmitters must be explicitly be defined
if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z
"$TRANSMITTER_DRIVER" ]; then
if [ -n "$TRANSMITTER_DEVICE" ] && [ "$TRANSMITTER_DEVICE" !=
"none" ]; then
TRANSMITTER_ARGS="--device=$TRANSMITTER_DEVICE
$TRANSMITTER_ARGS"
fi
if [ -n "$TRANSMITTER_DRIVER" ] && [ "$TRANSMITTER_DRIVER" !=
"none" ]; then
TRANSMITTER_ARGS="--driver=$TRANSMITTER_DRIVER
$TRANSMITTER_ARGS"
fi
#Now, if we ALSO have a remote defined, add some args
#To make the second lircd connect
if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
TRANSMITTER_ARGS="$TRANSMITTER_ARGS --output=/dev/lircd1
--connect=localhost:8765 --pidfile=/var/run/lircd1.pid"
fi
fi
echo $TRANSMITTER_ARGS
}
. /lib/lsb/init-functions
test -f /usr/sbin/lircd || exit 0
test -f /usr/sbin/lircmd || exit 0
START_LIRCMD=true
START_LIRCD=true
if [ -f /etc/lirc/hardware.conf ];then
. /etc/lirc/hardware.conf
fi
if [ ! -f /etc/lirc/lircd.conf ] \
|| grep -q "^#UNCONFIGURED" /etc/lirc/lircd.conf;then
if [ "$1" = "start" ]; then
log_success_msg "No valid /etc/lirc/lircd.conf has been found."
log_success_msg "Remote control support has been disabled."
log_success_msg "Reconfigure LIRC or manually replace /etc/
lirc/lircd.conf to enable."
fi
START_LIRCD=false
START_LIRCMD=false
fi
if [ ! -f /etc/lirc/lircmd.conf ] \
|| grep -q "^#UNCONFIGURED" /etc/lirc/lircmd.conf;then
START_LIRCMD=false
fi
case "$1" in
start)
if [ "$LOAD_MODULES" = "true" ] && [ "$START_LIRCD" =
"true" ]; then
load_modules $2 $REMOTE_MODULES $TRANSMITTER_MODULES
$MODULES
fi
if $START_LIRCD; then
log_daemon_msg "Starting remote control daemon(s) : LIRC "
REMOTE_LIRCD_ARGS=`build_remote_args $REMOTE_LIRCD_ARGS`
REMOTE_LIRCD2_ARGS=`build_remote_args $REMOTE_LIRCD2_ARGS`
TRANSMITTER_LIRCD_ARGS=`build_transmitter_args
$TRANSMITTER_LIRCD_ARGS`
#if we have a remote defined, it is primary process
if [ ! -z "$REMOTE_LIRCD_ARGS" ]; then
start-stop-daemon --start --quiet --exec /usr/sbin/
lircd -- $REMOTE_LIRCD_ARGS < /dev/null
/usr/sbin/lircd $REMOTE_LIRCD2_ARGS < /dev/null
log_end_msg $?
#now if we additionally have a transmitter defined,
it is secondary process
if [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
/usr/sbin/lircd $TRANSMITTER_LIRCD_ARGS < /dev/null
fi
elif [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
start-stop-daemon --start --quiet --exec /usr/sbin/
lircd -- $TRANSMITTER_LIRCD_ARGS < /dev/null
else
log_end_msg 1
fi
fi
if $START_LIRCMD; then
log_daemon_msg "Starting remote control mouse daemon :
LIRCMD "
start-stop-daemon --start --quiet --exec /usr/sbin/lircmd
< /dev/null
log_end_msg $?
fi
;;
stop)
if $START_LIRCMD; then
log_daemon_msg "Stopping remote control mouse daemon:
LIRCMD"
start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd
log_end_msg $?
fi
if $START_LIRCD; then
log_daemon_msg "Stopping remote control daemon(s): LIRC"
start-stop-daemon --stop --quiet --exec /usr/sbin/lircd
log_end_msg $?
fi
;;
reload|force-reload)
if $START_LIRCD; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/
sbin/lircd
fi
if $START_LIRCMD; then
start-stop-daemon --stop --quiet --signal 1 --exec /usr/
sbin/lircmd
fi
;;
restart)
$0 stop
#passes parameter $2 which is possibly our udev paramater
$0 start $2
;;
*)
echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|
force-reload}"
exit 1
esac
exit 0
# -- END /etc/init.d/lirc
More information about the mythtv-users
mailing list