[PATCH] IR doesn`t work (lirc_igorplugusb)

Bug #364699 reported by Denis on 2009-04-21
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux-lts-backport-maverick (Ubuntu)

Bug Description

Binary package hint: lirc

Hi, I have IgorPlug-USB(AVR) receiver, it works on Windows fine with 4-5 transmitters I have tested.

I have installed generic Jaunty (Intrepid, some other custom kernels.. with no luck too).
I have Installed lirc package and chose from the list Igor Cesko USB receiver.

On boot I see that appropriate kernel module loaded without errors:
$ dmesg | grep lirc
[ 21.824130] lirc_dev: IR Remote Control driver registered, major 61
[ 21.868206] lirc_igorplugusb: USB remote driver for LIRC v0.1
[ 21.868218] lirc_igorplugusb: Jan M. Hochstein <email address hidden>
[ 21.944392] lirc_dev: lirc_register_plugin: sample_rate: 100
[ 21.993818] lirc_igorplugusb[3]: Ing. Igor Cesko, Copyright(c) 2003 IgorPlug-USB (AVR) on usb3:3
[ 21.997883] usbcore: registered new interface driver lirc_igorplugusb

So I run irw utility to test the system and press buttons on transmitter, irw gives no output instead of received characters.
$ irw

In dmesg output I see buffer overrun error on each keypress:
$ dmesg | grep lirc
[ 21.824130] lirc_dev: IR Remote Control driver registered, major 61
[ 21.868206] lirc_igorplugusb: USB remote driver for LIRC v0.1
[ 21.868218] lirc_igorplugusb: Jan M. Hochstein <email address hidden>
[ 21.944392] lirc_dev: lirc_register_plugin: sample_rate: 100
[ 21.993818] lirc_igorplugusb[3]: Ing. Igor Cesko, Copyright(c) 2003 IgorPlug-USB (AVR) on usb3:3
[ 21.997883] usbcore: registered new interface driver lirc_igorplugusb
[ 165.356078] lirc_igorplugusb[3]: Device buffer overrun.
[ 165.700094] lirc_igorplugusb[3]: Device buffer overrun.

The same story with all transmitters I tested. All of them work in Windows. I think the problem is in lirc_igorplugusb kernel module, almost the same code in all distributions.

I have now skills in IR technology so.. reported this bug to you. Any help will be appreciated.

Thanks, Denis

RK (kubuntu-rk) wrote :


I yesterday debugged this driver. While I cannot fix the actual buffer overrun, I can do the best possible to recover from it. The Igor USB device internally provides a circular buffer of a limited length. In case the buffer overrun happens, the driver would only report back to lirc_dev the data that was not yet overwritten - but not the data that overwrote older data. Fixing this (and adding some sanity checks to make sure not to cause illegal reads) causes as much of the received data to be sent to lirc as had been received in the ring buffer. This is enough to make my Onkyo remote work (though mode2 and my old serial lirc keycodes proved helpful configuring the remote), as the relevant bits are at the end of the sequence.

tags: added: patch
summary: - IR doesn`t work (lirc_igorplugusb)
+ [PATCH] IR doesn`t work (lirc_igorplugusb)
Mario Limonciello (superm1) wrote :

Has this been submitted upstream yet? Can you send it to them first to make sure it looks good? Once we've got an ack from upstream we can add it in.

Changed in lirc (Ubuntu):
status: New → Incomplete
RK (kubuntu-rk) wrote :

It is reported here (as you could have seen yourself easily...), what more do you expect me to do?
Why again does this make the bug report Incomplete?

Changed in lirc (Ubuntu):
status: Incomplete → Triaged
Egghead (jimbobway-n) wrote :

having the same problem here, using the igor usb receiver. it seemed to work for a bit but if too many buttons pressed it will start corrupting the output, looks like a different code coming thru but its really just improperly truncated.

id love to try this patch to see if it corrects the problem, but i'm having problems finding a how to on applying a patch and then compiling a kernel module. anyone know of a good how to for applying this patch?

RK (kubuntu-rk) wrote :

Attached updated diff for karmic

RK (kubuntu-rk) wrote :

Installation instructions:
* save attachment in /usr/src/lirc-0.8.5/drivers/lirc_igorplugusb/
* patch file:
  cp lirc_igorplugusb.c lirc_igorplugusb.c.orig
  patch -i patchfile lirc_igorplugusb.c
  cp lirc_igorplugusb.c lirc_igorplugusb.c.mod
* for karmic, lirc_i2c doesn't build, so remove from /usr/src/lirc-0.8.5/dkms.conf (comment entry and reuse number in the last entry as they have to be consecutive) and from /usr/src/lirc-0.8.5/Makefile (remove i2c from the DRIVERS= line)
* rebuild with dkms:
dkms remove -m lirc -v 0.8.5 --all
dkms add -m lirc -v 0.8.5
dkms build -m lirc -v 0.8.5 --verbose
dkms install -m lirc -v 0.8.5
* restart lirc:
/etc/init.d/lirc stop
rmmod lirc_igorplugusb lirc_dev
/etc/init.d/lirc start
If rmmod crashes, you'll have a kernel segfault in /var/log/syslog, in that case you have to reboot.

RK (kubuntu-rk) wrote :

Btw, patch was applied "with some cleanup" to upstream cvs. (I didn't check what was clean up, though, as it works for me.)

RK (kubuntu-rk) wrote :

This patch was applied by bug self service (i.e. the suggested patch makes it into Ubongo by accidently upgrading to the next version multiple months after the fix was provided) in lirc 0.8.6-0ubuntu1. See the patch in comment #4 which contains my changes.

Changed in lirc (Ubuntu):
status: Triaged → Fix Released

This Bug still exists for me. I'm using karmic and have the lirc-0.8.6-0ubuntu2 package installed. I have the following "dmesg | grep lirc" output after pressing several buttons on the IR Remote.

[ 2146.050174] lirc_dev: IR Remote Control driver registered, major 61
[ 2146.051569] lirc_igorplugusb: USB remote driver for LIRC v0.2
[ 2146.051571] lirc_igorplugusb: Jan M. Hochstein <email address hidden>
[ 2146.051591] usbcore: registered new interface driver lirc_igorplugusb
[ 2207.580609] lirc_dev: lirc_register_driver: sample_rate: 100
[ 2207.602563] lirc_igorplugusb[2]: Ing. Igor Cesko, Copyright(c) 2003 IgorPlug-USB (AVR) on usb4:2
[ 2225.608489] lirc_igorplugusb[2]: Device buffer overrun.
[ 2226.438207] lirc_igorplugusb[2]: Device buffer overrun.
[ 2227.574821] lirc_igorplugusb[2]: GET_INFRACODE: error 0
[ 2227.584817] lirc_igorplugusb[2]: Device buffer overrun.
[ 2228.124636] lirc_igorplugusb[2]: Device buffer overrun.
[ 2229.172283] lirc_igorplugusb[2]: Device buffer overrun.

What do you think?

hinkman (mhinkman) wrote :

I can confirm that the buffer overrun still appears in karmic as described in comment #9.

Ipeacocks (ipeacocks) wrote :

i also have this problem in karmic. Do I can patched lirc-0.8.6 as in #6 & #5?

Ipeacocks (ipeacocks) wrote :

>for karmic, lirc_i2c doesn't build, so remove from /usr/src/lirc-0.8.5/dkms.conf (comment entry and reuse number in the last entry as they have to be consecutive)

this is right?

CLEAN="rm -f *.*o"
MAKE[0]="make dkms KSRC=$kernel_source_dir KVER=$kernelver"
















adriankoooo (adriankoooo) wrote :

Still not fixed? I am using latest version, but still get overrun error.

adriankoooo (adriankoooo) wrote :

And when I want to patch the latest version from lirc.org, the 0.8.6 version -so it's look like it was already patched, but no, it is doesn't work.....

root@ubuntu:/usr/src/lirc-0.8.6/drivers/lirc_igorplugusb# patch -i pat lirc_igorplugusb.c
patching file lirc_igorplugusb.c
Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #2 FAILED at 268.
Hunk #3 FAILED at 296.
Hunk #4 FAILED at 326.
Hunk #5 FAILED at 352.
4 out of 5 hunks FAILED -- saving rejects to file lirc_igorplugusb.c.rej

MarcRandolph (mrand) wrote :
Changed in lirc (Ubuntu):
status: Fix Released → Confirmed
adriankoooo (adriankoooo) wrote :

I tried:

root@ubuntu:~# dmesg | grep lirc
[ 9.758490] lirc_dev: IR Remote Control driver registered, major 61
[ 9.792655] lirc_igorplugusb: USB remote driver for LIRC v0.2
[ 9.792665] lirc_igorplugusb: Jan M. Hochstein <email address hidden>
[ 9.792722] lirc_dev: lirc_register_driver: sample_rate: 100
[ 9.839989] lirc_igorplugusb[2]: Ing. Igor Cesko, Copyright(c) 2003 IgorPlug-USB (AVR) on usb2:2
[ 9.846907] usbcore: registered new interface driver lirc_igorplugusb
[ 125.223573] lirc_igorplugusb[2]: Device buffer overrun.
[ 132.520765] lirc_igorplugusb[2]: Device buffer overrun.
[ 134.299833] lirc_igorplugusb[2]: GET_INFRACODE: error 0
[ 141.535051] lirc_igorplugusb[2]: GET_INFRACODE: error 0
[ 170.029157] lirc_igorplugusb[2]: Device buffer overrun.
[ 186.567516] lirc_igorplugusb[2]: Device buffer overrun.
[ 188.742372] lirc_igorplugusb[2]: Device buffer overrun.
[ 201.152886] lirc_igorplugusb[2]: Device buffer overrun.
[ 201.743577] lirc_igorplugusb[2]: GET_INFRACODE: error 0
[ 202.283294] lirc_igorplugusb[2]: GET_INFRACODE: error 0
[ 206.891885] lirc_igorplugusb[2]: Device buffer overrun.
[ 207.325664] lirc_igorplugusb[2]: Device buffer overrun.
[ 207.548542] lirc_igorplugusb[2]: Device buffer overrun.
[ 207.716455] lirc_igorplugusb[2]: Device buffer overrun.
[ 207.941338] lirc_igorplugusb[2]: Device buffer overrun.
[ 208.149226] lirc_igorplugusb[2]: Device buffer overrun.
[ 208.352126] lirc_igorplugusb[2]: Device buffer overrun.
[ 208.568021] lirc_igorplugusb[2]: Device buffer overrun.
[ 208.738920] lirc_igorplugusb[2]: Device buffer overrun.
[ 208.969798] lirc_igorplugusb[2]: Device buffer overrun.

The author of lirc replied me in mail:

Hi Adrián,

This is a hardware issue. The signal of your remote is too long for the
interal hardware buffer. You should use a RC-5 remote with the Igor
device. That should work.


So maybe it is can't be fixed in driver? I am trying to use with an Apple Remote.

mode2 works OK:

root@ubuntu:~# mode2 -d /dev/lirc0
space 14005907
pulse 597
space 512
pulse 597
space 1621
pulse 597
space 1621
pulse 597
space 512
pulse 597
space 1621
pulse 597
space 1621
pulse 597
space 597
pulse 597
space 426
pulse 597
space 597

at this time, while I press a button on the remote I get the error message in dmesg,

I hope it is can be fixed...!

RK (kubuntu-rk) wrote :

Hi guys, can we please re-close the bug? There's nothing anymore on the software side that can be fixed. The Igorplug has a ring buffer of limited length. If your remote control sends sequences that are longer than that (e.g. like my Onkyo RC 242S), then the buffer overrun is bound to happen each time the remote sends a button press. My proposed patch thus removed the error message (because it doesn't provide any further help), but the author of lirc decided to leave it in. My proposed patch also removed the message if the device said "dude actually on second thought I don't have data for you" (the "GET_INFRACODE: error 0" message). The author accepted that on second try (that's what's in r1.35). So the original fix for this bug only made sure as much information as available would be returned, just as in the w32 driver (it previously returned only the part that was neither overwritten nor overwrote something, the part that overwrote something was missing).

tl;dr: the driver is as good as it gets except for useless messages.

If the recording tool doesn't work for you, then you still can use mode2 to get the pattern for each key press and then manually derive an lircd.conf file from it.

RK (kubuntu-rk) wrote :

The patch fixing this - relevant is the added CODE_LENGTH factor.

RK (kubuntu-rk) wrote :

All previously mentioned patches are in the lirc version shipped with maverick.

However, in maverick, lirc_igorplugusb still does not work with remotes causing a buffer overflow. The reason is that the ring buffer of the driver is too small, causing events to get lost. (In my case, it sufficed reproducibly for 13 out of 16 bits of actual information, meaning 15 out of 18 pulses.) As that is no integer factor, it seems some timing changed that now causes the buffer to be full (and writing failing), while it didn't before. Anyway, the buffer needs to be 36 (DEVICE_BUFLEN) codes (=18 pulses) plus one pulse for the gap since the last signal, instead of the same in bytes. Increasing the buffer fixes it.

Alec Leamas (leamas-alec) wrote :

Since at least lirc-0.9.0 the igorplugusb driver has been upstreamed to the kernel. IMHO, this means that this bug should be either closed or re-assigned to the kernel. There is no igorplugusb code whatsoever in lirc

Alec Leamas (leamas-alec) wrote :

Definitely the kernel (media subsystem), possibly wrong kernel version (sorry...)

affects: lirc (Ubuntu) → linux-lts-xenial (Ubuntu)
affects: linux-lts-xenial (Ubuntu) → linux-lts-backport-maverick (Ubuntu)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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