View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 4 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Thu Jun 07, 2007 11:14 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Lots of people seem to be confused by the multi-level mappings used in lirc configuration so this is a short attempt to clarify things.

First of all "mappping" here refers to the general process of associating one thing with another. Numbers and letters make a simple example.

1 --> A
2 --> B
3 --> C

Mappings can be one to one, many to one, one to many, or many to many. A multi-level (one to one) mapping just adds more steps:

1 --> A --> red
2 --> B --> blue
3 --> C --> green

Each level of a mapping can be one to one (1-1), many to one (N-1), one to many (1-N), or many to many (N-N). In the lirc remote case we have:

Physical button -(1-1)-> transmitted code -(1-1)-> button name -(N-N)-> application input.


For any given remote the first mapping level is almost always a (1-1) mapping. This means that each physical button sends a unique code to the reciever. Therefore on my Hauppaoge grey remote when I press the round button labelled OK the driver gets the code 0x00000000000017E5. It's the only button that sends that code and the only code that button sends.

The next level, which converts codes to button names is again a (1-1) mapping. The button names for any given remote must be unique. This is the job of the /etc/lirc/lircd.conf configuration file. Given that both this and the underlying "physical to code" level are both (1-1) mappings you end up with a (1-1) mapping from the physical button to a button name. Please note that case/capitalization matter in these button names, and thus "OK", "Ok", and "ok" are three different names.

Also note that for different remotes you can reuse the same button names. Thus both the button on my grey remote which sends code 0x00000000000017E5 and the button on my silver remote which sends code 0x00000000000017A5 are both assigned the name "Ok". This allows a (N-1) mapping where "the same" button on different remotes maps to the same name, such as "Ok" or "2".

The final step in to map the (case senstitive!) button names to the appropriate inputs for each application. This mapping is done in the /home/mythtv/.mythtv/lircrc config file and is N-N. It is entirely possible to create a mapping where all the button names are set to produce the exact same application input for all applications. It is also possible for a given button to produces a different input for each application. Please note that there are no magic defaults. Any application which doesn't have an input mapping given for a particular button will not get any input when thst button is pressed.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 7:12 am 
Offline
Joined: Sat Jan 06, 2007 6:50 pm
Posts: 141
Location: Nashville, TN
Nice post tjc. I have been meaning to really tweak my remote to get rid of the nuances that I have. Reading this may help out in that attempt :D

_________________
LinHES Release 6.04.00
Mboard MSI PM8PM-V P4M800
CPU - Intel Celeron D 336 Processor 2.80GHZ
Memo - Corsair VS512MB533D2 512MB DDR2-533
Hard D - Hitachi T7K500 250GB Serial ATA
Wireless - Netgear wg311
Tuner Card - PVR-150


Top
 Profile  
 
PostPosted: Sun Jun 17, 2007 7:38 am 
Offline
Joined: Tue Jan 23, 2007 1:38 pm
Posts: 249
Location: Sweden
After struggling with this for a looong time and with a little help I came up with this procedure:

1 Select Silver Hauppauge A415 in the installation, or rerun:
Code:
# /usr/local/bin/lirc-reconfig.sh)


This produces a /etc/lirc/lircd.conf file for the "grayHauppauge" remote. Quite confusing, but there is a way forward.

2 Copy this file for reference:
Code:
# mv /etc/lirc/lircd.conf /etc/lirc/lircd.conf.old


3 Stop lirc:
Code:
# /etc/init.d/lircd stop


4 Run the irrecord script:
Code:
# /usr/bin/irrecord

This takes care of tjc:s first two mappings:
Quote:
Physical button -(1-1)-> transmitted code -(1-1)-> button name -(N-N)

In my case, /etc/lirc/lircd.conf had the wrong key codes after installation -possibly indeed the grayHauppauge codes? There also seem to be different releases of the silver remote with different key codes. Irrecord takes care of that plus any possible timing issues.
This produces: /etc/lirc/lircd.conf.new

5 Rename the new config file:
Code:
# mv /etc/lirc/lircd.conf.new /etc/lirc/lircd.conf


6 Open two terminal windows side-by-side if possible, displaying lircd.conf.old in one for reference and editing lircd.conf in the other:
Code:
# cat /etc/lirc/lircd.conf.old
# nano /etc/lirc/lircd.conf

Change the names you gave the buttons when running irrecord to the names used in lircd.conf.old (case sensitive!). This ensures that you can use the already configured /home/mythtv/.lircrc, which is the config file taking care of the last mapping in tjc:s chain:
Quote:
Physical button -(1-1)-> transmitted code -(1-1)-> button name -(N-N)-> application input

