3

I've configured lirc on my Pi. All seemed to go well, irrecord worked as did mode2, so I'm sure the hardware is wired correctly. However when I placed the config file in /etc/lirc and did

irw

nothing showed when I pressed buttons on my remote.

One thing that seems odd is that mode2 seems to show different values when I press the same button. Is that normal? -

  > mode2 -d /dev/lirc0
space 4813301
pulse 1700
space 640287
pulse 1652
space 504625
pulse 1647
space 648709
pulse 1643
space 524612
pulse 1649
space 494338
pulse 1639
space 413367
pulse 1649
space 362895
pulse 1643

The above output was all from pressing the same button repeatedly.

I'm wondering if perhaps my IR receiver is the wrong frequency or something?

This is the IR receiver I'm using RS components 708-5086.

  • I had similar problems with one of these - switched over to a RadioShack one (without the metal bracket) and all worked great. – Phil B. Oct 24 '15 at 2:35
  • Some IR remote protocols (there are hundreds of different ones) send a pair of codes for each key, cycling between them. It is an easy way to tell between a continuous key press and discrete key presses. The protocol used depends on the IR remote control. HOWEVER, I'm not famaliar with LIRC, but your mode2 pulse/space readings look like gibberish to me. Why do you think it's wired up correctly? – joan Oct 24 '15 at 8:11
  • thanks for the suggestions. it turns out lirc didn't like the remote I was using (a technics) or the remote's no longer working correctly. either way using a different remote worked as expected. – Bob Findlay Oct 25 '15 at 16:23
4

No, your RS component is working fine, it's just that you have configured the LIRC driver and test it if it work. You got:

$ mode2 -d /dev/lirc0
space 4813301
pulse 1700
space 640287
pulse 1652
...

It means that it's working.

The next step is to configure the remote controller before test it with the irw command. Use irrecord as below to generate the remote controller config file, and follow instructions given to you:

Note: It will ask you for the button name, you should use predefined key names, this link can help: New LIRC Name Space

$ irrecord -d /dev/lirc0 ~/out.conf

Once finished, check the generated file content using a text editor like nano:

$ nano ~/out.conf

The file content should be something like:

# 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 Sun Nov  8 17:32:03 2015
#
# contributed by 
#
# brand: 
# model no. of remote control: 
# devices being controlled by this remote: 
#

begin remote

  name  LG_P-020B_VCR
  bits           16
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       8945  4476
  one           555  1676
  zero          555   561
  ptrail        549
  repeat       8945  2249
  pre_data_bits   16
  pre_data       0x7689
  gap          107554
  toggle_bit_mask 0x0

      begin codes
          KEY_POWER                0x28D7
          KEY_EJECTCD              0x00FF
          KEY_MENU                 0x6897
          KEY_OK                   0x718E
          KEY_LEFT                 0xC13E
          KEY_RIGHT                0x09F6
          KEY_PLAY                 0x10EF
          KEY_STOP                 0x807F
          KEY_REWIND               0x40BF
          KEY_FORWARD              0xC03F
          KEY_RECORD               0x906F
          KEY_SLOW                 0x12ED
          KEY_VOLUMEUP             0x22DD
          KEY_VOLUMEDOWN           0xA25D
          KEY_INFO                 0xF50A
          KEY_AGAIN                0xD02F
      end codes

end remote

Now copy this file to /etc/lirc/lircd.conf, and don't worry about the existant file, it's an empty file:

$ sudo cp ~/out.conf /etc/lirc/lircd.conf

Then restart the lirc service:

$ sudo /etc/init.d/lirc restart

Finally, you can use irw to check your remote controller:

irw
00000000768928d7 00 KEY_POWER
00000000768900ff 00 KEY_EJECTCD
00000000768900ff 00 KEY_EJECTCD
000000007689718e 00 KEY_OK
000000007689718e 01 KEY_OK
...

The remote controller configuration is done, and LIRC associate buttons to a namespaces.

You should also know that to use the remote controller to control something you should use irexec command and this is how things should be done.

First use a test editor to write the script that should associate namespaces to actions it should be the ~/.lircrc:

$ nano ~/.lircrc

Insert this content:

begin
    prog = irexec # YOUR PROGRAM NAME CAN BE ANYTHING
    button = KEY_1 # The namespace of the key to use
    config = echo "You pressed one" # The command to execute
    repeat = 0
end

begin
    prog = myprogram # ANOTHER PROGRAM NAME CAN BE ANYTHING
    button = KEY_2 # The namespace of the key to use
    config = echo "You pressed two" # The command to execute
    repeat = 0
end

Save the file, then use irexec command to make magic happen:

$ irexec

Hope that helps.

2

Just had the same problem:

mode2 showed keypresses, but irw showed nothing.

irrecord complained:

  No toggle bit mask found.
  But I know for sure that RC6 has a toggle bit!

Kodi was reacting on some keys, not on others.

This entry in /boot/config.txt resolved my issue:

dtoverlay=lirc-rpi,debug

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.