Package: lirc
Version: 0.8.3-5
Severity: wishlist
Tags: patch

I own a iMon USB device (0036) which is detected by lirc kernel driver as two 
different USB devices.
I need lirc to listen on both these two devices to get full functionalities of 
my remote control.

I have made a patch to lirc init.d script to start two instances of lirc:  

8><--------------------------
--- lirc.old    2009-10-03 11:44:30.000000000 +0200
+++ lirc.new    2009-10-03 11:44:46.000000000 +0200
@@ -10,12 +10,16 @@
 #                    infrared receivers and transceivers.
 ### END INIT INFO
 
+PIDFILE=/var/run/lircd.pid
+SLAVE_PIDFILE=/var/run/lircd_slave.pid
+
 load_modules ()
 {
        MODULES_MISSING=false
 
        log_daemon_msg "Loading LIRC modules"
        for mod in $*; do
+               log_progress_msg $mod
                modprobe $mod 2> /dev/null || MODULES_MISSING=true
        done
 
@@ -57,8 +61,30 @@
        if [ -n "$DRIVER" ] && [ "$DRIVER" != "none" ]; then
                ARGS="--driver=$DRIVER $ARGS"
        fi
+       if [ "$DUAL_DEVICE" = "true" ]; then
+               ARGS="--connect=localhost:$SLAVE_LIRCD_PORT --pidfile=$PIDFILE 
$ARGS"
+       fi
+       echo $ARGS
+
+       unset -v ARGS
+}
+
+build_slave_args ()
+{
+       ARGS="$*"
+
+       if [ -n "$SLAVE_DEVICE" ] && [ "$SLAVE_DEVICE" != "none" ]; then
+               ARGS="--device=$SLAVE_DEVICE $ARGS"
+       fi
+       if [ -n "$SLAVE_DRIVER" ] && [ "$SLAVE_DRIVER" != "none" ]; then
+               ARGS="--driver=$SLAVE_DRIVER $ARGS"
+       fi
+
+       ARGS="--listen=$SLAVE_LIRCD_PORT --pidfile=$SLAVE_PIDFILE $ARGS"
 
        echo $ARGS
+
+       unset -v ARGS
 }
 
 . /lib/lsb/init-functions
@@ -104,44 +130,57 @@
                fi
 
                if [ "$START_LIRCD" = "true" ]; then
-                       log_daemon_msg "Starting remote control daemon(s) : 
LIRC "
-                       LIRCD_ARGS=`build_args $LIRCD_ARGS`
+                       log_daemon_msg "Starting remote control daemon"
+                       if [ "$DUAL_DEVICE" = "true" ]; then
+                               log_progress_msg "lircd_slave"
+                               REAL_LIRCD_ARGS=`build_slave_args $LIRCD_ARGS`
+                               if ! start-stop-daemon --start --pidfile 
$SLAVE_PIDFILE --quiet --exec /usr/sbin/lircd -- $REAL_LIRCD_ARGS < /dev/null; 
then
+                                       log_end_msg $?
+                                       exit $?
+                               fi
+                       fi
 
-                       if [ ! -z "$LIRCD_ARGS" ]; then
-                               start-stop-daemon --start --quiet --exec 
/usr/sbin/lircd -- $LIRCD_ARGS < /dev/null
+                       log_progress_msg "lircd"
+                       REAL_LIRCD_ARGS=`build_args $LIRCD_ARGS`
+                       if ! start-stop-daemon --start --pidfile $PIDFILE 
--quiet --exec /usr/sbin/lircd -- $REAL_LIRCD_ARGS < /dev/null; then
                                log_end_msg $?
-                       else
-                               log_end_msg 1
+                               exit $?
                        fi
+                       log_end_msg 0
                fi
 
                if [ "$START_LIRCMD" = "true" ]; then
-                       log_daemon_msg "Starting remote control mouse daemon : 
LIRCMD "
+                       log_daemon_msg "Starting remote control mouse daemon"
+                       log_progress_msg "lircmd"
                        start-stop-daemon --start --quiet --exec 
