Lirc GPIO module not buildable on 2.6.22 kernel

Bug #125384 reported by Mario Limonciello
6
Affects Status Importance Assigned to Milestone
linux-ubuntu-modules-2.6.22 (Ubuntu)
Won't Fix
Undecided
Mario Limonciello

Bug Description

Binary package hint: lirc

Kernel 2.6.22's bttv headers need to be added to the package.

Related branches

Changed in lirc:
assignee: nobody → superm1
status: New → In Progress
Revision history for this message
Mario Limonciello (superm1) wrote :

The attached debdiff fixes compilation of lirc-modules-source's gpio module. Also, this resolves issues with cmdir linking that were later discovered.

Changed in lirc:
status: In Progress → Confirmed
Revision history for this message
Mario Limonciello (superm1) wrote :

lirc (0.8.2-0ubuntu2) gutsy; urgency=low

  * Make sure lirc_gpio is buildable by adding extra_2.6.22
    to 03_extra_files.dpatch. (LP: #125384)
  * Add 05_fix_cmdir.dpatch from lirc CVS to fix cmdir linking
    issues.
  * Add a symbolic link in case /usr/share/doc/lirc/lirc.hwdb
    is being used.
  * Add 13_warning_cleanup.dpatch to cleanup all compilation warnings
    encountered before submitting to the ubuntu kernel team.

 -- Mario Limonciello <email address hidden> Wed, 11 Jul 2007 21:18:46 -0500

Changed in lirc:
status: Confirmed → Fix Released
Revision history for this message
hexion (hexium) wrote :

It's still not buildable here.
I followed your instructions here: https://help.ubuntu.com/community/Install_Lirc_Feisty
but with no results:
# modprobe lirc_gpio
FATAL: Error inserting lirc_gpio (/lib/modules/2.6.22-8-generic/misc/lirc_gpio.ko): Unknown symbol in module, or unknown parameter (see dmesg)

#dmesg
...
4746.344000] lirc_gpio: Unknown symbol bttv_get_cardinfo
[ 4746.344000] lirc_gpio: Unknown symbol bttv_get_gpio_queue
[ 4746.344000] lirc_gpio: Unknown symbol bttv_debug
[ 4790.444000] lirc_gpio: Unknown symbol bttv_get_cardinfo
[ 4790.444000] lirc_gpio: Unknown symbol bttv_get_gpio_queue
[ 4790.444000] lirc_gpio: Unknown symbol bttv_debug
[ 4797.704000] lirc_gpio: Unknown symbol bttv_get_cardinfo
[ 4797.704000] lirc_gpio: Unknown symbol bttv_get_gpio_queue
[ 4797.708000] lirc_gpio: Unknown symbol bttv_debug
[ 5050.104000] lirc_gpio: Unknown symbol bttv_get_cardinfo
[ 5050.104000] lirc_gpio: Unknown symbol bttv_get_gpio_queue
[ 5050.104000] lirc_gpio: Unknown symbol bttv_debug
[ 5137.936000] lirc_gpio: Unknown symbol bttv_get_cardinfo
[ 5137.936000] lirc_gpio: Unknown symbol bttv_get_gpio_queue
[ 5294.116000] lirc_gpio: Unknown symbol bttv_get_cardinfo
[ 5294.116000] lirc_gpio: Unknown symbol bttv_get_gpio_queue
[ 5294.116000] lirc_gpio: Unknown symbol bttv_debug

Also compiling from source don't work. Maybe lirc has to be updated upstream.
Regards ;)

Changed in lirc:
status: Fix Released → Confirmed
Revision history for this message
hexion (hexium) wrote :

Sorry, I misunderstood what this patch was for...

After reading some posts in the Lirc mailing list (included yours), I realized that there's no solution yet since some symbols have been deleted in the vanilla kernel. I suppose this patch is then to make lirc_gpio build, it's not intended to make it work :)

Sorry for reopening this bug.

BTW, maybe this info is usefull for you. It's about a bug I filed in kernel.org regarding the ir_common problem. Devs sent there some usefull info that Lirc devs should read. I haven't posted it yet in the mailing list cause I'm too lazy to register by now :)

http://bugzilla.kernel.org/show_bug.cgi?id=7395

Revision history for this message
hexion (hexium) wrote :

After reading posts in the mailing list of Lirc, and the bug you filed in launchpad, I started thinking about how to solve this problem.

Well, I got it Now I'm running Lirc with 2.6.22 kernel using lirc_gpio module.

I simply added the functions droped in the source code, recompiled some modules, installed them and recompile Lirc.

