# LIRC Hauppauge Walkthrough/Solution (Finally)

## abarlam

Well it has certainly been a very entertaining few days to get LIRC to work with my Hauppauge WinTV card and remote, but finally I got it to work!  I followed all the methods people posted on these forums but nothing worked (even with building the ebuild specifying the driver to use).  Also, I could never get the ebuild to properly create a /dev/lirc entry.

For anyone else who is experiencing issues with LIRC, try this method!

First, compile in i2c support into your kernel.  These are the options I selected:

Character Devices -->  I2C Support -->

<M> I2C support                                                 

<M> I2C bit-banging interfaces                              

<M> I2C PCF 8584 interfaces                                

<M> I2C device interface                                         

<M> I2C /proc interface (required for hardware sensors)

Next we need Video For Linux support for my WinTV card (bttv module)

Multimedia Devices -->

<M> Video For LInux

Video For Linux -->

<*> V4L information in proc filesystem

-- Video Adapters

<M> BT848 Video For Linux  

Next recompile your kernel (make dep && make clean bzImage modules modules_install)

Reboot into your new kernel, load newly created modules (bttv,  i2c-core, etc) and download the newest lirc release from www.lirc.org.  DO NOT DOWNLOAD THE EBUILD (don't emerge lirc)!

Extract the lirc archive and run ./setup.sh.  This will bring you to a curses based screen with configuration options.

For the first section, select your driver as hauppauge, and for the second option for software configuration select compile for X-Windows if you plan on using LIRC in X.  Click save configuration and exit.  Now run make and make install to compile and install lirc and the modules for the hauppauge remote.  You should notice that it made an entry for /dev/lirc (unlike the ebuild), /dev/lircd, and /dev/lircmd.

Next, we need to load the newly created modules that lirc installed.  cd /lib/modules/kernel-dir/misc and insmod lirc_dev and lirc_i2c (You can add an entry to modules.autoload if you choose). 

Now we are ready to download the lircd.conf for our remote.  Go to www.lirc.org and go to the supported remotes section and grab the hauppauge lircd.conf file.  I noticed there were a few hauppauge lircd.conf configs, and it turned out that the older conf file worked and the newer one didnt.  To determine what config you need, load lircd /usr/local/sbin/lircd -n (Or wherever you installed it to).  It should load up and inform you it is loading using the hauppauge driver.  Next run irrecord testfile, and proceed with the instructions they tell you to determine your gap rate and toggle bit.  Once it asks you to press a button repeatedly as fast as you can and completes that part you can exit the utility.  Now cat testfile and see what values irrecord determined for gap rate and toggle_bit and bits and compare it to the config files they have on lirc.org for hauppauge remotes.  For me the later config was the right one (the one with a gap rate of 199995 and bits of 13).

Once you have downloaded your config file, save it as /etc/lircd.conf and restart lircd with the -n flag.  Now run irw and press some buttons on the remote.  You should see output indicating the button your pressed on the remote and its address.  If you don't see any output, you selected the wrong lircd.conf.  If you do see proper output then you selected the right config.

Now you are done and you can create a .lircrc file in your home dir to allow lirc to interface with supported apps.  For the time being I only have tvtime configured to work with lirc, but I plan to add the xmms-lirc plugin.  Here is a sample of my .lircrc for tvtime for hauppauge remotes.

```

begin

  prog = irexec

  button = TV

  config = tvtime &

  config = tvtime-command QUIT

end

begin

  prog = irexec

  button = CH+

  config = tvtime-command CHANNEL_UP

end

begin

  prog = irexec

  button = CH-

  config = tvtime-command CHANNEL_DOWN

endbegin

  prog = irexec

  button = VOL+

  config = tvtime-command MIXER_UP

end

begin

  prog = irexec

  button = VOL-

  config = tvtime-command MIXER_DOWN

end

```

etc etc.  You can find the full tvtime command list on their sourceforge website if you wish to bind other buttons.  Now you should be able to load up tvtime by simply hitting the tv button on your remote.  You may have to have irexec loaded in the background for it to work, i don't recall and I am at my work so I will have to check when i get home

I hope this walkthrough helps some people out as it took me literally days of endless searching to get a working configuration.

P.S - If you emerged tvtime before installing lirc, you will need to recompile it so it builds with lirc support.  This goes for all apps that support lirc.

Adam

----------

## aakepley

This is a very nice writeup. I've gotten about halfway through the instructions and am having some problems getting irrecord to open /dev/lirc. See the error message below.

```

# irrecord testfile

 

irrecord -  application for recording IR-codes for usage with lirc

 

Copyright (C) 1998,1999 Christoph Bartelmus(lirc@bartelmus.de)

 

irrecord: could not open /dev/lirc

irrecord: default_init(): No such device

irrecord: could not init hardware (lircd running ? --> close it, check permissions)

```

The dmesg command tells me

```

i2c-dev.o: i2c /dev entries driver module version 2.7.0 (20021208)

i2c-dev.o: unable to get major 89 for i2c bus

```

However, my modules.d/lircd is 

```

#lirc remote control stuff

alias   char-major-61           lirc_i2c

alias   /dev/lirc* lirc_i2c

```

I'm thinking that the problem has something to do with not being able to load the i2c-dev module right after recompiling my kernel. (i2c_dev loads fine later on.)

```

 #insmod i2c-dev

Using /lib/modules/2.4.20-gentoo-r5/kernel/drivers/i2c/i2c-dev.o

/lib/modules/2.4.20-gentoo-r5/kernel/drivers/i2c/i2c-dev.o: init_module: Input/output error

Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.

      You may find more information in syslog or the output from dmesg

```

```

# dmesg

i2c-dev.o: i2c /dev entries driver module version 2.7.0 (20021208)

i2c-dev.o: unable to get major 89 for i2c bus

```

i2c-dev seems to be trying to get major 89 for my i2c bus when I want major 61. Is there some way to specify this?

P.S. Here's the output of lsmod if it will help (note that I compiled the V4L stuff right into the kernel):

```

Module                  Size  Used by    Tainted: P

lirc_i2c                3360   0  (unused)

lirc_dev                8352   0  [lirc_i2c]

i2c-proc                7440   0  (unused)

i2c-algo-pcf            5628   0  (unused)

i2c-algo-bit            8360   0

i2c-core               15816   0  [lirc_i2c i2c-proc i2c-algo-pcf i2c-alg o-bit]

snd-mixer-oss          13848   1  (autoclean)

nvidia               1536864  10  (autoclean)

snd-cs46xx             70100   1

snd-pcm                64736   0  [snd-cs46xx]

snd-timer              15880   0  [snd-pcm]

snd-ac97-codec         37888   0  [snd-cs46xx]

snd-rawmidi            15072   0  [snd-cs46xx]

snd-seq-device          4448   0  [snd-rawmidi]

snd                    31812   0  [snd-mixer-oss snd-cs46xx snd-pcm snd-t imer snd-ac97-codec snd-rawmidi snd-seq-device]

snd-page-alloc          5164   0  [snd-cs46xx snd-pcm]

```

----------

## abarlam

Did you download the ebuild, or are you using the tarball from lirc.org?

I guess you dont need i2c_dev, this is my lsmod.

```

Module                  Size  Used by    Not tainted

smbfs                  39344   2  (autoclean)

snd-pcm-oss            40324   0  (autoclean)

snd-mixer-oss          13880   1  (autoclean) [snd-pcm-oss]

tuner                  10688   1  (autoclean)

tvaudio                13916   1  (autoclean)

msp3400                18060   1  (autoclean)

bttv                   78528   2  (autoclean)

videodev                6304   3  (autoclean) [bttv]

i2c-algo-bit            8200   1  (autoclean) [bttv]

lirc_i2c                3264   1  (autoclean)

i2c-core               15848   0  (autoclean) [tuner tvaudio msp3400 bttv i2c-algo-bit lirc_i2c]

lirc_dev                8240   1  (autoclean) [lirc_i2c]

snd-intel8x0           20260   2 

snd-pcm                68320   0  [snd-pcm-oss snd-intel8x0]

snd-timer              16840   0  [snd-pcm]

snd-ac97-codec         38240   0  [snd-intel8x0]

snd-page-alloc          5616   0  [snd-intel8x0 snd-pcm]

snd-mpu401-uart         4096   0  [snd-intel8x0]

snd-rawmidi            15392   0  [snd-mpu401-uart]

snd-seq-device          4452   0  [snd-rawmidi]

snd                    34052   1  [snd-pcm-oss snd-mixer-oss snd-intel8x0 snd-pcm snd-timer snd-ac97-codec snd-mpu401-uart snd-rawmidi snd-seq-device]

ntfs                   77996   2  (autoclean)

bcm4400                27360   1 

sg                     29356   0 

ide-scsi                8624   0 

sr_mod                 16152   0  (autoclean) 
```

----------

## DeadMonkey

Thanks for the writeup, I'll give it a try when I get home.

Wondering, though, what remote you're doing this for?  Most of the docs I've seen have to do with getting the grey remote to work; I have the black one from Hauppauge.

I'm trying to get my PVR-250 to work with MythTV and so far the only issues are with LIRC.  Then again I'm using the ebuild, although I tried the CVS version and for some reason it won't make.  Maybe I'm doing something wrong.

At any rate, the point I'm at now is that I can't get irw or irxevent to work.  I have a config file for it, but I want to see what the output is from the remote (see if I'm actually getting any signals from it at all!).  All I get are connection refused messages on both accounts.  

But like I said, I'll give it a shot!

BTW, if you load lirc_i2c, it should automagically load lirc_dev.  At least it does in my case!

----------

## abarlam

I have the black hauppauge remote with the TV, RADIO, MINIMIZE, RESERVED, etc buttons.   I had problems with lirc recognizing the remote until I used the proper config file from lirc.org

----------

## tressi

Thanks for the instructions, they actually work  :Smile: 

Luckily I only spent umm, 1 night desperately trying to get the ebuild work..

----------

## vrih

It worked fine for me running the ebuild then downloading the relevant config files for my card. My remote appeared fine at /dev/lirc/0 . The only problem I had was that the lirc programs seem to look for just /dev/lirc by default.

----------

## handsomepete

Replying to bookmark.  Thanks for the writeup.

----------

## theonlymcc

I did all that, and it worked up until testing tvtime.  I dont get anything.  I emerged it again.  What next?

----------

## kmj0377

I've got my remote working with irw, I started lircd like this:

/usr/sbin/lircd -n --device=/dev/lirc/0

I was looking at the settings.pro in the file in my /usr/portage/distfiles and it has the lirc stuff commented out that they say to use on the MythTV site to have it natively support lirc.  It says you can also use a .lircrc file, however it doesn't seem to use that.  Has anyone gotten MythTV to use this file?

----------

## kmj0377

 *kmj0377 wrote:*   

> I've got my remote working with irw, I started lircd like this:
> 
> /usr/sbin/lircd -n --device=/dev/lirc/0
> 
> I was looking at the settings.pro in the file in my /usr/portage/distfiles and it has the lirc stuff commented out that they say to use on the MythTV site to have it natively support lirc.  It says you can also use a .lircrc file, however it doesn't seem to use that.  Has anyone gotten MythTV to use this file?

 

Nevermind, it's irxevent that I forgot to run   :Embarassed: 

----------

## kmj0377

 *kmj0377 wrote:*   

> I've got my remote working with irw, I started lircd like this:
> 
> /usr/sbin/lircd -n --device=/dev/lirc/0
> 
> I was looking at the settings.pro in the file in my /usr/portage/distfiles and it has the lirc stuff commented out that they say to use on the MythTV site to have it natively support lirc.  It says you can also use a .lircrc file, however it doesn't seem to use that.  Has anyone gotten MythTV to use this file?

 

Nevermind, it's irxevent that I forgot to run   :Embarassed: 

----------

## kmj0377

 *kmj0377 wrote:*   

> I've got my remote working with irw, I started lircd like this:
> 
> /usr/sbin/lircd -n --device=/dev/lirc/0
> 
> I was looking at the settings.pro in the file in my /usr/portage/distfiles and it has the lirc stuff commented out that they say to use on the MythTV site to have it natively support lirc.  It says you can also use a .lircrc file, however it doesn't seem to use that.  Has anyone gotten MythTV to use this file?

 

Nevermind, it's irxevent that I forgot to run   :Embarassed: 

----------

## Rroet

Which kernel version where you using.

Every body keeps posting without kernel versions, i2c and ivtv versions. And I'm currently having much trouble getting the modules compiled without errors. so specific versions would help a big load.

Thanks

----------

## badcherry

One thing that people failed to mention so far is that you cannot use a tainted gentoo kernel.  You must download a kernel fresh from kernel.org (I am using 2.4.26) and compile it with the required options.  I then got lirc-0.6.6 to comipile and work.  It is a bit of messing around, but I got it working in an hour's time.

----------

## Neo_0815

It seemed i cant find the proper config file on lirc.org ... i must be blind ... anyone can help me, i've searching for haupauge win tv card ... but i cant find anything on www.lirc.org.

best regards

edit: few seconds after writing this i got it  :Wink: 

----------

## eGore911

Here is what I did to get lirc working for a Hauppauge 878 (bttv). The first part is preparation:

```

emerge config-kernel

config-kernel --allow-writeable=yes

emerge -C gentoo-dev-sources && emerge gentoo-dev-sources

```

Well, since gentoo now supports external modules to be build (and access files OUTSIDE the sandbox) after using config-kernel a little bit, I used it. The allow-writeable option is considered a security risk, but I don't have any problem with that. Also you have to reemerge the sources you had (I think to get the right permissions). Since I use gentoo dev sources, I reemerged them.

Now let's install lirc and load the module

```

LIRC_OPTS="--with-driver=hauppauge" emerge lirc

modprobe lirc-i2c

echo "lirc-i2c" >> /etc/modules.autoload.de/kernel-2.6

```

That was it for me. I tested it with

```

irrecord TESTFILE -d /dev/lirc0

```

----------

## drescherjm

I got mine working with a patch

https://forums.gentoo.org/viewtopic.php?t=170205&highlight=lirc+patch

but I do admit lirc is very broken and it does not seem that anyone is working on it at all as the download from the lirc webpage is 2 years old...   :Evil or Very Mad: 

----------

## eGore911

Take a look at the snapshots (which are available in portage). Those show that people are still working on lirc.

----------

## Nonus

all i did was get the latest cvs snapshot and compile that with nothing special and everything worked.

the problem I have with lirc is that sometimes the command gets executed twice.

ex.

load xmms

press off on the remote (closes xmms)

run xmms

then xmms will close again.

It seems that lirc stores commands for a while and executes them again one the program is launch. I tried repeat=0 but it doesnt work so i think its something in /etc/lircd.conf that I have to configure.

EDIT: I am running the vinalla 2.6.8.1 kernel.

----------

## eGore911

I guess you are using a serial lirc remote, right? Because as far as I know the default is to build lirc for remotes connected via serial port.

Or maybe only the ebuild does it this way and lirc (witout ebuild) builds all drivers.

----------

## Nonus

Im using the hauppauge grey remote.

Actually the new cvs drivers have a menu you navigate to select the remote type when you do ./configure. Its a nice touch I might add.

Latest and greatest CVS snapshot. Works on 2.6.8.1.

http://lirc.sourceforge.net/software/snapshots/lirc-0.7.0pre7.tar.bz2

----------

## `djinn`

I noticed several people used the cvs version; some with problems, some not. However, I had problems with it. I got an error at the end of configure and could not 'make'...

```
config.status: error: cannot find input file: Makefile.in
```

using the ebuild for lirc-0.7.0_pre6 the module lirc_i2c was never built. I went and made the driver in the drivers/lirc_i2c/ directory of the cvs version and threw it i /lib/modules/`uname -r`/.../i2c/ and installed the rest with the ebuild (lirc-0.7.0_pre6). I thought I would put this on here just in case anyone else had this problem.

without  lirc_i2c loaded /dev/lirc/0 will not exist, also changed the entry in /etc/conf.d/lircd:

```
LIRCD_OPTS="-d /dev/lirc/0"
```

and then irw worked like a champ!

also, http://wilsonet.com/mythtv/lircrc-haupgrey.txt is a great ready-made config for the gray remote.

----------

## JanErik

I have followed this, but I cannot use lircd or any of the utilities as a user. All work as root though. Should I just run chmod +s on them?

Edit: Just FIY, you should run

```
chmod 666 /dev/lircd
```

I have now also put 

```
/usr/local/sbin/lircd -n&
```

in /etc/conf.d/local.start, works fine.

Just put

```
irexec&
```

in your .xinitrc to get that started up aswell.

----------