Also, change the name references in it from "lirc.conf.new" to "grayHauppauge" to make sure that it matches its (grayHauppauge).lircrc file.

7 Now, make sure that your /etc/lirc/hardware.conf is correct. This has been described elsewhere and is highly hw specific, so I will not go into that here.

8 Start lirc:
Code:
# /etc/init.d/lircd start

Possibly, the machine needs to be restarted the first time. I did that and it got things going, but I don't know if it was changes in hardware.conf or lirc config that necessitated this. Verifying with irw should produce your button names and reference to "grayHauppauge".
You can now enjoy a lirc configuration that will satisfy your needs for some time.

9 When you want to map keys to more applications (or change), you do that by editing:
Code:
# nano /home/mythtv/.lircrc

and restarting lirc:
Code:
# /etc/init.d/lircd restart


Happy lirc-ing!

/Chris

_________________
LinHES R8.6.1
BE: AMD64X4, 4GB, Hauppauge usb tuners
FE1: Gigabyte F2A85X-UP4, nVidia GT640
FE2: Gigabyte GA-MA69GM-S2H, AthlonX2 4850E 2.5 GHz, 1GB, ASUS GEFORCE 7200GS 256MB
FE3: Asus Eeebox410


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 17, 2007 7:57 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Choosing the grey remote gets you a /etc/lirc/lircd.conf file with the keycodes for all three historical remotes (black, grey-cigar, and silver-dogbone). Then all you need to do is fix the application mappings in /home/mythtv/.mythtv/lircrc

My files are attached below. Note that:

1) I normalized the spelling and capitalization of all the button names in /etc/lirc/lircd.conf and /home/mythtv/.mythtv/lircrc so that there is a consistent set for the grey and silver remotes, and it doesn't matter which one I pick up.

2) I also extended the mappings to provide everything needed for DVD playback in xine, and video playback in mplayer, while trying to keep the button usage fairly consistent.

Code:
#
# this config file was automatically generated
# using lirc-0.6.6(animax) on Tue Apr 15 19:50:27 2003
#
# contributed by
#
# brand:                                Hauppauge
# model no. of remote control: "grey/gray" cigar shaped remote
# devices being controlled by this remote: PVR 2/350
#

begin remote

  name  hauppauge_pvr
  bits           13
  flags RC5|CONST_LENGTH
  eps            30
  aeps          100

  one           969   811
  zero          969   811
  plead        1097
  gap          114605
  toggle_bit      2


      begin codes
          Power                    0x00000000000017FD
          Go                       0x00000000000017FB
          1                        0x00000000000017C1
          2                        0x00000000000017C2
          3                        0x00000000000017C3
          4                        0x00000000000017C4
          5                        0x00000000000017C5
          6                        0x00000000000017C6
          7                        0x00000000000017C7
          8                        0x00000000000017C8
          9                        0x00000000000017C9
          Back/Exit                0x00000000000017DF
          0                        0x00000000000017C0
          Menu                     0x00000000000017CD
          Red                      0x00000000000017CB
          Green                    0x00000000000017EE
          Yellow                   0x00000000000017F8
          Blue                     0x00000000000017E9
          Ch+                      0x00000000000017E0
          Ch-                      0x00000000000017E1
          Vol-                     0x00000000000017D1
          Vol+                     0x00000000000017D0
          Ok                       0x00000000000017E5
          Mute                     0x00000000000017CF
          Blank                    0x00000000000017CC
          Full                     0x00000000000017FC
          Rewind                   0x00000000000017F2
          Play                     0x00000000000017F5
          Forward                  0x00000000000017F4
          Record                   0x00000000000017F7
          Stop                     0x00000000000017F6
          Pause                    0x00000000000017F0
          Replay                   0x00000000000017E4
          Skip                     0x00000000000017DE
      end codes

end remote


#
# this config file was automatically generated
# using lirc-0.7.0(any) on Sun Nov 28 20:25:09 2004
#
# contributed by
#
# brand:   Hauppauge 350
# Created: G.J. Werler (The Netherlands)
# Project: Mythtv Fedora Pundit-R www.mythtvportal.com
# Date:    2004/11/28
# model no. of remote control: Hauppauge A415-HPG "dogbone" shaped remote
# devices being controlled by this remote: PVR-2/350
#