/usr/sbin/lircmd < /dev/null
                        log_end_msg $?
                fi
 
                if [ "$START_IREXEC" = "true" ]; then
-                       log_daemon_msg "Starting execution daemon: irexec"
+                       log_daemon_msg "Starting remote control execution 
daemon"
+                       log_progress_msg "irexec"
                        start-stop-daemon --start --quiet --exec 
/usr/bin/irexec -- -d /etc/lirc/lircrc < /dev/null
                        log_end_msg $?
                fi
                ;;
        stop)
                if [ "$START_IREXEC" = "true" ]; then
-                       log_daemon_msg "Stopping execution daemon: irexec"
+                       log_daemon_msg "Stopping remote control execution 
daemon"
+                       log_progress_msg "irexec"
                        start-stop-daemon --stop --quiet --exec /usr/bin/irexec
                        log_end_msg $?
                fi
 
                if [ "$START_LIRCMD" = "true" ]; then
-                       log_daemon_msg "Stopping remote control mouse daemon: 
LIRCMD"
+                       log_daemon_msg "Stopping remote control mouse daemon"
+                       log_progress_msg "lircmd"
                        start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd
                        log_end_msg $?
                fi
 
                if [ "$START_LIRCD" = "true" ]; then
-                       log_daemon_msg "Stopping remote control daemon(s): LIRC"
+                       log_daemon_msg "Stopping remote control daemon"
+                       log_progress_msg "lircd"
                        start-stop-daemon --stop --quiet --exec /usr/sbin/lircd
                        log_end_msg $?
                fi
8><--------------------------


Can you include this functionality in your package ?


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.31 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lirc depends on:
ii  debconf [debconf-2.0]        1.5.27      Debian configuration management sy
ii  libasound2                   1.0.21a-1   shared library for ALSA applicatio
ii  libc6                        2.9-27      GNU C Library: Shared libraries
ii  liblircclient0               0.8.3-5     infra-red remote control support -
ii  libusb-0.1-4                 2:0.1.12-13 userspace USB programming library
ii  lsb-base                     3.2-23      Linux Standard Base 3.2 init scrip

lirc recommends no packages.

Versions of packages lirc suggests:
ii  lirc-modules-source           0.8.3-5    infra-red remote control support -
pn  lirc-svga                     <none>     (no description available)
pn  lirc-x                        <none>     (no description available)

-- debconf information:
  lirc/take_care_of_old_config:
  lirc/install_devices: true
  lirc/irq:
  lirc/lircd_conf:
  lirc/reconfigure: false
  lirc/lircmd_conf:
  lirc/remove_var-log-lircd: true
  lirc/driver:
  lirc/port:
  lirc/device:
  lirc/should-use-IntelliMouse:
  lirc/cflags:
  lirc/timer:
  lirc/modules:
--- lirc.old    2009-10-03 11:44:30.000000000 +0200
+++ lirc.new    2009-10-03 11:44:46.000000000 +0200
@@ -10,12 +10,16 @@
 #                    infrared receivers and transceivers.
 ### END INIT INFO
 
+PIDFILE=/var/run/lircd.pid
+SLAVE_PIDFILE=/var/run/lircd_slave.pid
+
 load_modules ()
 {
        MODULES_MISSING=false
 
        log_daemon_msg "Loading LIRC modules"
        for mod in $*; do
+               log_progress_msg $mod
                modprobe $mod 2> /dev/null || MODULES_MISSING=true
        done
 
@@ -57,8 +61,30 @@
        if [ -n "$DRIVER" ] && [ "$DRIVER" != "none" ]; then
                ARGS="--driver=$DRIVER $ARGS"
        fi
+       if [ "$DUAL_DEVICE" = "true" ]; then
+               ARGS="--connect=localhost:$SLAVE_LIRCD_PORT --pidfile=$PIDFILE 
$ARGS"
+       fi
+       echo $ARGS
+
+       unset -v ARGS
+}
+
+build_slave_args ()
+{
+       ARGS="$*"
+
+       if [ -n "$SLAVE_DEVICE" ] && [ "$SLAVE_DEVICE" != "none" ]; then
+               ARGS="--device=$SLAVE_DEVICE $ARGS"
+       fi
+       if [ -n "$SLAVE_DRIVER" ] && [ "$SLAVE_DRIVER" != "none" ]; then
+               ARGS="--driver=$SLAVE_DRIVER $ARGS"
+       fi
+
+       ARGS="--listen=$SLAVE_LIRCD_PORT --pidfile=$SLAVE_PIDFILE $ARGS"
 
        echo $ARGS
+
+       unset -v ARGS
 }
 
 . /lib/lsb/init-functions
