# lirc_serial and kernel >2.6.36 => Invalid module  [solved]

## stegerpl

Hi,

Since my kernel-update I have problems with lirc: everything compiles (except =app-misc/lirc-9999 - see below) but my former lirc setup does not work anymore. If I try to load the module lirc_serial (I am using an homebrew IR-sensor) I just get:

 *Quote:*   

> FATAL: Error inserting lirc_serial (/lib/modules/2.6.39-gentoo-r1/misc/lirc_serial.ko): Invalid module format

 

However lirc itself seems to run - because I get the following:

 *Quote:*   

> ls /dev/lir* -l
> 
> lrwxrwxrwx 1 root root 19 27. Sep 18:28 /dev/lircd -> /var/run/lirc/lircd

 

But If I want to make a test with mode2 or irw I just get NOTHING - even an error message.

dmesg says:

 *Quote:*   

> dmesg | grep lirc
> 
> [    2.215359] lirc_dev: IR Remote Control driver registered, major 251 
> 
> [    2.216174] lirc_serial: port 03f8 already in use
> ...

 

and my /etc/modprobe.d/lirc.conf says:

 *Quote:*   

> cat /etc/modprobe.d/lirc.conf
> 
> options lirc_serial irq=4 io=0x3f8
> 
> # install lirc_serial setserial /dev/ttyS0 uart none; modprobe --ignore-install lirc_serial

 

I also tried to upgrade to =app-misc/lirc-9999  but the compilation fails with:

 *Quote:*   

>   x86_64-pc-linux-gnu-gcc -Wp,-MD,/var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/.lirc_dev.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include -I/usr/src/linux-2.6.39-gentoo-r1/arch/x86/include -Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DIRCTL_DEV_MAJOR=61 -DEXPORT_SYMTAB -DHAVE_CONFIG_H -I. -I../.. -I/var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/. -I/var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/. -I/var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/../.. -I/var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/../.. -I/usr/src/linux//include/ -I/usr/src/linux//drivers/media/video/  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(lirc_dev)"  -D"KBUILD_MODNAME=KBUILD_STR(lirc_dev)" -c -o /var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/lirc_dev.o /var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/lirc_dev.c
> 
> /var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/lirc_dev.c:45:28: Fehler: linux/smp_lock.h: Datei oder Verzeichnis nicht gefunden
> 
> /var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev/lirc_dev.c: In Funktion »irctl_compat_ioctl«:
> ...

 

I checked out the problems described in some threads about wrong major/minor number and others but coult not find a proper solution for my system:

 *Quote:*   

> Portage 2.1.10.18 (default/linux/amd64/10.0, gcc-4.4.4, glibc-2.12.2-r0, 2.6.39-gentoo-r1 x86_64)
> 
> =================================================================
> 
>                         System Settings
> ...

 

anyone who can help me...please

Peter

----------

## peje

I would use the kernel driver found under staging drivers lirc-serial, then compile lirc with use userland

cu peje

----------

## stegerpl

Hi peje,

thanks for the hint - but I did this already => as far as I know lirc-serial is only within the staging section. I tried with build into the kernel as well as module.

The thing with "use userland" I did not know up to now - so I did a :

 *Quote:*   

> USE="-transmitter userland" emerge =app-misc/lirc-0.9.0

  but nothing improved - or did I missunderstand you...

Peter

----------

## stegerpl

Pushing    :Smile: 

----------

## peje

Sorry I've to correct (I've 2 boxes...);  with serial receiver I've the modules from the kernel and lirc-9999  LIRC_DEVICES="serial" for mce-usb I had to choose  LIRC_DEVICES="userspace"

hope this helps

```

linux # cat /usr/src/linux/.config | grep LIRC

CONFIG_LIRC=m

CONFIG_IR_LIRC_CODEC=m

CONFIG_LIRC_STAGING=y

# CONFIG_LIRC_BT829 is not set

# CONFIG_LIRC_IGORPLUGUSB is not set

# CONFIG_LIRC_IMON is not set

# CONFIG_LIRC_SASEM is not set

CONFIG_LIRC_SERIAL=m

# CONFIG_LIRC_SERIAL_TRANSMITTER is not set

# CONFIG_LIRC_SIR is not set

# CONFIG_LIRC_TTUSBIR is not set

# CONFIG_LIRC_ZILOG is not set

linux # dmesg | grep lirc

[    9.472896] lirc_dev: IR Remote Control driver registered, major 250 

[    9.474595] lirc_serial: module is from the staging directory, the quality is unknown, you have been warned.

[   10.345106] lirc_serial: auto-detected active low receiver

[   10.345211] lirc_serial lirc_serial.0: lirc_dev: driver lirc_serial registered at minor = 0

```

