4

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.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
Bob Findlay
  • 41
  • 1
  • 1
  • 2

3 Answers3

5

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.

Greenonline
  • 2,969
  • 5
  • 27
  • 38
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
Greenonline
  • 2,969
  • 5
  • 27
  • 38
Helmar
  • 21
  • 1
1

Seems like the .conf files generated by irrecord can have extra bits in them. When I clean them out irw starts working. The bits field says 32 but the codes are 64 bits long. After removing the 0x00000000 from all the codes everything works.

original

begin remote

name optoma bits 32 flags SPACE_ENC|CONST_LENGTH eps 30 aeps 100

header 9054 4408 one 598 1626 zero 598 519 ptrail 603 repeat 9040 2190 gap 107566 toggle_bit_mask 0x0 frequency 38000

  begin codes
      KEY_POWER                0x4CB340BF 0x00000000
  end codes

end remote

fixed

begin remote

name optoma bits 32 flags SPACE_ENC|CONST_LENGTH eps 30 aeps 100

header 9054 4408 one 598 1626 zero 598 519 ptrail 603 repeat 9040 2190 gap 107566 toggle_bit_mask 0x0 frequency 38000

  begin codes
      KEY_POWER                0x4CB340BF
  end codes

end remote

Lee Ballard
  • 161
  • 5