Of course this is a temporal fix till Lirc devs adapt the code to the new API, but it's unlike that that's done before Gutsy is frozen, so this patch should do the trick.

Note: The files are not patches, they are the source files edited by me. This is the code I added:

drivers/media/video/bt8xx/bttv.h:
// lirc_gpio support starts

extern wait_queue_head_t* bttv_get_gpio_queue(unsigned int card);
extern int bttv_get_cardinfo(unsigned int card, int *type,
                 unsigned int *cardid);

// lirc_gpio support ends

drivers/media/video/bt8xx/bttv-if.c:

// lirc_gpio support starts
EXPORT_SYMBOL(bttv_get_gpio_queue);
EXPORT_SYMBOL(bttv_get_cardinfo);

int bttv_get_cardinfo(unsigned int card, int *type, unsigned *cardid)
{
    printk("The bttv_* interface is obsolete and will go away,\n"
           "please use the new, sysfs based interface instead.\n");
    if (card >= bttv_num) {
        return -1;
    }
    *type = bttvs[card].c.type;
    *cardid = bttvs[card].cardid;
    return 0;
}

wait_queue_head_t* bttv_get_gpio_queue(unsigned int card)
{
    struct bttv *btv;

    if (card >= bttv_num) {
        return NULL;
    }

    btv = &bttvs[card];
    if (bttvs[card].shutdown) {
        return NULL;
    }
    return &btv->gpioq;
}

// lirc_gpio support ends

Revision history for this message
hexion (hexium) wrote :
Revision history for this message
hexion (hexium) wrote :

To build lirc_gpio, we need to hack the kernel until lirc devs solve the problem

Changed in lirc:
status: Confirmed → New
Revision history for this message
Ben Collins (ben-collins) wrote :

The headers aren't available because they aren't in the normal place (include/). We build lirc modules in linux-ubuntu-modules. If any are missing, file a bug there and we can see about getting that worked out

Changed in linux-source-2.6.22:
status: New → Invalid
Revision history for this message
hexion (hexium) wrote :

I think you didn't understand...

Well, this is a problem with lirc, but it's because linux developers have dropped some functions from the BTTV module. There's a new API to be used, but lirc developers haven't change the code to adapt it.

It's unlikely that they fix it before Gutsy is released (and maybe before Gutsy+1 even), so, in order to fix the problem I added the dropped functions in the kernel files.

What I wan't is to add these lines in the kernel source, so BTTV module is built with support for lirc_gpio. So, the package affected is linux-source, not the headers.

Regards.

Changed in linux-source-2.6.22:
assignee: superm1 → nobody
status: Invalid → New
Revision history for this message
Mario Limonciello (superm1) wrote : Re: [Bug 125384] Re: Lirc GPIO module not buildable on 2.6.22 kernel

As a temporary workaround, those functions (and headers) might suffice in
the lirc_gpio source directly rather than modifying the kernel sources.
I'll do some experiments, and if things appear to work correctly push the
changes back out to linux-ubuntu-modules. Otherwise, we'll have to wait for
a fix from upstream.

Mario

On 7/26/07, hexion <email address hidden> wrote:
>
> I think you didn't understand...
>
> Well, this is a problem with lirc, but it's because linux developers
> have dropped some functions from the BTTV module. There's a new API to
> be used, but lirc developers haven't change the code to adapt it.
>
> It's unlikely that they fix it before Gutsy is released (and maybe
> before Gutsy+1 even), so, in order to fix the problem I added the
> dropped functions in the kernel files.
>
> What I wan't is to add these lines in the kernel source, so BTTV module
> is built with support for lirc_gpio. So, the package affected is linux-
> source, not the headers.
>
> Regards.
>
> ** Changed in: linux-source-2.6.22 (Ubuntu)
> Assignee: Mario Limonciello => (unassigned)
> Status: Invalid => New
>
> --
> Lirc GPIO module not buildable on 2.6.22 kernel
> https://bugs.launchpad.net/bugs/125384
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Mario Limonciello
<email address hidden>

Changed in linux-source-2.6.22:
assignee: nobody → superm1
status: New → In Progress
Revision history for this message
hexion (hexium) wrote :

Is that possible? Lost functions are provided by an external module (bttv), so if you want to implement those functions inside lirc_gpio, it should have access to the internal implementation of bttv. And that would require to export all the variables and functions that those 2 functions use, to be visible by lirc_gpio...

Mmmm... I don't think it's a good idea. It's a lot simplier just adding that code to those 2 files in the kernel sources, IMHO.

Revision history for this message
Mario Limonciello (superm1) wrote :