cu peje

----------

## stegerpl

still no success.... 

tried again to update overlay and portage as well but lirc-9999 still does not compile with kernel 2.6.39-r1 with some messages that confuse me:  *Quote:*   

> make -C /usr/src/linux/ SUBDIRS=/var/tmp/portage/app-misc/lirc-9999/work/lirc/drivers/lirc_dev modules \
> 
>         KBUILD_VERBOSE=1
> 
> make[4]: Entering directory `/usr/src/linux-2.6.39-gentoo-r1'
> ...

 

I did the following, but the messages kept the same: *Quote:*   

> cd /usr/src/linux
> 
> make oldconfig && make prepare

 

I found the lirc-9999 only in amielke-overlay => is there any other overlay with an other version of lirc-9999

I checked also the kernel config to be the same as peje reported above (but could not manage to make CONFIG_LIRC ans CONFIG_IR_LIRC_CODEC as modules).

When I install the lirc-0.9.0 I get the following messages after reboot (lirc not working):  *Quote:*   

> dmesg | grep lirc
> 
> [    2.260927] lirc_dev: IR Remote Control driver registered, major 251 
> 
> [   13.632484] lirc_dev: exports duplicate symbol lirc_dev_fop_write (owned by kernel)
> ...

 

any ideas?

Peter

----------

## peje

Try it with newer kernel:

```

Linux peje 3.0.4-gentoo #1 SMP Sat Sep 3 17:16:25 CEST 2011 x86_64 AMD Athlon(tm) II X4 640 Processor AuthenticAMD GNU/Linux

```

I may have altered the ebuild, here's the one I used:

```

# Copyright 1999-2009 Gentoo Foundation

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

# $Header:

inherit eutils linux-mod flag-o-matic autotools git

EGIT_REPO_URI="git://lirc.git.sourceforge.net/gitroot/lirc/lirc"

DESCRIPTION="decode and send infra-red signals of many commonly used remote controls"

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

#ECVS_SERVER="lirc.cvs.sourceforge.net:/cvsroot/lirc"

#ECVS_MODULE="lirc"

LICENSE="GPL-2"

SLOT="0"

KEYWORDS="~amd64 ~x86"

IUSE="debug doc X hardware-carrier transmitter"

#S="${WORKDIR}/${MY_P}"

#S=${WORKDIR}/${ECVS_MODULE}

RDEPEND="

        X? (

                x11-libs/libX11

                x11-libs/libSM

                x11-libs/libICE

        )

        lirc_devices_alsa_usb? ( media-libs/alsa-lib )

        lirc_devices_audio? ( >media-libs/portaudio-18 )

        lirc_devices_irman? ( media-libs/libirman )"

# This are drivers with names matching the

# parameter --with-driver=NAME

IUSE_LIRC_DEVICES_DIRECT="

        all userspace accent act200l act220l

        adaptec alsa_usb animax asusdh atilibusb

        atiusb audio audio_alsa avermedia avermedia_vdomate

        avermedia98 awlibusb bestbuy bestbuy2 breakoutbox

        bte bw6130 caraca chronos commandir

        cph06x creative creative_infracd

        devinput digimatrix dsp dvico ea65 ene0100

        exaudio flyvideo ftdi gvbctv5pci hauppauge

        hauppauge_dvb hercules_smarttv_stereo i2cuser

        igorplugusb iguanaIR imon imon_24g imon_knob

        imon_lcd imon_pad imon_rsc irdeo irdeo_remote

        irlink irman irreal it87 ite8709

        knc_one kworld leadtek_0007 leadtek_0010

        leadtek_pvr2000 livedrive_midi

        livedrive_seq logitech macmini mceusb

        mediafocusI mouseremote

        mouseremote_ps2 mp3anywhere mplay nslu2

        packard_bell parallel pcmak pcmak_usb

        pctv pixelview_bt878 pixelview_pak

        pixelview_pro provideo realmagic

        remotemaster sa1100 samsung sasem sb0540 serial

        silitek sir slinke streamzap tekram

        tekram_bt829 tira ttusbir tuxbox tvbox udp uirt2

        uirt2_raw usb_uirt_raw usbx wpc8769l"

