README for IVTV Lirc support

Introduction
============
Remote controls and IR receivers are supported by the IVTV driver for several
cards, such as the Hauppauge PVR 250 and 350. You will need to setup LIRC 0.7.0
in order to use this support. Much of the information here came from:
http://www.mythtv.org/docs/mythtv-HOWTO-22.html#ss22.2

Installation
============
1. Make sure your kernel was built with "Character Devices | Standard/generic
   (8250/16550 and compatible UARTs) serial support" as a module, rebuilding the
   kernel if necessary.

2. Many distributions come with an outdated version of LIRC.  You'll need to
remove it.  Find all the relevant binaries: 
    # updatedb
    # locate lirc_i2c|grep `uname -r`
    # locate lirc_dev|grep `uname -r`
    # locate irw|grep "/usr"
    # locate lircd|grep "/usr"
    # locate irxevent|grep "/usr"
  And delete any LIRC code files, LIRC code directories, and LIRC binaries.
  
3. Download and untar the latest version of LIRC:
    # wget http://lirc.sourceforge.net/software/snapshots/lirc-0.7.0pre6.tar.bz2
    # tar -xjf lirc-0.7.0pre6.tar.bz2
    # cd lirc-0.7.0pre6
    
4. Compile and Install
    # ./setup.sh

      Select "1" (Driver configuration), then scroll down to "5" (TV
      Card), press ENTER, then scroll down to "f" (Hauppauge TV
      card) and press ENTER again. Once back at the main menu, press
      "3" for Save and run configure.

    # make
    # make install      
    # depmod -ae

5. Update your /etc/modules.conf (or /etc/modutils/ivtv), adding the following
   lines if they don't exist:
    alias char-major-61 lirc_i2c
    add above ivtv lirc_dev lirc_i2c
    
   Then run:
    # update-modules (only if you're using modutils)
    # depmod -ae
   
6. Start lircd and startup ivtv.  Lircd must be running for your remote to work,
   so you'll want to make sure this gets started at boot time via your system's
   init scripts.
    # /usr/local/sbin/lircd
    # modprobe ivtv

    
Troubleshooting
===============

--------          
ISSUE: compile error stating: lirc_i2c.c:296: unknown field 'owner' specified 
       in initializer
          
SOLUTION: edit the file and comment out a line in the source code. See message  
          http://www.gossamer-threads.com/lists/mythtv/users/40136 for detailed
          instructions.
          
--------          
ISSUE: LIRC devices and drivers not installed properly           
          
DIAGNOSTIC: As a part of the make install process, LIRC will create the
            appropriate device for you in /dev. Check to make sure:
            
    # ls -l /dev/lirc*
    crw-r--r--    1 root     root      61,   0 Sep 18 15:36 /dev/lirc
    srw-rw-rw-    1 root     root            0 Sep 18 15:38 /dev/lircd=

          After modprobe-ing the lirc_i2c driver and runing the lircd program,
          check your /var/log/messages and /var/log/lircd files.
          
    # modprobe lirc_i2c
    # lsmod
    Module                  Size  Used by    Not tainted
    lirc_i2c                5124   0
    lirc_dev               10096   1  [lirc_i2c]
    ...
    # lircd
    # tail /var/log/messages
    Sep 18 15:38:26 frontend kernel: lirc_i2c: chip found @ 0x18 (Hauppauge IR)
    Sep 18 15:38:26 frontend kernel: lirc_dev: lirc_register_plugin:sample_rate:
    10
    ...
    # tail /var/log/lircd
    Sep 18 15:24:52 frontend lircd 0.7.0pre2: lircd(hauppauge) ready

--------
ISSUE: Your remote control is not working.

DIAGNOSTIC: run the irw program and start pressing buttons. If nothing is
            happening, you must begin troubleshooting. 

SOLUTIONS: 
    * Are there batteries in the remote?
    * Does the remote work? You may be able to see the flashes of IR coming from
      the remote if you look at it with a video camera.
    * Is the IR dongle cable plugged in?
    * Did you remove all of the old LIRC device drivers? Run "updatedb" as root,
      then "locate lirc_i2c". The only lirc_i2c should be the one in the misc/
      directory for your kernel version.
    * Did you run depmod?
    * Is your modules.conf setup correctly?
    * Did you modprobe lirc_i2c?
    * Did you run lircd?
    * Do you have an /etc/lircd.conf?
    * Is /dev/lirc a character mode file, major 61, minor 0? Is it readable by
      all groups?
    * If you think you may have had old LIRC device drivers you may need to
      reboot to ensure that they're totally out of the system. Try running
      modprobe -r lirc_i2c as root first, then modprobe lirc_i2c and try again.
    * What path does modinfo lirc_i2c and modinfo lirc_dev show? It should be in
      /lib/modules/{your kernel version}/misc/
      
      
    If none of the above works, and irw still isn't showing keypresses, then you
    will need to ask your question on the LIRC list:
    http://lists.sourceforge.net/lists/listinfo/lirc-list    
    
LIRC & MythTV
=============
There are two options for using LIRC with MythTV: via MythTV's native support or
via irxevent

Option 1: MythTV Native Support
-------------------------------
edit MythTV's settings.pro, making sure the following comments are uncommented:
  # Native lirc support
  CONFIG += using_lirc
  LIRC_LIBS = -llirc_client
  
Then recompile and install Myth:
  $ make distclean; make
  $ su
  # make install

Put the lirc rc file in the appropriate place in the mythtv user's home
directory. It has a slightly different format than what you would use if you
were using irxevent. Also note that it is in your .mythtv directory and does not
have a "." in the filename.

  $ cp configfiles/hauppauge-lircrc-nativelirc ~mythtv/.mythtv/lircrc
  
  
Option 2: irxevent/irexec Support
---------------------------------
  Ensure that the button names that come up with irw match the ones in the
  .lircrc file in your home directory. Note that if you are not using native
  LIRC support, the .lircrc file is in your home directory and has a "." as the
  first character.
  
  You will need to have irexec running when you use myth, so you might want to
  add it to your mythfrontend startup script.