As this only affects lirc_gpio, i don't think using the deprecated functions
outside of lirc_gpio would be a good idea (putting this patch back out to
the kernel sources). I've already got work arounds in the source to include
missing bttv headers there. I'll see what happens. Hexion do you have
something needing to use lirc_gpio on gutsy you would be able to test with?

Mario

On 7/26/07, hexion <email address hidden> wrote:
>
> Is that possible? Lost functions are provided by an external module
> (bttv), so if you want to implement those functions inside lirc_gpio, it
> should have access to the internal implementation of bttv. And that
> would require to export all the variables and functions that those 2
> functions use, to be visible by lirc_gpio...
>
> Mmmm... I don't think it's a good idea. It's a lot simplier just adding
> that code to those 2 files in the kernel sources, IMHO.
>
> --
> Lirc GPIO module not buildable on 2.6.22 kernel
> https://bugs.launchpad.net/bugs/125384
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Mario Limonciello
<email address hidden>

Revision history for this message
hexion (hexium) wrote :

Do you reffer on something that uses that module? Only lirc itself...
I currently have it working with my patched bttv and standard lirc_gpio (compiled from source as I recommended in my howto)

Revision history for this message
hexion (hexium) wrote :

Mario, when you've got the workaround, post here the module lirc_gpio.ko (compiled for 2.6.22-8-generic). I'll write it to /lib/modules/ and try to load it. If it does, I'll test it with "irw" command.

If all of that works, then I'll make the final test by undoing the changes to bttv I did and testing again with irw.

BTW, if you make this work exporting those functions into lirc's source, I'll take a look at the code. I'm curious about how you will do it :)

Revision history for this message
Mario Limonciello (superm1) wrote :

It will be seen in this release:

linux-ubuntu-modules-2.6.22 (2.6.22-9.21) gutsy; urgency=low

  [Ben Collins]

  * ABI bump
  * rt2x00: Update from wireless-dev, v2.0.4
  * ubuntu: Add -rt for i386/amd64 builds

  [Mario Limonciello]

  * lirc: Fix support for Hauppauge I2C devices
  * lirc: Add deprecated functions for lirc_gpio to link with until fixed
    upstream.

 -- Ben Collins <email address hidden> Sat, 28 Jul 2007 12:47:41 -0400

Changed in linux-ubuntu-modules-2.6.22:
status: In Progress → Fix Committed
Revision history for this message
hexion (hexium) wrote :

I installed the package.

Now lirc_gpio can be loaded, and lircd launched... but when I run irw, lircd dies.
Something strange I noticed is that lirc_gpio doesn't depend on bttv as it used to do:

# lsmod | grep lirc
lirc_gpio 37088 0
lirc_dev 15860 0

# lsmod | grep bttv
bttv 177012 1 bt878
video_buf 26244 1 bttv
ir_common 35460 1 bttv
compat_ioctl32 2304 1 bttv
i2c_algo_bit 7428 1 bttv
btcx_risc 5896 1 bttv
tveeprom 16784 1 bttv
i2c_core 26112 10 eeprom,i2c_isa,tuner,tvaudio,i2c_ali1563,bttv,i2c_algo_bit,tveeprom,i2c_ali1535,i2c_ali15x3
videodev 29312 1 bttv
v4l2_common 18432 4 tuner,tvaudio,bttv,videodev
v4l1_compat 15364 2 bttv,videodev

Revision history for this message
hexion (hexium) wrote :

Before (with 2.6.22-8 and my modifications in the kernel source) it was:

$ lsmod | grep lirc
lirc_gpio 11184 1
lirc_dev 16116 1 lirc_gpio
bttv 172788 2 lirc_gpio,bt878

$ lsmod | grep bttv
bttv 172788 2 lirc_gpio,bt878
video_buf 24324 1 bttv
ir_common 35232 1 bttv
compat_ioctl32 2432 1 bttv
i2c_algo_bit 7428 1 bttv
btcx_risc 5768 1 bttv
tveeprom 16784 1 bttv
videodev 29312 1 bttv
v4l2_common 18432 4 tuner,tvaudio,bttv,videodev
v4l1_compat 15364 2 bttv,videodev
i2c_core 26112 10 eeprom,i2c_isa,i2c_ali1535,tuner,tvaudio,i2c_ali1563,i2c_ali15x3,bttv,i2c_algo_bit,tveeprom

hexion (hexium)
Changed in linux-ubuntu-modules-2.6.22:
status: Fix Committed → Confirmed
Revision history for this message
Jorge Suárez de Lis (ys) wrote :

Same here.

Here's a lirc typical die:

