lirc serial port receiver/transmitter device driver
Quoted 247 lines · Jarod Wilson
Quoted 8 lines · On Tuesday 09 September 2008 12:14:22 Jonathan Corbet wrote:
Quoted 8 lines
(quoted diff) +8
-0+#ifdef LIRC_SERIAL_IRDEO +static int type = LIRC_IRDEO; +#elif defined(LIRC_SERIAL_IRDEO_REMOTE) +static int type = LIRC_IRDEO_REMOTE; +#elif defined(LIRC_SERIAL_ANIMAX) +static int type = LIRC_ANIMAX; +#elif defined(LIRC_SERIAL_IGOR) +static int type = LIRC_IGOR;Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+#elif defined(LIRC_SERIAL_NSLU2) +static int type = LIRC_NSLU2; +#else +static int type = LIRC_HOMEBREW; +#endifSo where do all these LIRC_SERIAL_* macros come from? I can't really tell what this bunch of ifdeffery is doing or how one might influence it.
Bleah. I believe these get passed in when building lirc userspace and drivers together, when manually selected the specific type of serial receiver you have in lirc's menu-driven configuration tool thingy...
In other words, they do us absolutely no good here. We just build for the default type (
LIRC_HOMEBREW), and users can override the type as necessary via the 'type' module parameter. I'll nuke that chunk.Quoted 13 lines
Quoted 13 lines
(quoted diff) +13
-0+ +static struct lirc_serial hardware[] = { + /* home-brew receiver/transmitter */ + { + UART_MSR_DCD, + UART_MSR_DDCD, + UART_MCR_RTS|UART_MCR_OUT2|UART_MCR_DTR, + UART_MCR_RTS|UART_MCR_OUT2, + send_pulse_homebrew, + send_space_homebrew, + ( +#ifdef LIRC_SERIAL_TRANSMITTER + LIRC_CAN_SET_SEND_DUTY_CYCLE|Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ LIRC_CAN_SET_SEND_CARRIER| + LIRC_CAN_SEND_PULSE| +#endif + LIRC_CAN_REC_MODE2) + },It would be really nice to use the .field=value structure initialization conventions here.
Indeed. Done.
Quoted 28 lines
Quoted 28 lines
(quoted diff) +17
-0+#if defined(__i386__) +/* + From: + Linux I/O port programming mini-HOWTO + Author: Riku Saikkonen <[email protected]> + v, 28 December 1997 + + [...] + Actually, a port I/O instruction on most ports in the 0-0x3ff range + takes almost exactly 1 microsecond, so if you're, for example,using + the parallel port directly, just do additional inb()s from that port + to delay. + [...] +*/ +/* transmitter latency 1.5625us 0x1.90 - this figure arrived at from + * comment above plus trimming to match actual measured frequency. + * This will be sensitive to cpu speed, though hopefully most of the1.5us + * is spent in the uart access. Still - for reference test machine was a + * 1.13GHz Athlon system - Steve
+ */(quoted diff) +8
-0+ +/* changed from 400 to 450 as this works better on slower machines; + faster machines will use the rdtsc code anyway */ + +#define LIRC_SERIAL_TRANSMITTER_LATENCY 450 + +#else +Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+/* does anybody have information on other platforms ? */ +/* 256 = 1<<8 */ +#define LIRC_SERIAL_TRANSMITTER_LATENCY 256 + +#endif /* __i386__ */This is a little scary. Maybe hrtimers would be a better way of handling your timing issues?
Sounds plausible, will look into it. Of course, this partially hinges on the
USE_RDTSCbits, more comments just a little ways down...Quoted 6 lines
Quoted 6 lines
(quoted diff) +6
-0+static inline unsigned int sinp(int offset) +{ +#if defined(LIRC_ALLOW_MMAPPED_IO) + if (iommap != 0) { + /* the register is memory-mapped */ + offset <<= ioshift;Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ return readb(io + offset); + } +#endif + return inb(io + offset); +}This all looks like a reimplementation of
ioport_map()and the associated ioread*() and iowrite*() functions...?Probably. Will see about using those instead.
Quoted 30 lines
Quoted 16 lines
(quoted diff) +9
-0+#ifdef USE_RDTSC +/* Version that uses Pentium rdtsc instruction to measure clocks */ + +/* This version does sub-microsecond timing using rdtsc instruction, + * and does away with the fudged LIRC_SERIAL_TRANSMITTER_LATENCY + * Implicitly i586 architecture... - Steve + */ + +static inline long send_pulse_homebrew_softcarrier(unsigned longlength) +{
(quoted diff) +6
-0+ int flag; + unsigned long target, start, now; + + /* Get going quick as we can */ + rdtscl(start); on(); + /* Convert length from microseconds to clocks */Review
Quoted 10 lines
(quoted diff) +10
-0+ length *= conv_us_to_clocks; + /* And loop till time is up - flipping at right intervals */ + now = start; + target = pulse_width; + flag = 1; + while ((now-start) < length) { + /* Delay till flip time */ + do { + rdtscl(now); + } while ((now-start) < target);This looks like a hard busy wait, without even an occasional, polite,
cpu_relax()call. There's got to be a better way?Quoted 2 lines
The i2c code has the result of a lot of bit-banging work, I wonder if there's something there which could be helpful here.
Hrm... So at some point in the past, there was an "#if defined(rdtscl)" in the
lirc_serial.ccode that triggeredUSE_RDTSCbeing defined. At the moment, there's nothing defining it (I probably overzealously nuked it during clean- up), so we're not even touching the above code. However, this is supposed to be the "better" code path wrt producing a reliable waveform, at least on platforms with rdtscl... Will have to do some investigating... This actually affects whether or not we bother with hrtimers as suggested above too, asLIRC_SERIAL_TRANSMITTER_LATENCYis not used at all in theUSE_RDTSCcase.Quoted 6 lines
Quoted 6 lines
(quoted diff) +6
-0+static irqreturn_t irq_handler(int i, void *blah) +{ + struct timeval tv; + int status, counter, dcd; + long deltv; + int data;Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ static int last_dcd = -1; + + if ((sinp(UART_IIR) & UART_IIR_NO_INT)) { + /* not our interrupt */ + return IRQ_RETVAL(IRQ_NONE); + }That should just be
IRQ_NONE, no?Yeah, looks like it. Done.
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+static void hardware_init_port(void) +{ + unsigned long flags; + local_irq_save(flags);That won't help you if an interrupt is handled by another processor. This needs proper locking, methinks.
Yeah, working on implementing locking right now.
Quoted 3 lines
Nothing in this function does anything to assure itself that the port actually exists and is the right kind of hardware. Maybe that can't really be done with this kind of device?
We should probably try to make sure the port actually exists, but I don't think there's a whole lot (if anything) we can do as far as verifying the device itself.
Quoted 5 lines
Quoted 2 lines
(quoted diff) +2
-0+static int init_port(void) +{...
Quoted 7 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ if (sense == -1) { + /* wait 1/2 sec for the power supply */ + + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(HZ/2);
msleep(), maybe?Yeah, looks like it.
Quoted 38 lines
Quoted 38 lines
(quoted diff) +28
-0+static int set_use_inc(void *data) +{ + int result; + unsigned long flags; + + /* Init read buffer. */ + if (lirc_buffer_init(&rbuf, sizeof(int), RBUF_LEN) < 0) + return -ENOMEM; + + /* initialize timestamp */ + do_gettimeofday(&lasttv); + + result = request_irq(irq, irq_handler, + IRQF_DISABLED | (share_irq ? IRQF_SHARED : 0), + LIRC_DRIVER_NAME, (void *)&hardware); + + switch (result) { + case -EBUSY: + printk(KERN_ERR LIRC_DRIVER_NAME ": IRQ %d busy\n", irq); + lirc_buffer_free(&rbuf); + return -EBUSY; + case -EINVAL: + printk(KERN_ERR LIRC_DRIVER_NAME + ": Bad irq number or handler\n"); + lirc_buffer_free(&rbuf); + return -EINVAL; + default: + dprintk("Interrupt %d, port %04x obtained\n", irq,io);
(quoted diff) +9
-0+ break; + }; + + local_irq_save(flags); + + /* Set DLAB 0. */ + soutp(UART_LCR, sinp(UART_LCR) & (~UART_LCR_DLAB)); + + soutp(UART_IER, sinp(UART_IER)|UART_IER_MSI);Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ + local_irq_restore(flags); + + return 0; +}OK, so
set_use_inc()really is just anopen()function. It still seems like a strange duplication.
Quoted 8 lines
Going to let the duplication be for the moment, since I don't know the history behind why there's duplication, and there are enough other mountains to climb first... :)
Quoted 2 lines
Again,
local_irq_save()seems insufficient here. You need a lock to serialize access to the hardware.Will do.
I just want to thank you very much for your work and give you my Tested-By. Todays git (b2e9c18a32423310a309f94ea5a659c4bb264378) works well here with lirc-0.8.3 userspace on a Pentium 3/i815-system.
But I've had a section mismatch in the lirc code, don't know if this is serious.
WARNING: drivers/input/lirc/lirc_serial.o(.init.text+0x11e): Section mismatch in reference from the function init_module() to the
function .exit.text:lirc_serial_exit()
The function __init init_module() references
a function __exit lirc_serial_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of lirc_serial_exit() so it may be used outside an exit section.
Regards,
Stefan
Quoted 1 line · On Thursday 11 September 2008 15:49:25 Stefan Bauer wrote:
Jarod Wilson wrote:
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Review
Quoted 11 lines
(quoted diff) +11
-0+static inline unsigned int sinp(int offset) +{ +#if defined(LIRC_ALLOW_MMAPPED_IO) + if (iommap != 0) { + /* the register is memory-mapped */ + offset <<= ioshift; + return readb(io + offset); + } +#endif + return inb(io + offset); +}This all looks like a reimplementation of
ioport_map()and the associated ioread*() and iowrite*() functions...?
Quoted 3 lines
Quoted 1 line
Probably. Will see about using those instead.
From what I've been able to ascertain, reducing the above to...
static u8 sinp(int offset)
{
if (iommap != 0)
/* the register is memory-mapped */
offset <<= ioshift;
return inb(io + offset);
}...should be sane. inb() either calls ioport_map() and ioread8() as needed, or defines inb() as readb() (or __raw_readb()) on platforms where its appropriate. (and similar for lirc_serial.c::soutp()).
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Nothing in this function does anything to assure itself that the port actually exists and is the right kind of hardware. Maybe that can't really be done with this kind of device?
We should probably try to make sure the port actually exists, but I don't think there's a whole lot (if anything) we can do as far as verifying the device itself.
I've borrowed the simple existence test from drivers/serial/8250.c::autoconfig(), which tries a few reads and writes from UART_IER. I think this is probably sufficient for verifying the port is legit.
Christoph B., you're definitely much more familiar with serial IR devices than I am... Is there any sort of test you can think of that we could use to try to verify the existence of an IR device hooked to the port? Or should we be happy we at least know there's a port and just assume the IR device is there?
Quoted 3 lines
I just want to thank you very much for your work and give you my Tested-By. Todays git (
b2e9c18a32423310a309f94ea5a659c4bb264378) works well here with lirc-0.8.3 userspace on a Pentium 3/i815-system.
Oh good! I haven't broken anything further w/my changes up to b2e9c18... ;) I've got another slew of updates to lirc_serial still pending though -- a few that I'm about to push, and at least one more chunk I still need to figure out (the hrtimers/rdtscl bits).
Continued testing would be much appreciated, since I still have no serial IR hardware myself (couldn't find the thingy that shipped with my Technisat card, but I do now have hardware on the way).
Quoted 12 lines
But I've had a section mismatch in the lirc code, don't know if this is serious.
WARNING: drivers/input/lirc/lirc_serial.o(.init.text+0x11e): Section mismatch in reference from the function
init_module()to the function .exit.text:lirc_serial_exit()
The function__initinit_module()references
a function__exitlirc_serial_exit().
This is often seen when error handling in the init function uses functionality in the exit path.
The fix is often to remove the__exitannotation oflirc_serial_exit()so it may be used outside an exit section.
Ah, I believe you're absolutely correct. Done.
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 8 lines · On Friday 12 September 2008 18:24:33 Jarod Wilson wrote:
Quoted 4 lines
I just want to thank you very much for your work and give you my Tested-By. Todays git (
b2e9c18a32423310a309f94ea5a659c4bb264378) works well here with lirc-0.8.3 userspace on a Pentium 3/i815-system.Oh good! I haven't broken anything further w/my changes up to b2e9c18... ;) I've got another slew of updates to
lirc_serialstill pending though
I hope I haven't broken anything with my lirc_dev changes. I doubt I'll have a change to test it before monday.
Janne
Quoted 6 lines · Janne Grunau
Quoted 5 lines · On Friday 12 September 2008 18:24:33 Jarod Wilson wrote:
Quoted 4 lines
I just want to thank you very much for your work and give you my Tested-By. Todays git (
b2e9c18a32423310a309f94ea5a659c4bb264378) works well here with lirc-0.8.3 userspace on a Pentium 3/i815-system.
Quoted 6 lines
Quoted 3 lines
Oh good! I haven't broken anything further w/my changes up to b2e9c18... ;) I've got another slew of updates to
lirc_serialstill pending thoughI hope I haven't broken anything with my
lirc_devchanges. I doubt I'll have a change to test it before monday.
Unfortunately, you did. Commit ea74897 (port lirc to dynamic device numbers) broke things.
This is what ea74897 and further (latest tested was dd13cc7) are telling me:
$ insmod drivers/input/lirc/lirc_dev.ko $ insmod drivers/input/lirc/lirc_serial.ko insmod: error inserting 'drivers/input/lirc/lirc_serial.ko': -1 Input/output error $ dmesg | tail lirc_dev: IR Remote Control driver registered, major 253 lirc_serial: auto-detected active low receiver lirc_dev: lirc_register_driver: sample_rate: 0 lirc_serial: register_chrdev failed!
There has also been a compile issue in the meanwhile, introduced with 95efa30 (inb/outb and readb/writeb deal in u8 types), but this is gone with todays git pull :)
I'll keep on testing (unfortunately only at weekends), regards, Stefan
Quoted 30 lines · On Saturday 13 September 2008 04:41:33 Stefan Bauer wrote:
Quoted 6 lines · Janne Grunau
Quoted 5 lines · On Friday 12 September 2008 18:24:33 Jarod Wilson wrote:
Quoted 4 lines
I just want to thank you very much for your work and give you my Tested-By. Todays git (
b2e9c18a32423310a309f94ea5a659c4bb264378) works well here with lirc-0.8.3 userspace on a Pentium 3/i815-system.Quoted 6 lines
Quoted 3 lines
Oh good! I haven't broken anything further w/my changes up to b2e9c18... ;) I've got another slew of updates to
lirc_serialstill pending thoughI hope I haven't broken anything with my
lirc_devchanges. I doubt I'll have a change to test it before monday.Unfortunately, you did. Commit ea74897 (port lirc to dynamic device numbers) broke things.
This is what ea74897 and further (latest tested was dd13cc7) are telling me:$ insmod drivers/input/lirc/lirc_dev.ko $ insmod drivers/input/lirc/lirc_serial.ko insmod: error inserting 'drivers/input/lirc/lirc_serial.ko': -1 Input/output error $ dmesg | tail lirc_dev: IR Remote Control driver registered, major 253 lirc_serial: auto-detected active low receiver lirc_dev: lirc_register_driver: sample_rate: 0 lirc_serial: register_chrdev failed!
Quoted 7 lines
There has also been a compile issue in the meanwhile, introduced with 95efa30 (inb/outb and readb/writeb deal in u8 types), but this is gone with todays git pull :)
I'll keep on testing (unfortunately only at weekends), regards, Stefan
I'd hope to get around to some testing myself much earlier in the weekend, but alas... Did just mix in a quick peed at lirc_i2c though:
...lirc_dev: IR Remote Control driver registered, major 247
bttv: driver version 0.9.17 loaded
bttv: using 8 buffers with 2080k (520 pages) each for capture cx88/0: cx2388x v4l2 driver version 0.0.6 loadedlirc_i2c: chip 0x10020 found @ 0x18 (Hauppauge IR)lirc_dev: lirc_register_driver: sample_rate: 10
No register_chrdev failure reported, everything looks the same as prior to the dynamic dev num change (save the dev num, of course), and I've got a /dev/lirc0, but I'm unable to see any IR signals (start up lircd, run irw, press buttons on remote).
...and I just took a quick look at lirc_i2c... The result from lirc_register_driver() is never checked, whereas it is in the lirc_serial case (which is where the register_chrdev error msg came from). Narf. So its likely the same failure, just not noticed (will fix lirc_i2c in a sec).
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 55 lines · On Sunday 14 September 2008 23:55:38 Jarod Wilson wrote:
Quoted 30 lines · On Saturday 13 September 2008 04:41:33 Stefan Bauer wrote:
Quoted 6 lines · Janne Grunau
Quoted 5 lines · On Friday 12 September 2008 18:24:33 Jarod Wilson wrote:
Quoted 4 lines
I just want to thank you very much for your work and give you my Tested-By. Todays git (
b2e9c18a32423310a309f94ea5a659c4bb264378) works well here with lirc-0.8.3 userspace on a Pentium 3/i815-system.Quoted 6 lines
Quoted 3 lines
Oh good! I haven't broken anything further w/my changes up to b2e9c18... ;) I've got another slew of updates to
lirc_serialstill pending thoughI hope I haven't broken anything with my
lirc_devchanges. I doubt I'll have a change to test it before monday.Unfortunately, you did. Commit ea74897 (port lirc to dynamic device numbers) broke things.
This is what ea74897 and further (latest tested was dd13cc7) are telling me:$ insmod drivers/input/lirc/lirc_dev.ko $ insmod drivers/input/lirc/lirc_serial.ko insmod: error inserting 'drivers/input/lirc/lirc_serial.ko': -1 Input/output error $ dmesg | tail lirc_dev: IR Remote Control driver registered, major 253 lirc_serial: auto-detected active low receiver lirc_dev: lirc_register_driver: sample_rate: 0 lirc_serial: register_chrdev failed!Quoted 7 lines
There has also been a compile issue in the meanwhile, introduced with 95efa30 (inb/outb and readb/writeb deal in u8 types), but this is gone with todays git pull :)
I'll keep on testing (unfortunately only at weekends), regards, Stefan
I'd hope to get around to some testing myself much earlier in the weekend, but alas... Did just mix in a quick peed at
lirc_i2cthough:...
lirc_dev: IR Remote Control driver registered, major 247
bttv: driver version 0.9.17 loaded
bttv: using 8 buffers with 2080k (520 pages) each for capture cx88/0: cx2388x v4l2 driver version 0.0.6 loadedlirc_i2c: chip0x10020found @0x18(Hauppauge IR)lirc_dev:lirc_register_driver:sample_rate: 10No
register_chrdevfailure reported, everything looks the same as prior to the dynamic dev num change (save the dev num, of course), and I've got a/dev/lirc0, but I'm unable to see any IR signals (start up lircd, run irw, press buttons on remote).
Quoted 4 lines
...and I just took a quick look at
lirc_i2c... The result fromlirc_register_driver()is never checked, whereas it is in thelirc_serialcase (which is where theregister_chrdeverror msg came from). Narf. So its likely the same failure, just not noticed (will fixlirc_i2cin a sec).
So I've done a bit of work to fix up a few drivers so they properly check to see that lirc_register_driver() actually succeeded, and then accidentally stumbled onto the fix for the failure when merging some coverity-inspired patches from Erik Hovland. lirc_dev.c's lirc_cdev_add() function had an inverted kmalloc failure check. With that fixed, lirc_i2c appears to be behaving for me now, although I can't actually check to be 100% certain until I get home tonight.
...lirc_dev: IR Remote Control driver registered, major 240lirc_i2c: probe 0x1a @ ivtv i2c driver #0: nolirc_i2c: probe 0x18 @ ivtv i2c driver #0: yeslirc_i2c: chip 0x10020 found @ 0x18 (Hauppauge IR)lirc_dev: lirc_register_driver: sample_rate: 10lirc_dev: driver lirc_i2c registered at minor number = 0 lirc_dev (lirc_i2c[0]): poll thread startedlirc_i2c: ir_attach: success (minor 0)
...
Fixes are in the git tree now for anyone else who wants to or is willing to test. Will verify myself tonight w/lirc_i2c and lirc_mceusb2 at a minimum.
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 8 lines · On Monday 15 September 2008 14:20:31 Jarod Wilson wrote:
Quoted 7 lines · On Sunday 14 September 2008 23:55:38 Jarod Wilson wrote:
Quoted 6 lines · On Saturday 13 September 2008 04:41:33 Stefan Bauer wrote:
Quoted 2 lines · Janne Grunau
I hope I haven't broken anything with my
lirc_devchanges. I doubt I'll have a change to test it before monday.Unfortunately, you did. Commit ea74897 (port lirc to dynamic device numbers) broke things.
[...]
Quoted 7 lines
So I've done a bit of work to fix up a few drivers so they properly check to see that
lirc_register_driver()actually succeeded, and then accidentally stumbled onto the fix for the failure when merging some coverity-inspired patches from Erik Hovland. lirc_dev.c'slirc_cdev_add()function had an inverted kmalloc failure check. With that fixed,lirc_i2cappears to be behaving for me now, although I can't actually check to be 100% certain until I get home tonight.
[...]
Quoted 2 lines
Fixes are in the git tree now for anyone else who wants to or is willing to test. Will verify myself tonight w/lirc_i2c and
lirc_mceusb2at a minimum.
Current git tree works for receiving IR signals via lirc_serial (tested by Janne) and via lirc_mceusb2 (tested by me). Something is still slightly haywire with lirc_i2c though. It registers fine, but IR signals simply aren't making it to lircd. Probably unrelated to the dynamic device num changes, looking into it.
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 5 lines · On Tuesday 16 September 2008 00:08:43 Jarod Wilson wrote:
Current git tree works for receiving IR signals via
lirc_serial(tested by Janne) and vialirc_mceusb2(tested by me). Something is still slightly haywire withlirc_i2cthough. It registers fine, but IR signals simply aren't making it to lircd. Probably unrelated to the dynamic device num changes, looking into it.
Despite compiling fine w/o #include'ing linux/i2c-algo-bit.h and coverity apparently thinking its not needed, its really quite necessary for things to function. Restored it, and lirc_i2c now works again.
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 5 lines · Jarod Wilson
Current git tree works for receiving IR signals via
lirc_serial(tested by Janne) and vialirc_mceusb2(tested by me). Something is still slightly haywire withlirc_i2cthough. It registers fine, but IR signals simply aren't making it to lircd. Probably unrelated to the dynamic device num changes, looking into it.
Thank you for keeping me up to date, here are my test results with todays (36e60bd457588b2a2fd37e0c1d0652a9fe214d85) git:
- Compiles fine, except some warnings:
drivers/input/lirc/lirc_dev.h:60:
warning: 'lirc_buffer_available' defined but not useddrivers/input/lirc/lirc_dev.h:72:
warning: 'lirc_buffer_write' defined but not useddrivers/input/lirc/lirc_dev.h:56:
warning: 'lirc_buffer_empty' defined but not useddrivers/input/lirc/lirc_dev.h:60:
warning: 'lirc_buffer_available' defined but not useddrivers/input/lirc/lirc_dev.h:66:
warning: 'lirc_buffer_read' defined but not used
- Module loads fine, with this messages:
lirc_dev: IR Remote Control driver registered, major 252lirc_serial: auto-detected active low receiverlirc_dev: lirc_register_driver: sample_rate: 0
- But lircd crashes immediately every time irexec/irw tries to connect:
BUG: unable to handle kernel NULL pointer dereference at 0000000c IP: [<cabc9006>] :lirc_dev:lirc_buffer_clear+0x6/0x17 *pde = 00000000 Oops: 0002 [#1] Modules linked in: lirc_serial lirc_dev ves1820 arc4 ecb crypto_blkcipher
cryptomgr crypto_algapi rt61pci rt2x00pci rt2x00lib led_class dvb_ttpci saa7146_vv saa7146 videobuf_dma_sg videobuf_core mac80211 videodev v4l1_compat ttpci_eeprom ehci_hcd uhci_hcd cfg80211 eeprom_93cx6
Pid: 2501, comm: lircd Not tainted (2.6.27-rc5 #7)
EIP: 0060:[<cabc9006>] EFLAGS: 00010046 CPU: 0
EIP is at lirc_buffer_clear+0x6/0x17 [lirc_dev]
EAX: 00000000 EBX: c7825cc0 ECX: cabc94f1 EDX: 00000246
ESI: fffffff0 EDI: c726537c EBP: c6bdf000 ESP: c6b73eac
DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
Process lircd (pid: 2501, ti=c6b72000 task=c72ef7a0 task.ti=c6b72000)
Stack: cabc958f 00000000 c7825d3c c014e15c 00000000 c6bdf000 c726537c 00000000
c014e09b c014b052 c78c2900 c759fd80 c6b73f14 c6bdf000 c6b73f14 00000003
c014b156 c6bdf000 00000000 00000000 00000000 c01544ae 00000002 00000026
Call Trace:
[<cabc958f>] irctl_open+0x9e/0x131 [lirc_dev]
[<c014e15c>] chrdev_open+0xc1/0xf6
[<c014e09b>] chrdev_open+0x0/0xf6
[<c014b052>] __dentry_open+0xf2/0x1da
[<c014b156>] nameidata_to_filp+0x1c/0x2c
[<c01544ae>] do_filp_open+0x28b/0x545
[<c015bc37>] alloc_fd+0x46/0xad
[<c014ae8d>] do_sys_open+0x42/0xb6
[<c014af45>] sys_open+0x1e/0x23
[<c010297d>] sysenter_do_call+0x12/0x25
[<c02f0000>] ioctl_standard_iw_point+0x12d/0x200
=======================
Code: <c7> 40 0c 00 00 00 00 c7 40 08 00 00 00 00 52 9d c3 53 89 c3 8b 40
EIP: [<cabc9006>] lirc_buffer_clear+0x6/0x17 [lirc_dev] SS:ESP 0068:c6b73eac
---[ end trace 782e5196b9791a10 ]---If wanted I could start a bisect on this.
Regards,
Stefan
Quoted 8 lines · On Friday 19 September 2008 20:05:11 Stefan Bauer wrote:
Thank you for keeping me up to date, here are my test results with todays (
36e60bd457588b2a2fd37e0c1d0652a9fe214d85) git:- But lircd crashes immediately every time irexec/irw tries to connect:
BUG: unable to handle kernel NULL pointer dereference at 0000000c
not necessary, it is
commit bc2039245c6390bd414a61c9395604c4155a58c6
Author: Janne Grunau <[email protected]> Date: Thu Sep 18 20:49:19 2008 +0200
reimplement lirc_buffer as kfifo wrapper
Janne
Quoted 7 lines · Janne Grunau
Quoted 6 lines · On Friday 19 September 2008 20:05:11 Stefan Bauer wrote:
Thank you for keeping me up to date, here are my test results with todays (
36e60bd457588b2a2fd37e0c1d0652a9fe214d85) git:- But lircd crashes immediately every time irexec/irw tries to connect:
Quoted 8 lines
Quoted 1 line
BUG: unable to handle kernel NULL pointer dereference at 0000000cnot necessary, it is
commitbc2039245c6390bd414a61c9395604c4155a58c6Author: Janne Grunau <[email protected]> Date: Thu Sep 18 20:49:19 2008 +0200reimplement
lirc_bufferas kfifo wrapper
Thank you for pointing me, but bc2039245c6390bd414a61c9395604c4155a58c6~1 (lirc_streamzap can use lirc_buffer_clear) also crashes lircd when irexec is started.
BUG: unable to handle kernel NULL pointer dereference at 00000000 IP: [<c01118ce>] try_to_wake_up+0x16/0x7c *pde = 00000000 Oops: 0000 [#1] Modules linked in: lirc_serial lirc_dev ves1820 arc4 ecb crypto_blkcipher
cryptomgr crypto_algapi rt61pci rt2x00pci rt2x00lib led_class dvb_ttpci saa7146_vv saa7146 mac80211 videobuf_dma_sg ehci_hcd uhci_hcd videobuf_core videodev v4l1_compat ttpci_eeprom cfg80211 eeprom_93cx6
Pid: 2939, comm: lircd Not tainted (2.6.27-rc5 #7)
EIP: 0060:[<c01118ce>] EFLAGS: 00010046 CPU: 0
EIP is at try_to_wake_up+0x16/0x7c
EAX: c04091c0 EBX: 0000000f ECX: 00000000 EDX: c3e85e98
ESI: c04091c0 EDI: 00000000 EBP: 00000000 ESP: c3e85e98
DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
Process lircd (pid: 2939, ti=c3e84000 task=c3e866c0 task.ti=c3e84000)
Stack: 00000246 c6a16000 00000000 c691905c c6bed400 cadc05b3 00000000 c6a1607c
c014e15c 00000000 c6bed400 c691905c 00000000 c014e09b c014b052 c78c2a00
c774c180 c3e85f14 c6bed400 c3e85f14 00000003 c014b156 c6bed400 00000000
Call Trace:
[<cadc05b3>] irctl_open+0xdd/0x13c [lirc_dev]
[<c014e15c>] chrdev_open+0xc1/0xf6
[<c014e09b>] chrdev_open+0x0/0xf6
[<c014b052>] __dentry_open+0xf2/0x1da
[<c014b156>] nameidata_to_filp+0x1c/0x2c
[<c01544ae>] do_filp_open+0x28b/0x545
[<c015bc37>] alloc_fd+0x46/0xad
[<c014ae8d>] do_sys_open+0x42/0xb6
[<c014af45>] sys_open+0x1e/0x23
[<c010297d>] sysenter_do_call+0x12/0x25
[<c02f0000>] ioctl_standard_iw_point+0x12d/0x200
=======================
Code: 00 00 00 00 5b 5e 5f c3 53 9c 5b fa e8 bb ff ff ff 53 9d 5b c3 55 57 89
c7 56 53 89 d3 83 ec 04 89 e2 31 ed e8 3a fd ff ff 89 c6 <8b> 07 85 d8 74 41
83 7f 48 00 75 25 31 c0 66 bd 01 00 e8 ba 40
EIP: [<c01118ce>] try_to_wake_up+0x16/0x7c SS:ESP 0068:c3e85e98
---[ end trace 344ec27be5d90ccf ]---Regards,
Stefan
Quoted 15 lines · On Friday 19 September 2008 20:53:36 Stefan Bauer wrote:
Quoted 14 lines · Janne Grunau
Quoted 7 lines · On Friday 19 September 2008 20:05:11 Stefan Bauer wrote:
Thank you for keeping me up to date, here are my test results with todays (
36e60bd457588b2a2fd37e0c1d0652a9fe214d85) git:- But lircd crashes immediately every time irexec/irw tries to connect:
BUG: unable to handle kernel NULL pointer dereference at 0000000cnot necessary, it is
commitbc2039245c6390bd414a61c9395604c4155a58c6Author: Janne Grunau <[email protected]> Date: Thu Sep 18 20:49:19 2008 +0200
Quoted 5 lines
Quoted 1 line
reimplement
lirc_bufferas kfifo wrapperThank you for pointing me, but bc2039245c6390bd414a61c9395604c4155a58c6~1 (
lirc_streamzapcan uselirc_buffer_clear) also crashes lircd when irexec is started.
ok, then it is not the obvious thing, I'll test in a couple of minutes
Janne
Quoted 7 lines · On Friday 19 September 2008 20:53:36 Stefan Bauer wrote:
Quoted 6 lines · Janne Grunau
not necessary, it is
commitbc2039245c6390bd414a61c9395604c4155a58c6Author: Janne Grunau <[email protected]> Date: Thu Sep 18 20:49:19 2008 +0200
Quoted 5 lines
Quoted 1 line
reimplement
lirc_bufferas kfifo wrapperThank you for pointing me, but bc2039245c6390bd414a61c9395604c4155a58c6~1 (
lirc_streamzapcan uselirc_buffer_clear) also crashes lircd when irexec is started.
yes, a different bug. both fixed ingit://git.jannau.net/linux-2.6-lirc.git
but lirc serial still doesn't work after bc2039245c6390bd414a61c9395604c4155a58c6. I'll look at it tomorrow.
I have also good news: irrecord + lirc_serial is working with bc203924^. Not sure if something changed or if it was PEBCAK.
Janne
Hi,
Quoted 2 lines · Janne Grunau
but lirc serial still doesn't work after
bc2039245c6390bd414a61c9395604c4155a58c6. I'll look at it tomorrow.
just to tell you that I'm still there... :) Todays git (a842c8095aad7b71ffcd1e426185e53661d758c7) is also giving me this at first access to the device by lircd:
------------[ cut here ]------------ WARNING: at drivers/input/lirc/lirc_dev.h:37 lirc_buffer_clear+0x2c/0x30 [lirc_dev]() calling lirc_buffer_clear on an uninitialized lirc_buffer Modules linked in: lirc_serial lirc_dev ves1820 arc4 ecb crypto_blkcipher
cryptomgr crypto_algapi rt61pci rt2x00pci rt2x00lib led_class dvb_ttpci saa7146_vv saa7146 videobuf_dma_sg mac80211 videobuf_core videodev ehci_hcd uhci_hcd ttpci_eeprom cfg80211 eeprom_93cx6 [last unloaded: lirc_dev]
Pid: 5144, comm: lircd Not tainted 2.6.27-rc5 #7
[<c01151ce>] warn_slowpath+0x61/0x84 [<c015971f>] __d_lookup+0x8b/0xbf [<c0151f26>] do_lookup+0x40/0x92 [<c0158f6d>] dput+0x15/0x8d [<c0153533>] __link_path_walk+0x7ad/0x8b4 [<c0153533>] __link_path_walk+0x7ad/0x8b4 [<c01de0c1>] kobject_get+0xf/0x13 [<c014dfbb>] cdev_get+0x1b/0x2d [<c014dfd4>] exact_lock+0x7/0xd [<c0242154>] kobj_lookup+0xda/0x104 [<ca9fa15a>] lirc_buffer_clear+0x2c/0x30 [lirc_dev] [<ca9fa4f4>] lirc_dev_fop_open+0x9e/0x135 [lirc_dev] [<c014e15c>] chrdev_open+0xc1/0xf6 [<c014e09b>] chrdev_open+0x0/0xf6 [<c014b052>] __dentry_open+0xf2/0x1da [<c014b156>] nameidata_to_filp+0x1c/0x2c [<c01544ae>] do_filp_open+0x28b/0x545 [<c015bc37>] alloc_fd+0x46/0xad [<c014ae8d>] do_sys_open+0x42/0xb6 [<c014af45>] sys_open+0x1e/0x23 [<c010297d>] sysenter_do_call+0x12/0x25 [<c02f0000>] ioctl_standard_iw_point+0x12d/0x200 ======================= ---[ end trace 6c8eb5cbb580deaf ]---
Regards,
Stefan
Quoted 7 lines · On Friday 19 September 2008 14:26:20 Janne Grunau wrote:
Quoted 6 lines · On Friday 19 September 2008 20:05:11 Stefan Bauer wrote:
Thank you for keeping me up to date, here are my test results with todays (
36e60bd457588b2a2fd37e0c1d0652a9fe214d85) git:- But lircd crashes immediately every time irexec/irw tries to connect:
Quoted 8 lines
Quoted 1 line
BUG: unable to handle kernel NULL pointer dereference at 0000000cnot necessary, it is
commitbc2039245c6390bd414a61c9395604c4155a58c6Author: Janne Grunau <[email protected]> Date: Thu Sep 18 20:49:19 2008 +0200reimplement
lirc_bufferas kfifo wrapper
Hm... Two things... First, I neglected to pull some of Janne's later changes in the same area until just a bit ago, so perhaps this has already been remedied, because second, lirc_i2c is working as expected w/current head (98242cbdca...)
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 15 lines · Jarod Wilson
Quoted 14 lines · On Friday 19 September 2008 14:26:20 Janne Grunau wrote:
Quoted 7 lines · On Friday 19 September 2008 20:05:11 Stefan Bauer wrote:
Thank you for keeping me up to date, here are my test results with todays (
36e60bd457588b2a2fd37e0c1d0652a9fe214d85) git:- But lircd crashes immediately every time irexec/irw tries to connect:
BUG: unable to handle kernel NULL pointer dereference at 0000000cnot necessary, it is
commitbc2039245c6390bd414a61c9395604c4155a58c6Author: Janne Grunau <[email protected]> Date: Thu Sep 18 20:49:19 2008 +0200
Quoted 6 lines
Quoted 1 line
reimplement
lirc_bufferas kfifo wrapperHm... Two things... First, I neglected to pull some of Janne's later changes in the same area until just a bit ago, so perhaps this has already been remedied, because second,
lirc_i2cis working as expected w/current head (98242cbdca...)
98242cbdca behaves exactly as 36e60bd4575.
-Stefan
Hi Jarod,
Quoted 15 lines · Jarod Wilson
Quoted 8 lines · On Thursday 11 September 2008 15:49:25 Stefan Bauer wrote:
Quoted 7 lines · Jarod Wilson
Quoted 3 lines
Nothing in this function does anything to assure itself that the port actually exists and is the right kind of hardware. Maybe that can't really be done with this kind of device?
We should probably try to make sure the port actually exists, but I don't think there's a whole lot (if anything) we can do as far as verifying the device itself.
I've borrowed the simple existence test from drivers/serial/8250.c::autoconfig(), which tries a few reads and writes from
UART_IER. I think this is probably sufficient for verifying the port is legit.
Quoted 5 lines
Christoph B., you're definitely much more familiar with serial IR devices than I am... Is there any sort of test you can think of that we could use to try to verify the existence of an IR device hooked to the port? Or should we be happy we at least know there's a port and just assume the IR device is there?
No, I can't think of anything else. OTOH there have never been real problems with this for the past 10 years...
Christoph