begin remote

  name  Hauppauge_350
  bits           13
  flags RC5|CONST_LENGTH
  eps            30
  aeps          100

  one           969   811
  zero          969   811
  plead        1097
  gap          114605
  toggle_bit      2

      begin codes
          Go                       0x00000000000017BB
          Power                    0x00000000000017BD
          TV                       0x000000000000179C
          Videos                   0x0000000000001798
          Music                    0x0000000000001799
          Pictures                 0x000000000000179A
          Guide                    0x000000000000179B
          Radio                    0x000000000000178C
          Up                       0x0000000000001794
          Left                     0x0000000000001796
          Right                    0x0000000000001797
          Down                     0x0000000000001795
          Ok                       0x00000000000017A5
          Back/Exit                0x000000000000179F
          Menu                     0x000000000000178D
          Vol+                     0x0000000000001790
          Vol-                     0x0000000000001791
          Prev.Ch                  0x0000000000001792
          Mute                     0x000000000000178F
          Ch+                      0x00000000000017A0
          Ch-                      0x00000000000017A1
          Record                   0x00000000000017B7
          Stop                     0x00000000000017B6
          Rewind                   0x00000000000017B2
          Play                     0x00000000000017B5
          Forward                  0x00000000000017B4
          Replay                   0x00000000000017A4
          Pause                    0x00000000000017B0
          Skip                     0x000000000000179E
          1                        0x0000000000001781
          2                        0x0000000000001782
          3                        0x0000000000001783
          4                        0x0000000000001784
          5                        0x0000000000001785
          6                        0x0000000000001786
          7                        0x0000000000001787
          8                        0x0000000000001788
          9                        0x0000000000001789
          Star                     0x000000000000178A
          0                        0x0000000000001780
          Pound                    0x000000000000178E
          Red                      0x000000000000178B
          Green                    0x00000000000017AE
          Yellow                   0x00000000000017B8
          Blue                     0x00000000000017A9
      end codes

end remote

Code:
# lircrc.example.HauppaugeGrey-nativelirc
# Save this file in ~/.mythtv/lircrc
# Customized, 2006/08/08 - TJC

begin
    prog = mythtv
    button = Power
    config = Esc
end

begin
    prog = mythtv
    button = Go
# Swap the PiP windows
    config = N
end

begin
    prog = mythtv
    button = 1
    config = 1
end

begin
    prog = mythtv
    button = 2
    config = 2
end

begin
    prog = mythtv
    button = 3
    config = 3
end

begin
    prog = mythtv
    button = 4
    config = 4
end

begin
    prog = mythtv
    button = 5
    config = 5
end

begin
    prog = mythtv
    button = 6
    config = 6
end

begin
    prog = mythtv
    button = 7
    config = 7
end

begin
    prog = mythtv
    button = 8
    config = 8
end

begin
    prog = mythtv
    button = 9
    config = 9
end

begin
    prog = mythtv
    button = Back/Exit
    config = Esc
end

begin
    prog = mythtv
    button = 0
    config = 0
end

begin
    prog = mythtv
    button = Menu
    config = M
end

begin
   prog = mythtv
# This is the Red key
# We'll use it for "Delete"
   button = Red
   config = D
end

begin
   prog = mythtv
# This is the Green key
# We'll use it for "Information"
   button = Green
   config = I
end

# Note the "repeat = " strings in the volume and channel.
# This means that if you hold down the key, every nth instance will be
# passed.  This depends on your system, so you may want to increase or
# decrease this and see what happens.  repeat = 1 is probably too
# fast.

begin
  prog = mythtv
# This is the Yellow key
# Use it as a volume key
  button = Yellow
  repeat = 3
  config = F10
end

begin
  prog = mythtv
# This is the Blue key
# Use it as a volume key
  button = Blue
  repeat = 3
  config = F11
end

begin
    prog = mythtv
    button = Ch+
# This is the "up" on the central diamond
    repeat = 3
    config = Up
end

begin
    prog = mythtv
    button = Up
    repeat = 3
    config = Up
end

begin
    prog = mythtv
    button = Ch-
# This is the "down" on the central diamond
    repeat = 3
    config = Down
end

begin
    prog = mythtv
    button = Down
    repeat = 3
    config = Down
end

begin
    prog = mythtv
    button = Vol-
# This is the "left" on the central diamond
    repeat = 3
    config = Left
end

begin
    prog = mythtv
    button = Left
# This is the "left" on the central diamond
    repeat = 3
    config = Left
end

begin
    prog = mythtv
    button = Vol+
# This is the "right" on the central diamond
    repeat = 3
    config = Right
end

begin
    prog = mythtv
    button = Right
    repeat = 3
    config = Right
end

begin
    prog = mythtv
# Middle button on the diamond
    button = Ok
    config = Return
end

begin
    prog = mythtv
    button = Prev.Ch
    config = H
end

begin
    prog = mythtv
    button = Mute
    config = F9
end

begin
   prog = mythtv
# Change focus for PiP (to change channel in the other window)
   button = Blank
   config = B
