# LIRC work with 2.6 kernel?

## asiobob

I have development-sources 2.6.7 as my kernel, thats basically the stock kernel from kernel.org 

I wish to use this kernel for a variety of reasons. Of course I can patch the sources to get more functionality.

----

I have a Leadtek Winfast tv2000XP delux tv tuner with remote control.

How do I go about getting this to work? I've seen many a thread but its all confusing.

The infared dector plugs into the back of the tuner.

Whats the process I have to go to get this to work?

----------

## grzewho

if your kernel sources dont provide the lirc patch you have to patch them manually, or you can try any other sources (for example love-sources) which have the lirc patch applied

----------

## asiobob

yeh where do I get the patch from? Does this patch work for any "supported" reomte or are there various patches for serial connections etc.. (mine connects to the tuner card itself)

----------

## Sipi

Basically, it is enough to 

ACCEPT_KEYWORDS="~x86" LIRC_OPTS="--with-driver=xxx" emerge lirc

where xxx is the needed driver, you should look at the lirc ebuild to see what driver you need.

It should detect that it is a 2.6 series kernel.

Unfortunatelly, new kernels doesn't have the lirc patch. The last working one was gentoo-dev-sources-2.6.4-r1. It works well.

You should try to patch your new kernel with this old kernel's patchset. It is genkernel-2.6-4.27.tar.bz2, if you uncompress, you will find the lirc patchset. Or search for a newer one, if exists.

Emerge will compile only the daemons and binaries, since your kernel will have the drivers, and install the needed config file in /etc.

Also, you can find some posts about lirc if you search the forum.

Sipi

----------

## Sipi

