IR remote control

If you want to use your infra-red remote control to control your linux computer, this is a way that works… It allows you to send the keys “Left” and “Right”, hereby possibly switching slides of a presentation.

lircd is the service that receives the IR signals and converts them to meaningful names like “PLAY”. it reads a configuration file, /etc/lirc/lircd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
#This configuration has been automatically generated via
#the Ubuntu LIRC package maintainer scripts.
#
#It includes the default configuration for the remote and/or
#transmitter that you have selected during package installation.
#
#Feel free to add any custom remotes to the configuration
#via additional include directives or below the existing
#Ubuntu include directives from your selected remote and/or
#transmitter.
 
#Configuration for the Apple Mac mini USB IR Receiver remote:
include "/home/buschi/.lircd.conf.macbook"

my personal /home/buschi/.lircd.conf.macbook then reads

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.8.3pre1(macmini) on Sun May 25 11:41:30 2008
#
# contributed by 
#
# brand:                       Apple
# model no. of remote control: A1156
# devices being controlled by this remote: MacBook2
#
 
begin remote
 
  name  MacBook2
  bits           32
  eps            30
  aeps          100
 
  one             0     0
  zero            0     0
  gap          211993
  toggle_bit_mask 0x0
 
      begin codes
          MENU                     0x87EE0E03
          PLUS                     0x87EE0E0A
          MINUS                    0x87EE0E0C
          PLAY                     0x87EE0E05
          REW                      0x87EE0E09
          FFWD                     0x87EE0E06
      end codes
 
end remote

This file was created using irrecord, if I remember correctly. If the service lircd is running, the program irw can be used to check if the signals of the remote are translated correctly.

The program irxevent then assigns “PLAY” to a key press, say “Left”. It reads the configuration file .lircrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
##################################################
######   LIRC Applications Configuration   #######
##################################################
 
begin
  flags = startup_mode
  mode = main
end
 
begin main
  begin
    prog = irxevent
    button = REW
    config = Key KeyCode:113 CurrentWindow
  end
 
  begin
    prog = irxevent
    button = FFWD
    config = Key KeyCode:114 CurrentWindow
  end
 
  begin
    prog = irxevent
    button = PLUS
    config = Key KeyCode:114 CurrentWindow
  end
 
  begin
    prog = irxevent
    button = MINUS
    config = Key KeyCode:114 CurrentWindow
  end
 
  begin
    prog = irxevent
    button = PLAY
    config = Key KeyCode:114 CurrentWindow
  end
 
  begin
    prog = irxevent
    button = MENU
    config = Key KeyCode:114 CurrentWindow
  end
 
end main

Normally, one should be able to use config lines as

config = Key Left CurrentWindow

but there seems to be a bug. The KeyCode corresponding to “Left” etc can be found out using the program xev. More about this topic on http://osdir.com/ml/hardware.lirc/2005-08/msg00011.html.

Leave a Reply