# drivers that need special handling and

# must have another name specified for

# parameter --with-driver=NAME

IUSE_LIRC_DEVICES_SPECIAL="

        serial_igor_cesko

        remote_wonder_plus xboxusb usbirboy inputlirc"

IUSE_LIRC_DEVICES="${IUSE_LIRC_DEVICES_DIRECT} ${IUSE_LIRC_DEVICES_SPECIAL}"

#device-driver which use libusb

LIBUSB_USED_BY_DEV="

        all atilibusb awlibusb sasem igorplugusb imon imon_lcd imon_pad

        imon_rsc streamzap mceusb xboxusb irlink commandir"

for dev in ${LIBUSB_USED_BY_DEV}; do

        DEPEND="${DEPEND} lirc_devices_${dev}? ( dev-libs/libusb )"

done

# adding only compile-time depends

DEPEND="${RDEPEND} ${DEPEND}

        virtual/linux-sources

        lirc_devices_ftdi? ( dev-embedded/libftdi )

        lirc_devices_all? ( dev-embedded/libftdi )"

# adding only run-time depends

RDEPEND="${RDEPEND}

        lirc_devices_usbirboy? ( app-misc/usbirboy )

        lirc_devices_inputlirc? ( app-misc/inputlircd )

        lirc_devices_iguanaIR? ( app-misc/iguanaIR )"

# add all devices to IUSE

for dev in ${IUSE_LIRC_DEVICES}; do

        IUSE="${IUSE} lirc_devices_${dev}"

done

add_device() {

        : ${lirc_device_count:=0}

        ((lirc_device_count++))

        if [[ ${lirc_device_count} -eq 2 ]]; then

                ewarn

                ewarn "When selecting multiple devices for lirc to be supported,"

                ewarn "it can not be guaranteed that the drivers play nice together."

                ewarn

                ewarn "If this is not intended, then abort emerge now with Ctrl-C,"

                ewarn "Set LIRC_DEVICES and restart emerge."

                ewarn

                epause

        fi

        local dev="${1}"

        local desc="device ${dev}"

        if [[ -n "${2}" ]]; then

                desc="${2}"

        fi

        elog "Compiling support for ${desc}"

        MY_OPTS="${MY_OPTS} --with-driver=${dev}"

}