# lircd -n
lircd-0.8.2[21492]: lircd(userspace) ready
lircd-0.8.2[21492]: accepted new client on /dev/lircd <-- kde tries to connect
lircd-0.8.2[21492]: could not get file information for /dev/lirc
lircd-0.8.2[21492]: default_init(): No such file or directory
lircd-0.8.2[21492]: caught signal
Terminado

No /dev/lirc* files are created (but /dev/lircd), and lirc_gpio isn't depending on lirc_dev... there's something wrong in here!

Revision history for this message
Jorge Suárez de Lis (ys) wrote :

It seems we don't need lirc_gpio anymore.

I've followed the steps found at http://bugs.archlinux.org/task/7660?pagenum=11 and http://www.sthoughts.com/?p=332 to make it working. However, we should find a plug-and-go solution to this.

First, unload lirc_dev, lirc_gpio, bttv. Then create this file: /etc/modprobe.d/bttv with this contents:

alias char-major-81 videodev
alias char-major-81-0 bttv
options bttv card=6 radio=1 pll=1 tuner=5

This will cause the remote work with dev/input interface. If you load the bttv module you will see now the new input entry:

I: Bus=0001 Vendor=1461 Product=0004 Version=0001
N: Name="bttv IR (card=6)"
P: Phys=pci-0000:02:03.0/ir0
S: Sysfs=/class/input/input14
U: Uniq=
H: Handlers=kbd event6
B: EV=100003
B: KEY=40fc310 82140000 0 0 0 0 2048000 180 4001 9e0000 0 0 ffc

This is, the remote is now working from /dev/input/event6. We need to say this to lirc. In /etc/lirc/hardware.conf:

DRIVER="dev/input"
DEVICE="/dev/input/event6"
MODULES="lirc_dev"

You can also create a udev rule to make this more consistent:

/etc/udev/rules.d/10-lirc.rules:
SUBSYSTEM=="input", ATTR{dev}=="13:70", NAME="input/irdev"

Look at the major:minor numbers of your event file to make sure the minor number is 70. It's known that some people have a minor number of 72. Some programs like irkick will need this file to be /lirc/lircX, as /dev/lirc0 to work properly.

Then invoke-rc.d lirc restart, and the remote should work now. As said in that page, it works but you will need a new lircd.conf. I've recorded a new one using irrecord, and it's attached to this post.

Everything is working now, but that was... nearly crazyness!! We need to easy this to final users.

Revision history for this message
Mario Limonciello (superm1) wrote :

yS,

This is a quite valuable find here for a solution. I'm going to query
lirc-list to see if they would be willing to deprecate the usage of the
module in modern kernels. I think for now that lirc_gpio driver will
need to be removed from the build. Adapting this to work in a plug and
play fashion however, that is another story :)

Mario

Revision history for this message
Jorge Suárez de Lis (ys) wrote :

> Adapting this to work in a plug and play fashion however, that is another story :)

I think the only needed lines on most configurations are:

alias char-major-81 videodev
alias char-major-81-0 bttv

Adding this to default modprobe options on all systems shouldn't be so traumatic, as well as an udev rule to make a /dev/lirc link to /dev/input/eventX, as this one...

SUBSYSTEM=="input", ATTR{dev}=="13:7[02]", SYMLINK+="lirc"

But I'm dissapointed because my card seems to be detected as 15, and no event file is created. It works like a charm when using card type 6, but it won't be so nice to all people.

However, adding that will ease things for people whose card is detected as 6.

Yes, I know this isn't supossed to be on this thread, but if finally the lirc_gpio goes deprecated we must find the nicest solution to all people. Some ideas?

Revision history for this message
Daniel Holbach (dholbach) wrote :

Which patch should be sponsored at the moment?

Revision history for this message
Mario Limonciello (superm1) wrote :

Daniel,

At this moment, things are being re-evaluated. Could you remove
ubuntu-main-sponsors from this bug? I'll have a newer lirc patch after this
is determined upstream.

Mario

On 8/22/07, Daniel Holbach <email address hidden> wrote:
>
> Which patch should be sponsored at the moment?
>
> --
> Lirc GPIO module not buildable on 2.6.22 kernel
> https://bugs.launchpad.net/bugs/125384
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Mario Limonciello
<email address hidden>

Revision history for this message
Daniel Holbach (dholbach) wrote :

Done.

Revision history for this message
Mario Limonciello (superm1) wrote :

LIRC has been disabled in the latest patch to linux-ubuntu-modules. It wasn't functional for the users that needed it, and was loading for the users who didn't Instead, users will have to use /dev/input for GPIO devices, unless this gets fixed upstream with a buildable, functional GPIO module on modern kernels.

Changed in linux-ubuntu-modules-2.6.22:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.