[Guide] How to enable LIRC on a C1/C1+ to control Volumio

This is a short description on how to configure a remote control (in this case the simple Hardkernel remote) for use with Volumio on a C1 or a C1+.
Start with installing lirc

apt-get update apt-get -y install liblircclient0 apt-get -y install lirc
Starting lirc will throw an error, because there is no valid lircd.conf yet and the hardware.conf is not set properly either.
We also need to configure the HK remote for Volumio.

Start with lircd.conf, replace the contents of /etc/lirc/lircd.conf with this

begin remote

  name  lircd.conf
  bits           16
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       8964  4507
  one           544  1692
  zero          544   561
  ptrail        544
  pre_data_bits   16
  pre_data       0x4DB2
  gap          107872
  toggle_bit_mask 0x0

      begin codes
          KEY_LEFT                 0x9966
          KEY_RIGHT                0x837C
          KEY_UP                   0x53AC
          KEY_DOWN                 0x4BB4
          KEY_ENTER                0x738C
          KEY_HOME                 0x41BE
          KEY_MUTE                 0x11EE
          KEY_MENU                 0xA35C
          KEY_BACK                 0x59A6
          KEY_VOLUMEDOWN           0x817E
          KEY_VOLUMEUP             0x01FE
          KEY_POWER                0x3BC4
      end codes

end remote

Continue with the hardware configuration, replace the contents of /etc/lirc/hardware.conf with the following:

# /etc/lirc/hardware.conf
#

MODULES="meson-ir"
DRIVER="default"
DEVICE="/dev/lirc0"
LIRCD_CONF=""
LIRCD_ARGS="--uinput"

#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=""

This completes the lirc configuration, next we configure the remote with actions for Volumio.
I implemented these basic buttons as an working example.
There are better ways of doing this, using more of the available irexec options.
POWER, starts a shutdown
MUTE, will pause or play (toggle)
HOME, stops and clears the playlist
UP, plays the next song
DOWN, plays the previous song
LEFT, will seek 1% backwards
RIGHT, will seek 1% forward
MENU, shuffles the playlist
BACK, will stop and restart the currrent song
VOL -, lowers volume 2 steps
VOL +, raises volume 2 steps

Create a file /etc/lirc/lircrc with the following contents.

[code]## irexec
begin irexec
begin
prog = irexec
button = KEY_POWER
config = shutdown -h -P now
repeat = 0
end

begin
prog = irexec
button = KEY_DOWN
config = mpc consume off;mpc prev
repeat = 0
end

begin
prog = irexec
button = KEY_UP
config = mpc:consume off;mpc next
repeat = 0
end

begin
prog = irexec
button = KEY_VOLUMEUP
config = mpc volume +2
repeat = 1
end

begin
prog = irexec
button = KEY_VOLUMEDOWN
config = mpc volume -2
repeat = 1
end

begin
prog = irexec
button = KEY_RIGHT
config = mpc toggle;mpc seek +1%;sleep 0.1;mpc toggle
repeat = 0
end

begin
prog = irexec
button = KEY_LEFT
config = mpc toggle;mpc seek -1%;sleep 0.1;mpc toggle
repeat = 0
end

begin
prog = irexec
button = KEY_MUTE
config = mpc toggle
repeat = 0
end

begin
prog = irexec
button = KEY_BACK
config = mpc stop;mpc play
repeat = 0
end

begin
prog = irexec
button = KEY_HOME
config = mpc stop;mpc clear
repeat = 0
end

begin
prog = irexec
button = KEY_MENU
config = mpc shuffle
repeat = 0
end

begin
prog = irexec
button = KEY_ENTER
config = mpc consume off;mpc play
repeat = 0
end

end irexec[/code]

All set, reboot and enjoy

Works great, thanks a lot for your explanation!

Hello,

my Name is Christian and I am new to Volume and to Odroid.
I get an Odroid C1+ from Pollin/Germany.

It runs with the Volumio Image like a charme. I use a eMMC Card. My Problem is the IR Receiver.
In the /dev/ Folder is no LIRC Device.

So the Guide above won´t work.
I don´t know how to fix this. Is there some help?

Regards
Christian

Hi,

I get it work, but with an other lircd.conf.
I used the irrecord and learned the codes for the Remote.


# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Tue Feb  9 07:03:56 2016
#
# contributed by 
#
# brand:                       /etc/lircd-1.conf
# model no. of remote control: 
# devices being controlled by this remote:
#