@@ -104,44 +130,57 @@
                fi
 
                if [ "$START_LIRCD" = "true" ]; then
-                       log_daemon_msg "Starting remote control daemon(s) : 
LIRC "
-                       LIRCD_ARGS=`build_args $LIRCD_ARGS`
+                       log_daemon_msg "Starting remote control daemon"
+                       if [ "$DUAL_DEVICE" = "true" ]; then
+                               log_progress_msg "lircd_slave"
+                               REAL_LIRCD_ARGS=`build_slave_args $LIRCD_ARGS`
+                               if ! start-stop-daemon --start --pidfile 
$SLAVE_PIDFILE --quiet --exec /usr/sbin/lircd -- $REAL_LIRCD_ARGS < /dev/null; 
then
+                                       log_end_msg $?
+                                       exit $?
+                               fi
+                       fi
 
-                       if [ ! -z "$LIRCD_ARGS" ]; then
-                               start-stop-daemon --start --quiet --exec 
/usr/sbin/lircd -- $LIRCD_ARGS < /dev/null
+                       log_progress_msg "lircd"
+                       REAL_LIRCD_ARGS=`build_args $LIRCD_ARGS`
+                       if ! start-stop-daemon --start --pidfile $PIDFILE 
--quiet --exec /usr/sbin/lircd -- $REAL_LIRCD_ARGS < /dev/null; then
                                log_end_msg $?
-                       else
-                               log_end_msg 1
+                               exit $?
                        fi
+                       log_end_msg 0
                fi
 
                if [ "$START_LIRCMD" = "true" ]; then
-                       log_daemon_msg "Starting remote control mouse daemon : 
LIRCMD "
+                       log_daemon_msg "Starting remote control mouse daemon"
+                       log_progress_msg "lircmd"
                        start-stop-daemon --start --quiet --exec 
/usr/sbin/lircmd < /dev/null
                        log_end_msg $?
                fi
 
                if [ "$START_IREXEC" = "true" ]; then
-                       log_daemon_msg "Starting execution daemon: irexec"
+                       log_daemon_msg "Starting remote control execution 
daemon"
+                       log_progress_msg "irexec"
                        start-stop-daemon --start --quiet --exec 
/usr/bin/irexec -- -d /etc/lirc/lircrc < /dev/null
                        log_end_msg $?
                fi
                ;;
        stop)
                if [ "$START_IREXEC" = "true" ]; then
-                       log_daemon_msg "Stopping execution daemon: irexec"
+                       log_daemon_msg "Stopping remote control execution 
daemon"
+                       log_progress_msg "irexec"
                        start-stop-daemon --stop --quiet --exec /usr/bin/irexec
                        log_end_msg $?
                fi
 
                if [ "$START_LIRCMD" = "true" ]; then
-                       log_daemon_msg "Stopping remote control mouse daemon: 
LIRCMD"
+                       log_daemon_msg "Stopping remote control mouse daemon"
+                       log_progress_msg "lircmd"
                        start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd
                        log_end_msg $?
                fi
 
                if [ "$START_LIRCD" = "true" ]; then
-                       log_daemon_msg "Stopping remote control daemon(s): LIRC"
+                       log_daemon_msg "Stopping remote control daemon"
+                       log_progress_msg "lircd"
                        start-stop-daemon --stop --quiet --exec /usr/sbin/lircd
                        log_end_msg $?
                fi

Reply via email to