end

begin
   prog = mythtv
# Toggle PiP on/off
   button = Full
   config = V
end

begin
    prog = mythtv
    button = Rewind
    config = Left
end

begin
    prog = mythtv
    button = Play
    config = P
end

begin
    prog = mythtv
    button = Forward
    config = Right
end

begin
  prog = mythtv
  button = Record
  config = R
end

begin
   prog = mythtv
# Teletext
   button = Stop
   config = T
end

begin
    prog = mythtv
    button = Pause
    config = P
end

begin
   prog = mythtv
   button = Replay
# Use for backwards commercial skip
    config = Q
end

begin
   prog = mythtv
   button = Skip
# Use for forward commercial skip
    config = Z
end


## MPLAYER

begin
   prog = mplayer
   button = Power
   config = quit
end

begin
   prog = mplayer
   button = Menu
   config = osd
end

begin
   prog = mplayer
   button = Rewind
   config = seek -10
   repeat = 1
end

begin
   prog = mplayer
   button = Forward
   config = seek +10
   repeat = 1
end

begin
   prog = mplayer
   button = Replay
   config = seek -60
   repeat = 1
end

begin
   prog = mplayer
   button = Skip
   config = seek +60
   repeat = 1
end

begin
    prog = mplayer
    button = Pause
    config = pause
end

begin
    prog = mplayer
    button = Play
    config = pause
end

begin
   prog = mplayer
   button = Back/Exit
   config = quit
end

begin
   prog = mplayer
   button = Vol+
   config = volume +1
   repeat = 1
end

begin
   prog = mplayer
   button = Vol-
   config = volume -1
   repeat = 1
end

begin
   prog = mplayer
   button = Mute
   config = mute
end


## XINE

begin
   prog = xine
   button = Play
   repeat = 3
   config = Play
end

begin
   prog = xine
   button = Stop
   repeat = 3
   config = Stop
end

begin
   prog = xine
   button = Back/Exit
   config = Quit
end

begin
   prog = xine
   button = Pause
   repeat = 3
   config = Pause
end

begin
   prog = xine
   button = Ch+
   repeat = 4
   config = EventUp
end

begin
   prog = xine
   button = Ch-
   repeat = 4
   config = EventDown
end

begin
   prog = xine
   button = Vol-
   repeat = 4
   config = EventLeft
end

begin
   prog = xine
   button = Vol+
   repeat = 4
   config = EventRight
end

begin
   prog = xine
   button = Up
   repeat = 4
   config = EventUp
end

begin
   prog = xine
   button = Down
   repeat = 4
   config = EventDown
end

begin
   prog = xine
   button = Left
   repeat = 4
   config = EventLeft
end

begin
   prog = xine
   button = Right
   repeat = 4
   config = EventRight
end

begin
   prog = xine
   button = Ok
   repeat = 0
   config = EventSelect
end

begin
   prog = xine
   button = Menu
   repeat = 0
   config = Menu
end

# vol down
begin
   prog = xine
   button = Yellow
   repeat = 1
   config = Volume-
end

# vol up
begin
   prog = xine
   button = Red
   repeat = 1
   config = Volume+
end

begin
   prog = xine
   button = Forward
   repeat = 2
   config = SeekRelative+30
end

begin
   prog = xine
   button = Rewind
   repeat = 2
   config = SeekRelative-30
end

# ch up
begin
   prog = xine
   button = Green
   repeat = 1
   config = SeekRelative+60
end

# ch down
begin
   prog = xine
   button = Blue
   repeat = 1
   config = SeekRelative-60
end

begin
   prog = xine
   button = Go
   repeat = 1
   config = PartMenu
end

# skip chapter forward
begin
   prog = xine
   button = Skip
   repeat = 1
   config = EventNext
end

# skip chapter backward
begin
   prog = xine
   button = Replay
   repeat = 1
   config = EventPrior
end

# prev subtitle channel
begin
   prog = xine
   button = Blank
   repeat = 2
   config = SpuPrior
end

# next subtitle channel
begin
   prog = xine
   button = Full
   repeat = 2
   config = SpuNext
end

# capture current frame
begin
   prog = xine
   button = Record
   repeat = 3
   config = Snapshot
end


## LIRCNAV

begin
   prog = lircnav
   button = Vol-
   config = page_down
end

begin
   prog = lircnav
   button = Vol+
   config = page_up
end

begin
   prog = lircnav
   button = Ch+
   config = up
end

begin
   prog = lircnav
   button = Ch-
   config = down
end

begin
   prog = lircnav
   button = Ok
   config = select
end

begin
   prog = lircnav
   button = Power
   config = quit
end


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu