6

How do I get multiple instances of LIRC working and each using different GPIO?

Right now I do:

sudo lircd --device=/dev/lirc0 --pidfile=/var/run/lirc/lirc0.pid --listen=8700 --connect=localhost:8700 --output=/var/run/lirc/lircd

And when I do:

echo "SEND_ONCE TIME_WARNER KEY_0" | nc localhost 8700

It works.

But if I do:

sudo lircd --device=/dev/lirc1 --pidfile=/var/run/lirc/lirc1.pid --listen=8701 --connect=localhost:8701 --output=/var/run/lirc/lircd

And : echo "SEND_ONCE TIME_WARNER KEY_0" | nc localhost 8701

It doesn't work. How do I set the proper GPIO on /dev/lirc1?

  • Can you provide a link to the repository containing lirc? Your answer is probably there. – not2qubit Apr 21 '16 at 21:58
  • We are going to need to see this lirc repository and the error you receive after you run your echo command? – Mohammad Ali May 17 '16 at 15:22
1

This site goes about it by creating a new instance of the driver. In short:

$ find /lib/modules/`uname -r` -name lirc_serial.ko
/lib/modules/2.6.31-21-generic/kernel/ubuntu/lirc/lirc_serial/lirc_serial.ko
$ cd /lib/modules/2.6.31-21-generic/kernel/ubuntu/lirc/lirc_serial
$ su
# cat lirc_serial.ko | sed -e 's/lirc_serial/lirc_ser_01/g' > lirc_ser_01.ko
# depmod -a
# exit
$
$ sudo modprobe lirc_ser_01
$ dmesg | tail
lirc_ser_01: auto-detected active high receiver
lirc_dev: lirc_register_driver: sample_rate: 0
lirc_ser_01 $Revision: 5.104 $ registered
1

Instead of running two instances on my pi I opted to make what is essentially a transistor switchboard (on a breadboard). I call each send command from a script which first runs another script that turns on one of three GPIOs, activating one of three transistors, and thus exposing one of three IR transmitters to receive signal from the single LIRC gpio.

This actually works very well, and I was able to put this together in less time than it takes to read the tutorials on multiple instances and drivers. I needed this ability because I have multiple components which are of the same make and therefore receive some of the same codes such as power. If each device didn't have it's own transmitter I wouldn't be able to control one device without the other non intended device also responding to the command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.