Thank you for your donation!


Instruction Guide Configure a USB DAC with infrared to control MoOde on a RPi
#1
I use moOde on a Raspberry Pi 3B, with a USB DAC (Arcam irDAC) that has an infra-red receiver. The DAC has a remote control where I can press play, stop, next song, etc. and this sends commands over USB to the Pi.

Please note the infra-red receiver is embedded in the DAC, the infra-red receiver is NOT connected directly to the Pi. I have seen other threads that deal with that case.

I have tested the instructions below successfully in MoOde 4, then on MoOde 4.2.

1. Install necessary packages

Code:
sudo apt-get -y install lirc
sudo apt-get -y install ir-keytable



2. Unplug and re-plug USB DAC to trigger udev rules



3. Check input with ir-keytable:

Code:
ir-keytable -vtd /dev/input/event0


Example:
Code:
pi@moode:~ $ ir-keytable -vtd /dev/input/event0
Opening /dev/input/event0
Input Protocol version: 0x00010001
Testing events. Please, press CTRL-C to abort.
1498377601.323848: event type EV_MSC(0x04): scancode = 0xc00b7
1498377601.323848: event type EV_KEY(0x01) key_down: KEY_STOPCD(0x0001)
1498377601.323848: event type EV_SYN(0x00).
1498377601.323876: event type EV_KEY(0x01) key_up: KEY_STOPCD(0x0001)
1498377601.323876: event type EV_SYN(0x00).




4. In file /etc/lirc/lirc_options.conf, change the line "device" to point to the device:
Code:
device          = /dev/input/event0

5. Replace the content of file /etc/lirc/irexec.lircrc with the following:
Code:
begin
prog = irexec
button = KEY_PLAY
config = mpc play
end

begin
prog = irexec
button = KEY_STOPCD
config = mpc stop
end

begin
prog = irexec
button = KEY_PAUSE
config = mpc pause
end

begin
prog = irexec
button = KEY_PREVIOUSSONG
config = mpc prev
end

begin
prog = irexec
button = KEY_NEXTSONG
config = mpc next
end


6. Restart the services:
Code:
sudo systemctl restart lircd
sudo systemctl restart irexec


7. Check lircd and irexec are running:


Code:
pi@moode:/etc/lirc $ ps -ef | grep irc
root       807     1  0 12:32 ?        00:00:00 /usr/sbin/lircd --nodaemon
root      1950     1  0 12:36 ?        00:00:00 /usr/bin/irexec /etc/lirc/irexec.lircrc
pi        2366 15383  0 12:38 pts/0    00:00:00 grep --color=auto irc
pi@moode:/etc/lirc $


NOTE: irw can be used for troubleshooting, a line should appear after each key press on the remote:


Code:
pi@moode:/etc $ irw
00000000800100a6 00 KEY_STOPCD devinput
00000000800100a6 00 KEY_STOPCD devinput
00000000800100a6 00 KEY_STOPCD devinput
00000000800100cf 00 KEY_PLAY devinput
^C
pi@moode:/etc $


For more info: http://www.lirc.org/html/configuration-guide.html
Reply


Forum Jump: