[PATCH] IR doesn`t work (lirc_igorplugusb)

Bug #364699 reported by Denis
28
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux-lts-backport-maverick (Ubuntu)
Confirmed
Undecided
Unassigned

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

Tags: patch
Revision history for this message
RK (kubuntu-rk) wrote :

Hi,

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)
Revision history for this message
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
Revision history for this message
RK (kubuntu-rk) wrote :

It is reported here (as you could have seen yourself easily...), what more do you expect me to do?
http://sourceforge.net/tracker/?func=detail&aid=2801991&group_id=5444&atid=305444
Why again does this make the bug report Incomplete?

Changed in lirc (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
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?

Revision history for this message
RK (kubuntu-rk) wrote :

Attached updated diff for karmic

Revision history for this message
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.

Revision history for this message
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.)

Revision history for this message
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
Revision history for this message
Gregor Müllegger (gregor-muellegger) wrote :

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?

Revision history for this message
hinkman (mhinkman) wrote :

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

Revision history for this message
Ipeacocks (ipeacocks) wrote :

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

Revision history for this message
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?

PACKAGE_NAME="lirc"
PACKAGE_VERSION="0.8.6"
CLEAN="rm -f *.*o"
MAKE[0]="make dkms KSRC=$kernel_source_dir KVER=$kernelver"
AUTOINSTALL="yes"

BUILT_MODULE_NAME[0]="lirc_dev"
BUILT_MODULE_LOCATION[0]="modules"
DEST_MODULE_LOCATION[0]="/updates/lirc"

BUILT_MODULE_NAME[1]="lirc_atiusb"
BUILT_MODULE_LOCATION[1]="modules"
DEST_MODULE_LOCATION[1]="/updates/lirc"

BUILT_MODULE_NAME[2]="lirc_bt829"
BUILT_MODULE_LOCATION[2]="modules"
DEST_MODULE_LOCATION[2]="/updates/lirc"

BUILT_MODULE_NAME[3]="lirc_ite8709"
BUILT_MODULE_LOCATION[3]="modules"
DEST_MODULE_LOCATION[3]="/updates/lirc"

#BUILT_MODULE_NAME[4]="lirc_i2c"
#BUILT_MODULE_LOCATION[4]="modules"
#DEST_MODULE_LOCATION[4]="/updates/lirc"

BUILT_MODULE_NAME[4]="lirc_igorplugusb"
BUILT_MODULE_LOCATION[4]="modules"
DEST_MODULE_LOCATION[4]="/updates/lirc"

BUILT_MODULE_NAME[5]="lirc_imon"
BUILT_MODULE_LOCATION[5]="modules"
DEST_MODULE_LOCATION[5]="/updates/lirc"

BUILT_MODULE_NAME[6]="lirc_it87"
BUILT_MODULE_LOCATION[6]="modules"
DEST_MODULE_LOCATION[6]="/updates/lirc"

BUILT_MODULE_NAME[7]="lirc_mceusb"
BUILT_MODULE_LOCATION[7]="modules"
DEST_MODULE_LOCATION[7]="/updates/lirc"

BUILT_MODULE_NAME[8]="lirc_ttusbir"
BUILT_MODULE_LOCATION[8]="modules"
DEST_MODULE_LOCATION[8]="/updates/lirc"

BUILT_MODULE_NAME[9]="lirc_sasem"
BUILT_MODULE_LOCATION[9]="modules"
DEST_MODULE_LOCATION[9]="/updates/lirc"

BUILT_MODULE_NAME[10]="lirc_serial"
BUILT_MODULE_LOCATION[10]="modules"
DEST_MODULE_LOCATION[10]="/updates/lirc"

BUILT_MODULE_NAME[11]="lirc_sir"
BUILT_MODULE_LOCATION[11]="modules"
DEST_MODULE_LOCATION[11]="/updates/lirc"

BUILT_MODULE_NAME[12]="lirc_streamzap"
BUILT_MODULE_LOCATION[12]="modules"
DEST_MODULE_LOCATION[12]="/updates/lirc"

BUILT_MODULE_NAME[13]="lirc_ene0100"
BUILT_MODULE_LOCATION[13]="modules"
DEST_MODULE_LOCATION[13]="/updates/lirc"

Revision history for this message
adriankoooo (adriankoooo) wrote :

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

Revision history for this message
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

Revision history for this message
MarcRandolph (mrand) wrote :
Changed in lirc (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
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.

Christoph

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...!

Revision history for this message
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.

Revision history for this message
RK (kubuntu-rk) wrote :

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

Revision history for this message
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.

Revision history for this message
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

Revision history for this message
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  
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.