stbt.py: Support multiple lirc devices connected to the same host

To use multiple LIRC devices connected to the same host:

(1) Stop and disable lirc service:

sudo systemctl stop lirc.service
sudo systemctl disable lirc.service

(2) Run multiple `lircd` instances, and set the TCP ports that each
device listens to:

sudo lircd --device=/dev/lirc0 --pidfile=/var/run/lirc/lirc0.pid \
    --listen=8700 --output=/var/run/lirc/lircd
sudo lircd --device=/dev/lirc1 --pidfile=/var/run/lirc/lirc1.pid \
    --listen=8701

lirc0 and lirc1 can be addressed individually using the assigned TCP
ports.

(3) Send keys by sending a LIRC command string to the TCP socket:

echo -e "SEND_ONCE humax MENU" | nc localhost 8765

It's also possible to output keys via a LIRC device of a remote computer.

(4) To auto-launch lircd when a new device is attached, and auto-kill it
when the device is removed, add the following to
/etc/udev/rules.d/10-local.rules:

ACTION=="add", KERNEL=="lirc*", RUN+="/usr/bin/sh -c '/usr/sbin/lircd --device=/dev/$kernel --listen=$((8700 + $number)) --pidfile=/var/run/lirc/$kernel.pid 2>&1 | xargs -rL1 logger'"
ACTION=="remove", KERNEL=="lirc*", RUN+="/usr/bin/sh -c 'kill $(</var/run/lirc/$kernel.pid) 2>&1 | xargs -rL1 logger'"

Make sure not to break a rule to multiple lines.

It starts lircd listener on port (8700 + N) where 'N' is the device
number as in /dev/lircN. Errors are logged to /var/log/messages.

(These instructions were tested with Fedora 17.)

* * *

To put both IR devices into use by stb-tester, all we need is a new
remote type with "hostname", "port" and "remote_control_name" parameters
that uses 'VirtualRemote._connect' to connect and 'LircRemote.press' to
send keys. Similarly, for recording, a new listener type that uses
'VirtualRemote._connect' to connect and 'lirc_key_reader' to interpret
remote keys.