pkg_setup() {

        if use lirc_devices_mceusb2

        then

                ewarn "The mceusb2 driver has been merged into the mceusb."

                ewarn "Please only use the latter now."

        fi

        ewarn "If your LIRC device requires modules, you'll need MODULE_UNLOAD"

        ewarn "support in your kernel."

        linux-mod_pkg_setup

        # set default configure options

        MY_OPTS=""

        LIRC_DRIVER_DEVICE="/dev/lirc0"

        if use lirc_devices_all; then

                # compile in drivers for a lot of devices

                add_device all "a lot of devices"

        else

                # compile in only requested drivers

                local dev

                for dev in ${IUSE_LIRC_DEVICES_DIRECT}; do

                        if use lirc_devices_${dev}; then

                                add_device ${dev}

                        fi

                done

                if use lirc_devices_remote_wonder_plus; then

                        add_device atiusb "device Remote Wonder Plus (atiusb-based)"

                fi

                if use lirc_devices_serial_igor_cesko; then

                        add_device serial "serial with Igor Cesko design"

                        MY_OPTS="${MY_OPTS} --with-igor"

                fi

                if use lirc_devices_imon_pad; then

                        ewarn "The imon_pad driver has incorporated the previous pad2keys patch"

                        ewarn "and removed the pad2keys_active option for the lirc_imon module"

                        ewarn "because it is always active."

                        ewarn "If you have an older imon VFD device, you may need to add the module"

                        ewarn "option display_type=1 to override autodetection and force VFD mode."

                fi

                if use lirc_devices_xboxusb; then

                        add_device atiusb "device xboxusb"

                fi

                if use lirc_devices_usbirboy; then

                        add_device userspace "device usbirboy"

                        LIRC_DRIVER_DEVICE="/dev/usbirboy"

                fi

                if [[ "${MY_OPTS}" == "" ]]; then

                        if [[ "${PROFILE_ARCH}" == "xbox" ]]; then

                                # on xbox: use special driver

                                add_device atiusb "device xboxusb"

                        else

                                # no driver requested

                                elog

                                elog "Compiling only the lirc-applications, but no drivers."

                                elog "Enable drivers with LIRC_DEVICES if you need them."

                                MY_OPTS="--with-driver=none"

                        fi

                fi

        fi

        use hardware-carrier && MY_OPTS="${MY_OPTS} --without-soft-carrier"

        use transmitter && MY_OPTS="${MY_OPTS} --with-transmitter"

        if [[ -n "${LIRC_OPTS}" ]] ; then

                ewarn

                ewarn "LIRC_OPTS is deprecated from lirc-0.8.0-r1 on."

                ewarn

                ewarn "Please use LIRC_DEVICES from now on."

                ewarn "e.g. LIRC_DEVICES=\"serial sir\""

                ewarn

                ewarn "Flags are now set per use-flags."

                ewarn "e.g. transmitter, hardware-carrier"

                local opt

                local unsupported_opts=""

                # test for allowed options for LIRC_OPTS

                for opt in ${LIRC_OPTS}; do

                        case ${opt} in

                                --with-port=*|--with-irq=*|--with-timer=*|--with-tty=*)

                                        MY_OPTS="${MY_OPTS} ${opt}"

                                        ;;

                                *)

                                        unsupported_opts="${unsupported_opts} ${opt}"

                                        ;;

                        esac

                done

                if [[ -n ${unsupported_opts} ]]; then

                        ewarn "These options are no longer allowed to be set"

                        ewarn "with LIRC_OPTS: ${unsupported_opts}"

                        die "LIRC_OPTS is no longer recommended."

                fi

        fi

        # Setup parameter for linux-mod.eclass

        MODULE_NAMES="lirc(misc:${S})"

        BUILD_TARGETS="all"

        ECONF_PARAMS="  --localstatedir=/var

                                        --with-syslog=LOG_DAEMON

                                        --enable-sandboxed

                                        --with-kerneldir=${KV_DIR}

                                        --with-moduledir=/lib/modules/${KV_FULL}/misc

                                        $(use_enable debug)

                                        $(use_with X x)

                                        ${MY_OPTS}"

        einfo

        einfo "lirc-configure-opts: ${MY_OPTS}"

        elog  "Setting default lirc-device to ${LIRC_DRIVER_DEVICE}"

        filter-flags -Wl,-O1

        # force non-parallel make, Bug 196134

        MAKEOPTS="${MAKEOPTS} -j1"

}