begin remote

  name  lircd.conf
  flags RAW_CODES|CONST_LENGTH
  eps            30
  aeps          100

  gap          108094

      begin raw_codes

          name KEY_LEFT
             8958    4536     526     582     524    1715
              526     581     525     582     525    1715
              526    1714     526     581     526    1714
              526    1715     525     583     524    1715
              526    1715     525     582     525     582
              525    1715     526     582     525    1715
              526     582     525     582     525    1716
              525    1716     525     582     525     583
              524    1716     526     582     525    1715
              526    1714     526     582     525     582
              525    1716     525    1715     526     582
              525

          name KEY_RIGHT
             8927    4567     496     611     496    1744
              497     610     496     612     495    1745
              496    1744     496     610     496    1744
              496    1743     496     611     496    1744
              496    1743     497     610     495     611
              496    1744     496     611     495    1744
              496     611     496     611     495     612
              495     611     495     612     495    1744
              496    1743     496     611     495    1745
              496    1742     497    1743     496    1744
              496    1743     497     610     496     611
              495

          name KEY_UP
             8955    4542     524     584     523    1718
              523     584     523     584     523    1718
              524    1718     523     584     523    1719
              523    1718     523     585     522    1718
              523    1718     523     584     523     584
              522    1718     524     583     523     586
              521    1719     523     584     523    1717
              524     584     523     584     523    1718
              523    1717     524    1717     524     585
              522    1718     524     584     523    1717
              524    1719     522     584     523     584
              523

          name KEY_DOWN
             8928    4565     522     585     521    1718
              522     586     521     585     521    1719
              523    1717     523     585     521    1718
              523    1717     523     585     521    1719
              522    1718     522     585     521     585
              522    1718     522     585     522     585
              521    1719     523     584     522     585
              522    1719     523     584     522    1719
              523    1717     523    1717     524     585
              522    1718     523    1717     523     584
              522    1718     523     584     522     585
              522

          name KEY_ENTER
             8953    4542     523     584     523    1718
              523     585     522     585     522    1718
              523    1717     525     583     523    1718
              523    1717     524     584     522    1718
              523    1718     523     584     522     585
              522    1718     524     584     523     585
              521    1718     524    1718     523    1717
              524     584     522     585     522    1719
              523    1718     523    1717     524     584
              522     585     522     585     522    1718
              524    1718     522     584     523     585
              522

          name KEY_HOME
             8958    4538     525     583     523    1717
              524     583     524     583     523    1718
              524    1717     524     583     523    1717
              524    1717     524     583     523    1717
              524    1716     525     584     523     584
              523    1718     523     585     523     584
              523    1717     524     584     523     585
              522     585     523     584     523     585
              522    1718     523    1717     525     583
              524    1718     523    1717     525    1716
              525    1717     523    1717     525     583
              524

          name KEY_MUTE
             8960    4537     526     581     526    1716
              526     582     525     581     526    1716
              525    1715     526     582     525    1715
              526    1715     526     582     526    1715
              526    1715     525     582     526     582
              525    1716     526     582     525     582
              525     582     525     583     524    1717
              525     582     526     582     524     583
              524    1717     525    1716     525    1716
              525    1716     525     582     525    1716
              525    1716     525    1715     526     582
              525

          name KEY_MENU
             8931    4565     523     585     521    1720
              522     585     521     586     498    1743
              522    1719     521     586     497    1744
              498    1743     498     610     496    1744
              498    1743     498     610     497     610
              497    1744     497     610     497    1744
              498     611     496    1745     497     611
              496     611     496     611     496    1745
              497    1745     497     610     496    1746
              498     610     496    1744     497    1745
              496    1744     497     611     496     612
              496

          name KEY_BACK
             8955    4538     526     582     524    1716
              526     582     525     583     524    1716
              526    1715     526     582     525    1715
              526    1714     526     581     526    1715
              526    1715     525     582     525     582
              525    1715     527     581     525     583
              525    1716     526     582     525    1718
              526    1713     525     582     526     582
              525    1716     526    1715     525     583
              525    1716     525     582     525     582
              525    1715     527    1715     526     582
              525

          name KEY_VOLUMEDOWN
             8960    4540     524     582     525    1716
              526     581     526     582     525    1715
              526    1715     525     582     525    1716
              525    1716     525     582     525    1715
              526    1715     526     582     525     582
              525    1715     526     582     525    1716
              526     581     526     582     525     582
              525     582     525     583     525     582
              525    1716     526     582     525    1716
              526    1715     526    1716     526    1715
              526    1716     526    1715     526     582
              525

          name KEY_VOLUMEUP
             8958    4540     524     584     523    1719
              524     583     524     584     523    1718
              524    1717     525     583     524    1718
              524    1718     524     583     524    1717
              524    1718     524     583     523     584
              523    1718     524     585     523     583
              524     585     522     585     523     584
              523     585     523     584     523     584
              524    1717     525    1717     524    1717
              526    1716     524    1717     524    1717
              524    1718     523    1718     524     583
              524

          name KEY_POWER
             8959    4541     524     584     524    1718
              524     584     523     584     523    1718
              524    1718     524     584     523    1718
              524    1717     524     584     523    1717
              524    1717     525     584     523     584
              523    1718     524     584     524     584
              523     585     523    1718     524    1718
              524    1718     524     583     525    1717
              524    1718     524    1718     523    1718
              523     585     523     584     523     584
              523    1718     524     583     524     584
              523

      end raw_codes

end remote

I hope this is helpful for someone other.

Regards
Christian

My lircd.conf will only work for the Hardkernel remote, as it says in my opening post.
The /dev/lirc0 folder must have been there, otherwise your irrecord would not have worked either :mrgreen:
Anyway, glad it worked.
Which remote are you using?

Hi,

I use the Hardkernel Remote.
But lirc tell there is no valid lidcd.conf when I used the Version in Post #1.

Regards
Christian

Hi,

Im using the PI Zero w with a JustBoom Amp Zero.
Remote works but I can’t control the Volume.

config = mpc volume +2

When I try mpc volume +2 over ssh there is no effect.
Is there anything different when using a Amp Hat?

Thanks,
greez Markus

Ok, my fault. Volumio uses the Alsa to control volume not the mpd. I will change it in my lirc config.

Good evening,

I use Volumio on my C1+ with this remote (with Odroid remote plugin chosen on the list): odroid.co.uk/hardkernel-odr … -ir-remote

I can only get power off and OK (only for the first time) buttons to work. All other buttons either stop playback or fast/forwarding/rewind but then playback stops. I guess I have to configure lircrc, right?

Can I get power on through ir remote?

Thank you in advance

Hello

I have a question - is there any chances to use remote controler with number keys (1, 2, 3 etc) to play assigned online radios?

For examples I’d like to use “1” key to BBC radio? Is it possible?

Works great, thanks a lot for your explanation!

thanks, nice to know.
Btw. new version coming soon.