You will need the lirc-i2c driver. In kernel config, you will need to enable as module the multimedia bt8xx module, the i2c modules, after all you can select the i2c lirc module. (If you don't enable these ones, there will be no lirc-i2c available.)

Sipi

----------

## halfgaar

 *Sipi wrote:*   

> Basically, it is enough to 
> 
> ACCEPT_KEYWORDS="~x86" LIRC_OPTS="--with-driver=xxx" emerge lirc
> 
> where xxx is the needed driver, you should look at the lirc ebuild to see what driver you need.
> ...

 

You'd better make a (or add to) /etc/portage/package.keywords which contains:

app-misc/lirc ~x86

to make lirc use unstable sources. Using "ACCEPT_KEYWORDS=~x86 emerge bla" can ruin dependencies all over you system, if I understand correctly. By using package.keywords, every time deps are calculated, they are based on lirc using ~x86.

And add LIRC_OPTS="--with-driver=xxx" to make.conf.

----------

## El_Presidente_Pufferfish

http://flameeyes.web.ctonet.it/index.html#lirc

So you're saying i dont need that patch?

----------

## trpn

the LIRC_OPTS="--with-driver=xxx" will not work if you have a 2.6 kernel. I tried it, doesn't make the modules. I checked out the ebuild and it says not to do so (I think) if you are running 2.6.

So, I commented out the parts that give instructions saying only to build the lirc daemons, tools etc and it built my kernel module with the LIRC_OPTS. 

At this point I was quite pleased, but it won;t work! .. I can modprobe lirc_serial and start lircd but if i try anything such as "irw" it will crash lirc.

so maybe you do need the kernel patches

edit: pre6 (and I think pre4) will only compile if you symlink /usr/src/linux/arch/x86 to /usr/src/linux/arch/i386

edit2: pre6 no longer supports devfs as per what the lirc mailing lists say. This means that you have to create the device "mknod /dev/lirc/serial c 61 0" (if you are using lirc_serial)

after you create the device

1. chmod 666 /dev/lircd

2. modprobe lirc_serial

3. lircd -d /dev/lirc/serial

so I guess you have to use udev (???) or do those three things after installing lirc

here is the modified ebuild 

```
# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/app-misc/lirc/lirc-0.7.0_pre4.ebuild,v 1.7 2004/06/28 03:56:00 vapier Exp $

 

inherit eutils kernel-mod

 

DESCRIPTION="LIRC is a package that allows you to decode and send infra-red \

        signals of many (but not all) commonly used remote controls."

HOMEPAGE="http://www.lirc.org"

 

# LIRC_OPTS = ???? v

# This are the defaults. With this support for all supported remotes

# will be build.

# If you want other options then set the Environment variable to your needs.

 

# Note: If you don't specify the driver configure becomes interactiv.

 

# You have to know, which driver you want;

# --with-driver=X

 

# where X is one of:

# none, any, animax, avermedia, avermedia98,

# bestbuy, bestbuy2, caraca, chronos, comX,

# cph03x, cph06x, creative, fly98, flyvideo,

# hauppauge,hauppauge_dvb, ipaq, irdeo,

# irdeo_remote, irman, irreal, it87, knc_one,

# logitech, lptX, mediafocusI, packard_bell,

# parallel, pctv, pixelview_bt878,

# pixelview_pak, pixelview_pro, provideo,

# realmagic, remotemaster, serial, silitek,

# sir, slinke, tekram, winfast_tv2000

 

# This could be usefull too

 

# --with-port=port      # port number for the lirc device.

# --with-irq=irq        # irq line for the lirc device.

# --with-timer=value    # timer value for the parallel driver

# --with-tty=file       # tty to use (Irman, RemoteMaster, etc.)

# --without-soft-carrier        # if your serial hw generates carrier

# --with-transmitter    # if you use a transmitter diode

 

SLOT="0"

LICENSE="GPL-2"

IUSE=""

KEYWORDS="~x86 ~ppc ~alpha ~ia64 amd64"

 

DEPEND="virtual/linux-sources"

 

MY_P=${P/_/}

 

SRC_URI="http://lirc.sourceforge.net/software/snapshots/${MY_P}.tar.bz2"

 

S=${WORKDIR}/${MY_P}

 

is_SMP() {

        # We have a SMP enabled kernel?

        if [ ! -z "`uname -v | grep SMP`" ]

        then

                return 0

        else

                return 1

        fi

}

 

src_unpack() {

        unpack ${A}

        cd ${S}

        sed     -i -e "s:-O2 -g:${CFLAGS}:" configure configure.in

}

 

src_compile() {

 

        # Let portage tell us where to put our modules

        check_KV

 

        [ "x${LIRC_OPTS}" = x ] && LIRC_OPTS="--with-driver=serial \

                --with-port=0x3f8 --with-irq=4"

 

        ./configure \

                --host=${CHOST} \

                --prefix=/usr \

                --infodir=/usr/share/info \

                --mandir=/usr/share/man \

                --with-kerneldir="/usr/src/linux" \

                --with-moduledir="/lib/modules/${KV}/misc" \

                --disable-manage-devices \

                --enable-sandboxed \

                --with-syslog=LOG_DAEMON \

                ${LIRC_OPTS} || die "./configure failed"

 

                emake || die

 

                case ${LIRC_OPTS}

                in

                  *"any"*)

                        if is_SMP; then

                                # The parallel driver will not work with SMP kernels

                                # so we need to compile without it

                                emake -C drivers "SUBDIRS=lirc_dev lirc_serial \                                lirc_sir lirc_it87 lirc_i2c lirc_gpio" || die

                        else

                                emake -C drivers "SUBDIRS=lirc_dev lirc_serial \                                lirc_parallel lirc_sir lirc_it87 lirc_i2c \

                                lirc_gpio" || die

                        fi

                ;;

                esac

}

 

src_install() {

 

                emake || die

                make DESTDIR=${D} install || die

 

                case ${LIRC_OPTS}

                in

                  *"any"*)

                        insinto /lib/modules/${KV}/misc

                        if is_SMP; then

                                for i in lirc_dev lirc_serial \

                                        lirc_sir lirc_it87 lirc_i2c lirc_gpio

                                do

                                doins drivers/${i}/${i}.o

                                done

                        else

                                for i in lirc_dev lirc_serial \

                                        lirc_parallel lirc_sir lirc_it87 lirc_i2c lirc_gpio

                                do

                                doins drivers/${i}/${i}.o

                                done

                        fi

                ;;

                esac

 

 

        exeinto /etc/init.d

        doexe ${FILESDIR}/lircd

 

        insinto /etc/conf.d

        newins ${FILESDIR}/lircd.conf lircd

 

        dohtml doc/html/*.html

}

 

pkg_postinst() {

#       if kernel-mod_is_2_4_kernel; then

                /usr/sbin/update-modules

#       fi

 

        einfo

        einfo "The lirc Linux Infrared Remote Control Package has been"

        einfo "merged, please read the documentation, and if necessary"

        einfo "add what is needed to /etc/modules.autoload or"

        einfo "/etc/modules.d.  If you need special compile options"

        einfo "then read the comments at the begin of this"

        einfo "ebuild (source) and set the LIRC_OPTS environment"

        einfo "variable to your needs."

        einfo

}

```

----------

## trpn

ok I have done some more reading ... apparently the no devfs for lirc-0.7pre6 is a bug, as it is listed under "known issues". The maintainer of lirc is apparently also building it to support kernel 2.6 and pre6 does compile with it. 

Might have to wait till pre7 unless you want to mess around like I did.. I just signed up to the lirc mailing list, so when I hear of a new version I will try it and see how that goes.

----------

## Sipi

 *trpn wrote:*   

> the LIRC_OPTS="--with-driver=xxx" will not work if you have a 2.6 kernel. I tried it, doesn't make the modules. I checked out the ebuild and it says not to do so (I think) if you are running 2.6.
> 
> 

 

Yes, because original LIRC modules does not comple on 2.6. That's why we need to patch the kernel with new LIRC pathces. For that, the LIRC ebuild sees if we use 2.4 or 2.6 - on 2.4, there is no LIRC modules in kernel, so it will compile modules and binaries, on 2.6 modules are in the kernel, so it compiles only the binaries.

I can install LIRC with the ebuilds in Portage. And if you don't specify the driver type with LIRC_OPTS, it will not copy the correct lircd.conf file into /etc, so basically, lircd and modules will work, but lircd will not know what to do when a button is pressed. (Buttons are defined in the config file.)

Sipi

----------