src_unpack() {

        #unpack ${A}

#       cvs_src_unpack ${A}

        git_src_unpack

        cd "${S}"

        # Rip out dos CRLF

        edos2unix contrib/lirc.rules

        # Apply patches needed for some special device-types

        use lirc_devices_audio || epatch "${FILESDIR}"/lirc-0.8.4-portaudio_check.patch

        use lirc_devices_remote_wonder_plus && epatch "${FILESDIR}"/lirc-0.8.3_pre1-remotewonderplus.patch

        # remove parallel driver on SMP systems

        if linux_chkconfig_present SMP ; then

                sed -i -e "s:lirc_parallel\.o::" drivers/lirc_parallel/Makefile.am

        fi

        # Bug #187418

        if kernel_is ge 2 6 22 ; then

                ewarn "Disabling lirc_gpio driver as it does no longer work Kernel 2.6.22+"

                sed -i -e "s:lirc_gpio\.o::" drivers/lirc_gpio/Makefile.am

        fi

        # correct autoconf.h location if 2.6.33

        if kernel_is ge 2 6 33 ; then

                sed -i 's/linux\/autoconf.h/generated\/autoconf.h/g' drivers/*/*.c

        fi

        # respect CFLAGS

        sed -i -e 's:CFLAGS="-O2:CFLAGS=""\n#CFLAGS="-O2:' configure.ac

        # setting default device-node

        local f

        for f in configure.ac acconfig.h; do

                [[ -f "$f" ]] && sed -i -e '/#define LIRC_DRIVER_DEVICE/d' "$f"

        done

        echo "#define LIRC_DRIVER_DEVICE \"${LIRC_DRIVER_DEVICE}\"" >> acconfig.h

        eautoreconf

}

src_install() {

        emake DESTDIR="${D}" install || die "emake install failed"

        newinitd "${FILESDIR}"/lircd-0.8.6 lircd

        newinitd "${FILESDIR}"/lircmd lircmd

        newconfd "${FILESDIR}"/lircd.conf.2 lircd

        insinto /etc/modprobe.d/

        newins "${FILESDIR}"/modprobed.lirc lirc.conf

        newinitd "${FILESDIR}"/irexec-initd-0.8.6-r2 irexec

        newconfd "${FILESDIR}"/irexec-confd irexec

        if use doc ; then

                dohtml doc/html/*.html

                insinto /usr/share/doc/${PF}/images

                doins doc/images/*

        fi

        insinto /usr/share/lirc/remotes

        doins -r remotes/*

        keepdir /var/run/lirc /etc/lirc

        if [[ -e "${D}"/etc/lirc/lircd.conf ]]; then

                newdoc "${D}"/etc/lirc/lircd.conf lircd.conf.example

        fi

}

pkg_preinst() {

        linux-mod_pkg_preinst

        local dir="${ROOT}/etc/modprobe.d"

        if [[ -a "${dir}"/lirc && ! -a "${dir}"/lirc.conf ]]; then

                elog "Renaming ${dir}/lirc to lirc.conf"

                mv -f "${dir}/lirc" "${dir}/lirc.conf"

        fi

        # copy the first file that can be found

        if [[ -f "${ROOT}"/etc/lirc/lircd.conf ]]; then

                cp "${ROOT}"/etc/lirc/lircd.conf "${T}"/lircd.conf

        elif [[ -f "${ROOT}"/etc/lircd.conf ]]; then

                cp "${ROOT}"/etc/lircd.conf "${T}"/lircd.conf

                MOVE_OLD_LIRCD_CONF=1

        elif [[ -f "${D}"/etc/lirc/lircd.conf ]]; then

                cp "${D}"/etc/lirc/lircd.conf "${T}"/lircd.conf

        fi

        # stop portage from touching the config file

        if [[ -e "${D}"/etc/lirc/lircd.conf ]]; then

                rm -f "${D}"/etc/lirc/lircd.conf

        fi

}

pkg_postinst() {

        linux-mod_pkg_postinst

        # copy config file to new location

        # without portage knowing about it

        # so it will not delete it on unmerge or ever touch it again

        if [[ -e "${T}"/lircd.conf ]]; then

                cp "${T}"/lircd.conf "${ROOT}"/etc/lirc/lircd.conf

                if [[ "$MOVE_OLD_LIRCD_CONF" = "1" ]]; then

                        elog "Moved /etc/lircd.conf to /etc/lirc/lircd.conf"

                        rm -f "${ROOT}"/etc/lircd.conf

                fi

        fi

        ewarn

        ewarn "The lirc_gpio driver will not work with Kernels 2.6.22+"

        ewarn "You need to switch over to /dev/input/event? if you need gpio"

        ewarn "This device can than then be used via lirc's dev/input driver."

        ewarn

        ewarn "The new default location for lircd.conf is inside of"

        ewarn "/etc/lirc/ directory"

}

```

cu peje

----------

## stegerpl

Hi peje

..yeap it works now with kernel 3.0.4-r1 - however I could not check if it is only the combination with your ebuild or only the -r1 kernel version - but it works !!!

thanks

Peter

----------

## lindegur

Just speculation, if you have still your old kernel run 

```
ls -lR /lib/modules/2.6.39-gentoo-r1/ | grep lirc

```

At least on my system I had both drivers installed the one from the lirc package and the one from the kernel. I had to delete manually the one from the lirc package (The system took always the wrong one) /lib/modules/????-gentoo/misc/lirc and then I run 

```
update-modules --force
```

 to have the system choosing the correct one /lib/modules/?????-gentoo/kernel/drivers/staging/lirc/. 

Updating to new kernel sources gets also rid of the lirc package drivers, but is just a side effect of the update.

This, plus the LIRC_DEVICES="userspace" made LIRC running again on my system. It is a pretty straight forward update to the kernel LIRC drivers, when knowing what to do    :Embarassed: 

----------

