Many fixes for in-kernel decoding and for the ENE driver
Subsystems (5)
v5 cover Many fixes for in-kernel decoding and for the ENE driver
Hi,
Here is full overview of my patches:
Patch #1 fixes races in ir thread.
It fixes the case when ktherad_stop waits forever for the thread. This happens on module unload and therefore it never finishes. Sorry for introducing this bug.
Patch #2, fixes a crash on my module load.
It happens because ir core initializes the input device a bit early, therefore it could be accessed while still not set up.
Patch #3 fixes a small typo in lirc code that makes it impossible to use tx duty cycle setting.
Patch #4 fixes a problem seen on my system that results in stuck down forever key.
Patch #5 adds few keys to MCE keymap that were found on laptop of an user I tested this driver with
Patch #6, is a combined update ti my driver. It contains lot of refactoring thanks to docs I have now, and lot of fixes, and supports latest version of firmware (and I have 4 users asking for that) It is quite huge, but it would be a tedios job to break it up. This can't introduce regressions because the ene_ir was never released. In addition to that it was tested by me and another two users.
Patch #7 the really only patch that touches drivers I don't have does touch the ir-core.
It is quite small, and it adds a proper solution to dilema about what to do with huge space between keypresses. Now this space is just truncated by the driver with timeout flag.
The lirc codec then ensures that right sample is send to the lircd.
Please review and test it.
Patch #8 is very simple. It just builds on top of patch #7 and adds carrier reports to ene driver.
Best regards,
Maxim Levitsky
PATCH v5 1/8 IR: plug races in IR raw thread.
Unfortunelly (my fault) the kernel thread that now handles IR processing has classical races in regard to wakeup and stop.
This patch hopefully closes them all.
Tested with module reload running in a loop, while receiver is blasted with IR data for 10 minutes.
--- drivers/media/IR/ir-core-priv.h | 2 ++ drivers/media/IR/ir-raw-event.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-)
drivers/media/IR/ir-core-priv.h +2 -0
@@ -17,6 +17,7 @@#define _IR_RAW_EVENT#include <linux/slab.h> +#include <linux/spinlock.h> #include <media/ir-core.h> struct ir_raw_handler {
@@ -33,6 +34,7 @@ struct ir_raw_handler {struct ir_raw_event_ctrl {struct list_head list;/* to keep track of raw clients */ struct task_struct *thread; +spinlock_t lock;struct kfifo kfifo;/* fifo for the pulse/space durations */ ktime_t last_event;/* when last event occurred */ enum raw_event_type last_type;/* last event type */
drivers/media/IR/ir-raw-event.c +25 -9
@@ -39,22 +39,34 @@ static int ir_raw_event_thread(void *data)struct ir_raw_event ev;struct ir_raw_handler *handler;struct ir_raw_event_ctrl *raw = (struct ir_raw_event_ctrl *)data; +int retval;while (!kthread_should_stop ()) { -try_to_freeze (); -mutex_lock (&ir_raw_handler_lock); +spin_lock_irq (&raw->lock); + retval =kfifo_out (&raw->kfifo, &ev,sizeof (ev)); + +if (!retval) { +set_current_state (TASK_INTERRUPTIBLE ); -while (kfifo_out (&raw->kfifo, &ev,sizeof (ev)) ==sizeof (ev)) { -list_for_each_entry (handler, &ir_raw_handler_list, list) - handler->decode (raw->input_dev, ev); - raw->prev_ev = ev; +if (kthread_should_stop ()) +set_current_state (TASK_RUNNING ); + +spin_unlock_irq (&raw->lock); +schedule (); +continue ; } -mutex_unlock (&ir_raw_handler_lock); +spin_unlock_irq (&raw->lock); -set_current_state (TASK_INTERRUPTIBLE ); -schedule (); + +BUG_ON (retval !=sizeof (ev)); + +mutex_lock (&ir_raw_handler_lock); +list_for_each_entry (handler, &ir_raw_handler_list, list) + handler->decode (raw->input_dev, ev); + raw->prev_ev = ev; +mutex_unlock (&ir_raw_handler_lock); }return 0 ;
@@ -232,11 +244,14 @@ EXPORT_SYMBOL_GPL(ir_raw_event_set_idle);void ir_raw_event_handle (struct input_dev *input_dev) {struct ir_input_dev *ir =input_get_drvdata (input_dev); +unsigned long flags;if (!ir->raw)return ; +spin_lock_irqsave (&ir->raw->lock, flags);wake_up_process (ir->raw->thread); +spin_unlock_irqrestore (&ir->raw->lock, flags); }EXPORT_SYMBOL_GPL (ir_raw_event_handle);
@@ -275,6 +290,7 @@ int ir_raw_event_register(struct input_dev *input_dev)return rc; } +spin_lock_init (&ir->raw->lock); ir->raw->thread =kthread_run (ir_raw_event_thread, ir->raw,"rc%u" , (unsigned int )ir->devno);
Signature · 1 line
1.7.0.4
Re: [PATCH 1/8] IR: plug races in IR raw thread.
Quoted 7 lines · Maxim Levitsky
Unfortunelly (my fault) the kernel thread that now handles IR processing has classical races in regard to wakeup and stop.
This patch hopefully closes them all.
Tested with module reload running in a loop, while receiver is blasted with IR data for 10 minutes.Signed-off-by Maxim Levitsky <[email protected]>
Took a while to unwind everything in ir_raw_event_thread() in my head, but now that I think I have it sorted out, yeah, that looks like the processing logic all remains the same, with the addition of locking that should prevent the race (also heavily supported by your testing).
Signature · 2 lines
Jarod Wilson [email protected]
Re: [1/8] IR: plug races in IR raw thread.
In reply to Maxim LevitskyQuoted 7 lines · Maxim Levitsky
Unfortunelly (my fault) the kernel thread that now handles IR processing has classical races in regard to wakeup and stop.
This patch hopefully closes them all.
Tested with module reload running in a loop, while receiver is blasted with IR data for 10 minutes.Signed-off-by Maxim Levitsky <[email protected]>
Carrying over ack from earlier(?) version of the patch:
Took a while to unwind everything in ir_raw_event_thread() in my head, but now that I think I have it sorted out, yeah, that looks like the processing logic all remains the same, with the addition of locking that should prevent the race (also heavily supported by your testing).
Signature · 2 lines
Jarod Wilson [email protected]
PATCH v5 2/8 IR: make sure we register the input device when it is safe to do so.
In reply to Maxim LevitskyAs soon as input device is registered, it might be accessed (and it is) This can trigger a hardware interrupt that can access
not yet initialized ir->raw, (by sending a sample)
This can be reproduced by holding down a remote button and reloading the module. And this always crashes the systems where hardware decides to send an interrupt right at the moment it is enabled.
--- drivers/media/IR/ir-core-priv.h | 1 + drivers/media/IR/ir-keytable.c | 2 ++ drivers/media/IR/ir-sysfs.c | 27 +++++++++++++++++---------- 3 files changed, 20 insertions(+), 10 deletions(-)
drivers/media/IR/ir-core-priv.h +1 -0
@@ -116,6 +116,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration)* Routines from ir-sysfs.c - Meant to be called only internally inside * ir-core */ +int ir_register_input (struct input_dev *input_dev);int ir_register_class (struct input_dev *input_dev);void ir_unregister_class (struct input_dev *input_dev);
drivers/media/IR/ir-keytable.c +2 -0
@@ -505,6 +505,8 @@ int __ir_input_register(struct input_dev *input_dev, goto out_event; } + rc =ir_register_input (input_dev); + IR_dprintk(1, "Registered input device on %s for %s remote%s.\n", driver_name, rc_tab->name, (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ?
drivers/media/IR/ir-sysfs.c +17 -10
@@ -251,8 +251,6 @@ static struct device_type rc_dev_type = {*/ int ir_register_class (struct input_dev *input_dev) { -int rc; -const char *path;struct ir_input_dev *ir_dev =input_get_drvdata (input_dev);int devno =find_first_zero_bit (&ir_core_dev_number,IRRCV_NUM_DEVICES );
@@ -261,17 +259,28 @@ int ir_register_class(struct input_dev *input_dev)return devno; ir_dev->dev.type = &rc_dev_type; + ir_dev->devno = devno; ir_dev->dev.class = &ir_input_class; ir_dev->dev.parent = input_dev->dev.parent; + input_dev->dev.parent = &ir_dev->dev;dev_set_name (&ir_dev->dev,"rc%d" , devno);dev_set_drvdata (&ir_dev->dev, ir_dev); - rc =device_register (&ir_dev->dev); -if (rc) -return rc; +return device_register (&ir_dev->dev); +}; + +/** +* ir_register_input - registers ir input device with input subsystem +* @input_dev: the struct input_dev descriptor of the device +*/ + +int ir_register_input (struct input_dev *input_dev) +{ +struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); +int rc; +const char *path; - input_dev->dev.parent = &ir_dev->dev; rc =input_register_device (input_dev);if (rc <0 ) {device_del (&ir_dev->dev);
@@ -287,11 +296,9 @@ int ir_register_class(struct input_dev *input_dev) path ? path : "N/A");kfree (path); - ir_dev->devno = devno; -set_bit (devno, &ir_core_dev_number); - +set_bit (ir_dev->devno, &ir_core_dev_number);return 0 ; -}; +}/** * ir_unregister_class() - removes the sysfs for sysfs for
Signature · 1 line
1.7.0.4
Re: [PATCH 2/8] IR: make sure we register the input device when it is safe to do so.
Quoted 9 lines · Maxim Levitsky
As soon as input device is registered, it might be accessed (and it is) This can trigger a hardware interrupt that can access
not yet initializedir->raw, (by sending a sample)This can be reproduced by holding down a remote button and reloading the module. And this always crashes the systems where hardware decides to send an interrupt right at the moment it is enabled.
Signed-off-by Maxim Levitsky <[email protected]>
Finally got my head wrapped around this one too, and I do see the problem, and this fix looks good to me.
Signature · 2 lines
Jarod Wilson [email protected]
Re: [2/8] IR: make sure we register the input device when it is safe to do so.
In reply to Maxim LevitskyQuoted 9 lines · Maxim Levitsky
As soon as input device is registered, it might be accessed (and it is) This can trigger a hardware interrupt that can access
not yet initializedir->raw, (by sending a sample)This can be reproduced by holding down a remote button and reloading the module. And this always crashes the systems where hardware decides to send an interrupt right at the moment it is enabled.
Signed-off-by Maxim Levitsky <[email protected]>
Another one I thought I'd acked, but I don't see the ack in patchwork, so it may have been from an earlier/superseded version...
Finally got my head wrapped around this one too, and I do see the problem, and this fix looks good to me.
Signature · 2 lines
Jarod Wilson [email protected]
PATCH v5 3/8 IR: fix duty cycle capability
In reply to Maxim LevitskyDue to typo lirc bridge enabled wrong capability.
--- drivers/media/IR/ir-lirc-codec.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/IR/ir-lirc-codec.c +1 -1
@@ -267,7 +267,7 @@ static int ir_lirc_register(struct input_dev *input_dev) features |=LIRC_CAN_SET_SEND_CARRIER ;if (ir_dev->props->s_tx_duty_cycle) - features |=LIRC_CAN_SET_REC_DUTY_CYCLE ; + features |=LIRC_CAN_SET_SEND_DUTY_CYCLE ; }if (ir_dev->props->s_rx_carrier_range)
Signature · 1 line
1.7.0.4
Re: [PATCH 3/8] IR: fix duty cycle capability
Quoted 6 lines · Maxim Levitsky
Due to typo lirc bridge enabled wrong capability.
Signed-off-by Maxim Levitsky <[email protected]>---
drivers/media/IR/ir-lirc-codec.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)
Signature · 2 lines
Jarod Wilson [email protected]
PATCH v5 4/8 IR: fix keys beeing stuck down forever.
In reply to Maxim LevitskyThe logic in ir_timer_keyup was inverted.
In case that values aren't equal,
the meaning of the time_is_after_eq_jiffies(ir->keyup_jiffies) is that ir->keyup_jiffies is after the the jiffies or equally that that jiffies are before the the ir->keyup_jiffies which is exactly the situation we want to avoid (that the timeout is in the future) Confusing Eh?
--- drivers/media/IR/ir-keytable.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/IR/ir-keytable.c +1 -1
@@ -319,7 +319,7 @@ static void ir_timer_keyup(unsigned long cookie)* a keyup event might follow immediately after the keydown. */ spin_lock_irqsave (&ir->keylock, flags); -if (time_is_after_eq_jiffies (ir->keyup_jiffies)) +if (time_is_before_eq_jiffies (ir->keyup_jiffies))ir_keyup (ir);spin_unlock_irqrestore (&ir->keylock, flags); }
Signature · 1 line
1.7.0.4
Re: [PATCH 4/8] IR: fix keys beeing stuck down forever.
Quoted 8 lines · Maxim Levitsky
The logic in
ir_timer_keyupwas inverted.In case that values aren't equal,
the meaning of thetime_is_after_eq_jiffies(ir->keyup_jiffies)is thatir->keyup_jiffiesis after the the jiffies or equally that that jiffies are before the their->keyup_jiffieswhich is exactly the situation we want to avoid (that the timeout is in the future) Confusing Eh?
Yeah, seen time_is_{before,after}_jiffies use accidentally inverted a couple of times... Kinda hints that we could use better names and/or descriptions of the functions, but maybe people just need to read more carefully (dunno, haven't looked to see what's there for usage descriptions already)... Anyway.
Quoted 4 lines
Signed-off-by Maxim Levitsky <[email protected]>---
drivers/media/IR/ir-keytable.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)
Signature · 2 lines
Jarod Wilson [email protected]
PATCH v5 5/8 IR: extend MCE keymap.
In reply to Maxim LevitskyThese keys are found on remote bundled with
Toshiba Qosmio F50-10q.
Found and tested by, Sami R <[email protected]>
--- drivers/media/IR/keymaps/rc-rc6-mce.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/media/IR/keymaps/rc-rc6-mce.c +3 -0
@@ -19,6 +19,7 @@ static struct ir_scancode rc6_mce[] = { { 0x800f0416, KEY_PLAY }, { 0x800f0418, KEY_PAUSE }, + { 0x800f046e, KEY_PLAYPAUSE }, { 0x800f0419, KEY_STOP }, { 0x800f0417, KEY_RECORD },
@@ -37,6 +38,8 @@ static struct ir_scancode rc6_mce[] = { { 0x800f0411, KEY_VOLUMEDOWN }, { 0x800f0412, KEY_CHANNELUP }, { 0x800f0413, KEY_CHANNELDOWN }, + { 0x800f043a, KEY_BRIGHTNESSUP }, + { 0x800f0480, KEY_BRIGHTNESSDOWN }, { 0x800f0401, KEY_NUMERIC_1 }, { 0x800f0402, KEY_NUMERIC_2 },
Signature · 1 line
1.7.0.4
Re: [PATCH 5/8] IR: extend MCE keymap.
Quoted 9 lines · Maxim Levitsky
These keys are found on remote bundled with
Toshiba Qosmio F50-10q.Found and tested by, Sami R <[email protected]>
Signed-off-by Maxim Levitsky <[email protected]>---
drivers/media/IR/keymaps/rc-rc6-mce.c | 3 +++1 files changed, 3 insertions(+), 0 deletions(-)
Signature · 6 lines
Jarod Wilson [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/8] IR: extend MCE keymap.
Quoted 10 lines · Jarod Wilson
Quoted 9 lines · Maxim Levitsky
These keys are found on remote bundled with
Toshiba Qosmio F50-10q.Found and tested by, Sami R <[email protected]>
Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/keymaps/rc-rc6-mce.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Tommorow I will resend that patch with even more scancodes.
Best regards,
Maxim Levitsky
Re: [PATCH 5/8] IR: extend MCE keymap.
Quoted 5 lines · Maxim Levitsky
Quoted 4 lines · Jarod Wilson
Quoted 3 lines · Maxim Levitsky
These keys are found on remote bundled with
Toshiba Qosmio F50-10q.
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Found and tested by, Sami R <[email protected]>
Signed-off-by Maxim Levitsky <[email protected]>---
drivers/media/IR/keymaps/rc-rc6-mce.c | 3 +++1 files changed, 3 insertions(+), 0 deletions(-)Tommorow I will resend that patch with even more scancodes.
Saw the discussion on irc. Feel your pain big-time on the X server limitation on keycodes. Its put a big damper on efforts to add native support to mythtv. Peter Hutterer's libXi2 cookbook tutorials talk a good game about how libXi2 supports 32-bit keycodes, but neglects to mention that the X server still gobbles up anything above 248 or 255 or whatever it is, and remedying that is no small task. :(
I think for mythtv, we're going to end up having a daemon process with elevated privs that reads directly from input devices to get around this annoyance, until such time as the annoyance is gone.
Signature · 6 lines
Jarod Wilson [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/8] IR: extend MCE keymap.
Quoted 3 lines · Jarod Wilson
I think for mythtv, we're going to end up having a daemon process with elevated privs that reads directly from input devices to get around this annoyance, until such time as the annoyance is gone.
A similar approach could work for XBMC since it already has input plugins (e.g. for using a Nintendo Wii controller, etc).
Signature · 1 line
David Härdeman
Re: [PATCH 5/8] IR: extend MCE keymap.
Quoted 7 lines · David Härdeman
Quoted 3 lines · Jarod Wilson
I think for mythtv, we're going to end up having a daemon process with elevated privs that reads directly from input devices to get around this annoyance, until such time as the annoyance is gone.
A similar approach could work for XBMC since it already has input plugins (e.g. for using a Nintendo Wii controller, etc).
While attempting to drift off to sleep last night, it occurred to me that lircd already has support for attaching to input devices, so it might be an option to extend lircd and the lirc client library to have a "pass raw keycodes" mode. Both xmbc and mythtv already have options to build in lirc client support, so it'd just be minor extension of its use in both cases, at least in theory...
Signature · 7 lines
Jarod Wilson [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/8] IR: extend MCE keymap.
In reply to Jarod WilsonQuoted 22 lines · Jarod Wilson
Quoted 5 lines · Maxim Levitsky
Quoted 4 lines · Jarod Wilson
Quoted 3 lines · Maxim Levitsky
These keys are found on remote bundled with
Toshiba Qosmio F50-10q.Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Found and tested by, Sami R <[email protected]>
Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/keymaps/rc-rc6-mce.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)Tommorow I will resend that patch with even more scancodes.
Saw the discussion on irc. Feel your pain big-time on the X server limitation on keycodes. Its put a big damper on efforts to add native support to mythtv. Peter Hutterer's libXi2 cookbook tutorials talk a good game about how libXi2 supports 32-bit keycodes, but neglects to mention that the X server still gobbles up anything above 248 or 255 or whatever it is, and remedying that is no small task. :(
Quoted 3 lines
I think for mythtv, we're going to end up having a daemon process with elevated privs that reads directly from input devices to get around this annoyance, until such time as the annoyance is gone.
Btw, indeed Xi2 still doesn't pass > 248 keycodes, just tested that with -git versions of X stack from about 2 months ago.
However this can be fixed relatively easily.
Maybe even I could do that.
The big problem is however about ability to map extended keycodes to actions, thing that should be provided by XKB2, which we will see probably when DNF is released on Phantom console...
Also this will need lots of changes in toolkits.
Thats the problem I don't have resources to fix.
Best regards,
Maxim Levitsky
Re: [PATCH 5/8] IR: extend MCE keymap.
Quoted 32 lines · Maxim Levitsky
Quoted 22 lines · Jarod Wilson
Quoted 5 lines · Maxim Levitsky
Quoted 4 lines · Jarod Wilson
Quoted 3 lines · Maxim Levitsky
These keys are found on remote bundled with
Toshiba Qosmio F50-10q.Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Found and tested by, Sami R <[email protected]>
Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/keymaps/rc-rc6-mce.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)Tommorow I will resend that patch with even more scancodes.
Saw the discussion on irc. Feel your pain big-time on the X server limitation on keycodes. Its put a big damper on efforts to add native support to mythtv. Peter Hutterer's libXi2 cookbook tutorials talk a good game about how libXi2 supports 32-bit keycodes, but neglects to mention that the X server still gobbles up anything above 248 or 255 or whatever it is, and remedying that is no small task. :(
Quoted 3 lines
I think for mythtv, we're going to end up having a daemon process with elevated privs that reads directly from input devices to get around this annoyance, until such time as the annoyance is gone.
Btw, indeed Xi2 still doesn't pass > 248 keycodes, just tested that with -git versions of X stack from about 2 months ago.
However this can be fixed relatively easily.
Maybe even I could do that.
Quoted 5 lines
The big problem is however about ability to map extended keycodes to actions, thing that should be provided by XKB2, which we will see probably when DNF is released on Phantom console...
Also this will need lots of changes in toolkits.
Thats the problem I don't have resources to fix.
Yeah, that's exactly what I got from Peter when I was asking him about this issue on irc -- X server can be modified fairly easily, but there's the arduous and undesirable task of making all the toolkits and whatnot behave again, and nobody in their right mind really *wants* to dig into xkb. :)
Signature · 2 lines
Jarod Wilson [email protected]
PATCH v5 6/8 IR: ene_ir: updates
In reply to Maxim Levitsky* Add support for newer firmware version that uses different buffer format. Makes hardware work for many users.
* Register name updates
* Lot of refactoring
* Lots of fixes as a result of full testing
* Idle mode is done now by resetting the device, and this eliminates the ugly sample_period = 75 hack.
Every feature of the driver is now well tested.
--- drivers/media/IR/Kconfig | 6 +- drivers/media/IR/ene_ir.c | 978 ++++++++++++++++++++++++++------------------- drivers/media/IR/ene_ir.h | 273 +++++++------ 3 files changed, 719 insertions(+), 538 deletions(-)
drivers/media/IR/Kconfig +3 -3
@@ -114,15 +114,15 @@ config IR_MCEUSB module will be called mceusb. config IR_ENE - tristate "ENE eHome Receiver/Transciever (pnp id: ENE0100/ENE02xxx)" + tristate "ENE eHome Receiver/Transceiver (pnp id: ENE0100/ENE02xxx)" depends on PNP depends on IR_CORE ---help--- Say Y here to enable support for integrated infrared receiver - /transciever made by ENE. + /transceiver made by ENE. You can see if you have it by looking at lspnp output. - Output should include ENE0100 ENE0200 or something similiar. + Output should include ENE0100 ENE0200 or something similar. To compile this driver as a module, choose M here: the module will be called ene_ir.
drivers/media/IR/ene_ir.c +566 -412
1,441 lines not on this page · raw message
drivers/media/IR/ene_ir.h +150 -123
345 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v5 7/8 IR: extend ir_raw_event and do refactoring
In reply to Maxim LevitskyAdd new event types for timeout & carrier report Move timeout handling from ir_raw_event_store_with_filter to ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reports
Note: all new ir_raw_event variables now should be initialized like that: DEFINE_IR_RAW_EVENT(ev);
To clean an existing event, use init_ir_raw_event(&ev);
--- drivers/media/IR/ene_ir.c | 4 +- drivers/media/IR/ir-core-priv.h | 13 ++++++- drivers/media/IR/ir-jvc-decoder.c | 5 +- drivers/media/IR/ir-lirc-codec.c | 78 +++++++++++++++++++++++++++++++----- drivers/media/IR/ir-nec-decoder.c | 5 +- drivers/media/IR/ir-raw-event.c | 45 +++++++------------- drivers/media/IR/ir-rc5-decoder.c | 5 +- drivers/media/IR/ir-rc6-decoder.c | 5 +- drivers/media/IR/ir-sony-decoder.c | 5 +- drivers/media/IR/mceusb.c | 3 +- drivers/media/IR/streamzap.c | 8 ++- include/media/ir-core.h | 40 ++++++++++++++++--- 12 files changed, 153 insertions(+), 63 deletions(-)
drivers/media/IR/ene_ir.c +2 -2
@@ -701,7 +701,7 @@ static irqreturn_t ene_isr(int irq, void *data)unsigned long flags;irqreturn_t retval =IRQ_NONE ;struct ene_device *dev = (struct ene_device *)data; -struct ir_raw_event ev; +DEFINE_IR_RAW_EVENT (ev);spin_lock_irqsave (&dev->hw_lock, flags);
@@ -904,7 +904,7 @@ static int ene_set_learning_mode(void *data, int enable) }/* outside interface: enable or disable idle mode */ -static void ene_rx_set_idle (void *data,int idle) +static void ene_rx_set_idle (void *data,bool idle) {struct ene_device *dev = (struct ene_device *)data;
drivers/media/IR/ir-core-priv.h +12 -1
@@ -82,6 +82,12 @@ struct ir_raw_event_ctrl {struct ir_input_dev *ir_dev;struct lirc_driver *drv;int carrier_low; + +ktime_t gap_start; +u64 gap_duration; +bool gap; +bool send_timeout_reports; + } lirc; };
@@ -109,9 +115,14 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration) ev->duration -= duration; } +/* Returns true if event is normal pulse/space event */ +static inline bool is_timing_event (struct ir_raw_event ev) +{ +return !ev.carrier_report && !ev.reset; +} +#define TO_US (duration) DIV_ROUND_CLOSEST((duration), 1000)#define TO_STR (is_pulse) ((is_pulse) ? "pulse" : "space") -#define IS_RESET (ev) (ev.duration == 0)/* * Routines from ir-sysfs.c - Meant to be called only internally inside * ir-core
drivers/media/IR/ir-jvc-decoder.c +3 -2
@@ -50,8 +50,9 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_JVC ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-lirc-codec.c +67 -11
118 lines not on this page · raw message
drivers/media/IR/ir-nec-decoder.c +3 -2
@@ -54,8 +54,9 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_NEC ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-raw-event.c +16 -29
71 lines not on this page · raw message
drivers/media/IR/ir-rc5-decoder.c +3 -2
@@ -55,8 +55,9 @@ static int ir_rc5_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC5 ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-rc6-decoder.c +3 -2
@@ -85,8 +85,9 @@ static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC6 ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/ir-sony-decoder.c +3 -2
@@ -48,8 +48,9 @@ static int ir_sony_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_SONY ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }
drivers/media/IR/mceusb.c +2 -1
@@ -656,7 +656,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)static void mceusb_process_ir_data (struct mceusb_dev *ir,int buf_len) { -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);int i, start_index =0 ;u8 hdr =MCE_CONTROL_HEADER ;
@@ -993,6 +993,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, ir->len_in = maxp; ir->flags.microsoft_gen1 = is_microsoft_gen1; ir->flags.tx_mask_inverted = tx_mask_inverted; +init_ir_raw_event (&ir->rawir);/* Saving usb interface data for use by the transmitter routine */ ir->usb_ep_in = ep_in;
drivers/media/IR/streamzap.c +5 -3
@@ -170,7 +170,7 @@ static void streamzap_flush_timeout(unsigned long arg)static void streamzap_delay_timeout (unsigned long arg) {struct streamzap_ir *sz = (struct streamzap_ir *)arg; -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);unsigned long flags;int len, ret;static unsigned long delay;
@@ -215,7 +215,7 @@ static void streamzap_delay_timeout(unsigned long arg)static void streamzap_flush_delay_buffer (struct streamzap_ir *sz) { -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);bool wake = false;int ret;
@@ -233,7 +233,7 @@ static void streamzap_flush_delay_buffer(struct streamzap_ir *sz)static void sz_push (struct streamzap_ir *sz) { -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);unsigned long flags;int ret;
@@ -512,6 +512,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf,if (!sz)return -ENOMEM ; +init_ir_raw_event (&sz->rawir); + sz->usbdev = usbdev; sz->interface = intf;
include/media/ir-core.h +34 -6
@@ -60,6 +60,7 @@ enum rc_driver_type {* @s_idle: optional: enable/disable hardware idle mode, upon which, device doesn't interrupt host until it sees IR pulses * @s_learning_mode: enable wide band receiver used for learning +* @s_carrier_report: enable carrier reports */ struct ir_dev_props {enum rc_driver_type driver_type;
@@ -82,8 +83,9 @@ struct ir_dev_props {int (*s_tx_duty_cycle)(void *priv,u32 duty_cycle);int (*s_rx_carrier_range)(void *priv,u32 min,u32 max);int (*tx_ir)(void *priv,int *txbuf,u32 n); -void (*s_idle)(void *priv,int enable); +void (*s_idle)(void *priv,bool enable);int (*s_learning_mode)(void *priv,int enable); +int (*s_carrier_report) (void *priv,int enable); };struct ir_input_dev {
@@ -162,22 +164,48 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);/* From ir-raw-event.c */ struct ir_raw_event { -unsigned pulse:1 ; -unsigned duration:31 ; +union { +u32 duration; + +struct { +u32 carrier; +u8 duty_cycle; + }; + }; + +unsigned pulse:1 ; +unsigned reset:1 ; +unsigned timeout:1 ; +unsigned carrier_report:1 ; }; -#define IR_MAX_DURATION 0x7FFFFFFF/* a bit more than 2 seconds */ +#define DEFINE_IR_RAW_EVENT (event) \ + struct ir_raw_event event = { \ + { .duration = 0 } , \ + .pulse = 0, \ + .reset = 0, \ + .timeout = 0, \ + .carrier_report = 0 } + +static inline void init_ir_raw_event (struct ir_raw_event *ev) +{ +memset (ev,0 ,sizeof (*ev)); +} + +#define IR_MAX_DURATION 0xFFFFFFFF/* a bit more than 4 seconds */ void ir_raw_event_handle (struct input_dev *input_dev);int ir_raw_event_store (struct input_dev *input_dev,struct ir_raw_event *ev);int ir_raw_event_store_edge (struct input_dev *input_dev,enum raw_event_type type);int ir_raw_event_store_with_filter (struct input_dev *input_dev,struct ir_raw_event *ev); -void ir_raw_event_set_idle (struct input_dev *input_dev,int idle); +void ir_raw_event_set_idle (struct input_dev *input_dev,bool idle);static inline void ir_raw_event_reset (struct input_dev *input_dev) { -struct ir_raw_event ev = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (ev); + ev.reset = true; +ir_raw_event_store (input_dev, &ev);ir_raw_event_handle (input_dev); }
Signature · 1 line
1.7.0.4
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Quoted 26 lines · Maxim Levitsky
Add new event types for timeout & carrier report Move timeout handling from
ir_raw_event_store_with_filterto ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reportsNote: all new
ir_raw_eventvariables now should be initialized like that:DEFINE_IR_RAW_EVENT(ev);To clean an existing event, use
init_ir_raw_event(&ev);Signed-off-by Maxim Levitsky <[email protected]>---
drivers/media/IR/ene_ir.c | 4 +-drivers/media/IR/ir-core-priv.h| 13 ++++++-drivers/media/IR/ir-jvc-decoder.c | 5 +- drivers/media/IR/ir-lirc-codec.c | 78 +++++++++++++++++++++++++++++++----- drivers/media/IR/ir-nec-decoder.c | 5 +-drivers/media/IR/ir-raw-event.c | 45 +++++++-------------
drivers/media/IR/ir-rc5-decoder.c| 5 +-drivers/media/IR/ir-rc6-decoder.c| 5 +-drivers/media/IR/ir-sony-decoder.c| 5 +-drivers/media/IR/mceusb.c| 3 +-drivers/media/IR/streamzap.c| 8 ++-include/media/ir-core.h| 40 ++++++++++++++++---12 files changed, 153 insertions(+), 63 deletions(-)
...
Quoted 10 lines
include/media/ir-core.h +4
-2@@ -162,22 +164,48 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); /* From ir-raw-event.c */ struct ir_raw_event { - unsigned pulse:1; - unsigned duration:31; + union { + u32 duration; + + struct {
include/media/ir-core.h u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); · line 180
Quoted 10 lines
include/media/ir-core.h +9
-0+ u32 carrier; + u8 duty_cycle; + }; + }; + + unsigned pulse:1; + unsigned reset:1; + unsigned timeout:1; + unsigned carrier_report:1; };
I'm generally good with this entire patch, but the union usage looks a bit odd, as the members aren't of the same size, which is generally what I've come to expect looking at other code. I'd be inclined to simply move duty_cycle out of the union and leave just duration and carrier in it. However, as discussed on irc and upon looking at the code, we don't actually do anything useful with duty_cycle yet, so perhaps just cut it out entirely for the moment, and add it later when its of use.
Signature · 6 lines
Jarod Wilson [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Quoted 44 lines · Jarod Wilson
Quoted 26 lines · Maxim Levitsky
Add new event types for timeout & carrier report Move timeout handling from
ir_raw_event_store_with_filterto ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reportsNote: all new
ir_raw_eventvariables now should be initialized like that:DEFINE_IR_RAW_EVENT(ev);To clean an existing event, use
init_ir_raw_event(&ev);Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/ene_ir.c | 4 +- drivers/media/IR/ir-core-priv.h | 13 ++++++- drivers/media/IR/ir-jvc-decoder.c | 5 +- drivers/media/IR/ir-lirc-codec.c | 78 +++++++++++++++++++++++++++++++----- drivers/media/IR/ir-nec-decoder.c | 5 +- drivers/media/IR/ir-raw-event.c | 45 +++++++------------- drivers/media/IR/ir-rc5-decoder.c | 5 +- drivers/media/IR/ir-rc6-decoder.c | 5 +- drivers/media/IR/ir-sony-decoder.c | 5 +- drivers/media/IR/mceusb.c | 3 +- drivers/media/IR/streamzap.c | 8 ++- include/media/ir-core.h | 40 ++++++++++++++++--- 12 files changed, 153 insertions(+), 63 deletions(-)...
Quoted 16 lines
include/media/ir-core.h +10
-2@@ -162,22 +164,48 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);/* From ir-raw-event.c */ struct ir_raw_event { -unsigned pulse:1 ; -unsigned duration:31 ; +union { +u32 duration; + +struct { +u32 carrier; +u8 duty_cycle; + }; + }; + +unsigned pulse:1 ;
Quoted 8 lines
include/media/ir-core.h u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); · line 180
Quoted 4 lines
include/media/ir-core.h +3
-0+ unsigned reset:1; + unsigned timeout:1; + unsigned carrier_report:1; };I'm generally good with this entire patch, but the union usage looks a bit odd, as the members aren't of the same size, which is generally what I've come to expect looking at other code.
Having a union with different sized members is perfectly valid C code.
Just look at the definition of the XEvent in Xlib.h. The "int type;" is smaller than everything, and the XAnyEvent is smaller than the other event types.
The size of the union will be the size of its largest member.
Quoted 3 lines
I'd be inclined to
simply moveduty_cycleout of the union and leave just duration and carrier in it.
That's not necessary and it could be confusing depending on where you put duty_cycle.
Regards,
Andy
Quoted 5 lines
However, as discussed on irc and upon looking at the
code, we don't actually do anything useful withduty_cycleyet, so perhaps just cut it out entirely for the moment, and add it later when its of use.
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Quoted 54 lines · Andy Walls
Quoted 44 lines · Jarod Wilson
Quoted 26 lines · Maxim Levitsky
Add new event types for timeout & carrier report Move timeout handling from
ir_raw_event_store_with_filterto ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reportsNote: all new
ir_raw_eventvariables now should be initialized like that:DEFINE_IR_RAW_EVENT(ev);To clean an existing event, use
init_ir_raw_event(&ev);Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/ene_ir.c | 4 +- drivers/media/IR/ir-core-priv.h | 13 ++++++- drivers/media/IR/ir-jvc-decoder.c | 5 +- drivers/media/IR/ir-lirc-codec.c | 78 +++++++++++++++++++++++++++++++----- drivers/media/IR/ir-nec-decoder.c | 5 +- drivers/media/IR/ir-raw-event.c | 45 +++++++------------- drivers/media/IR/ir-rc5-decoder.c | 5 +- drivers/media/IR/ir-rc6-decoder.c | 5 +- drivers/media/IR/ir-sony-decoder.c | 5 +- drivers/media/IR/mceusb.c | 3 +- drivers/media/IR/streamzap.c | 8 ++- include/media/ir-core.h | 40 ++++++++++++++++--- 12 files changed, 153 insertions(+), 63 deletions(-)...
Quoted 16 lines
include/media/ir-core.h +10
-2@@ -162,22 +164,48 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);/* From ir-raw-event.c */ struct ir_raw_event { -unsigned pulse:1 ; -unsigned duration:31 ; +union { +u32 duration; + +struct { +u32 carrier; +u8 duty_cycle; + }; + }; + +unsigned pulse:1 ;Quoted 8 lines
include/media/ir-core.h u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); · line 180
Quoted 4 lines
include/media/ir-core.h +3
-0+ unsigned reset:1; + unsigned timeout:1; + unsigned carrier_report:1; };I'm generally good with this entire patch, but the union usage looks a bit odd, as the members aren't of the same size, which is generally what I've come to expect looking at other code.
Quoted 7 lines
Having a union with different sized members is perfectly valid C code.
Just look at the definition of the XEvent in
Xlib.h. The "int type;" is smaller than everything, and the XAnyEvent is smaller than the other event types.The size of the union will be the size of its largest member.
Yeah, no, I know that it'll work, just that most of the unions I've actually paid any attention to had members all of the same size. Seemed like sort of an unwritten rule for in-kernel use. But its probably just fine.
Quoted 6 lines
Quoted 3 lines
I'd be inclined to
simply moveduty_cycleout of the union and leave just duration and carrier in it.That's not necessary and it could be confusing depending on where you put
duty_cycle.
There's that. But without having code that actually uses duty_cycle in a meaningful way yet, its hard to say for sure. If carrier and duty_cycle were only being sent out in their own events, you might actually want a union of duration, carrier and duty_cycle. Though I suspect we'll probably want to pass along carrier and duty_cycle at the same time.
Signature · 2 lines
Jarod Wilson [email protected]
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Quoted 9 lines · Jarod Wilson
Quoted 8 lines · Andy Walls
Quoted 6 lines · Jarod Wilson
On Mon, Sep 6, 2010 at 5:26 PM, Maxim Levitsky <[email protected]> wrote:
I'm generally good with this entire patch, but the union usage looks a bit odd, as the members aren't of the same size, which is generally what I've come to expect looking at other code.
Quoted 7 lines
Quoted 2 lines
Having a union with different sized members is perfectly valid C code.
Yeah, no, I know that it'll work, just that most of the unions I've actually paid any attention to had members all of the same size. Seemed like sort of an unwritten rule for in-kernel use. But its probably just fine.
Well if it's an unwritten rule, not everyone is following it. :) There are numerous counter-examples in include/linux/*.h . Here are a few easy to see ones:
include/linux/input.h:
union in struct ff_effect: ff_rumble vs. ff_periodic
include/linux/i2c.h
union i2c_smbus_data: byte vs. word vs. block[]
include/linux/kfifo.h
DECLARE_KFIFO
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
I'd be inclined to
simply moveduty_cycleout of the union and leave just duration and carrier in it.
Quoted 8 lines
Quoted 2 lines
That's not necessary and it could be confusing depending on where you put
duty_cycle.There's that. But without having code that actually uses
duty_cyclein a meaningful way yet, its hard to say for sure. If carrier andduty_cyclewere only being sent out in their own events, you might actually want a union of duration, carrier andduty_cycle. Though I suspect we'll probably want to pass along carrier andduty_cycleat the same time.
I suspect you're right on that. I don't have any experience with hardware that can actually estimate carrier freq or duty cycle. I suspect they can be measured together using edge detection on both rising and falling edges.
Regards,
Andy
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Quoted 13 lines · Andy Walls
Quoted 11 lines · Jarod Wilson
Quoted 10 lines · Andy Walls
Quoted 6 lines · Jarod Wilson
On Mon, Sep 6, 2010 at 5:26 PM, Maxim Levitsky <[email protected]> wrote:
I'm generally good with this entire patch, but the union usage looks a bit odd, as the members aren't of the same size, which is generally what I've come to expect looking at other code.
Having a union with different sized members is perfectly valid C code.
Quoted 8 lines
Quoted 4 lines
Yeah, no, I know that it'll work, just that most of the unions I've actually paid any attention to had members all of the same size. Seemed like sort of an unwritten rule for in-kernel use. But its probably just fine.
Well if it's an unwritten rule, not everyone is following it. :) There are numerous counter-examples in
include/linux/*.h. Here are a few easy to see ones:
Not to mention that the use of a union sends an important message to the programmer reading the code - i.e. that only one of the union members can be used in the same event.
Signature · 5 lines
David Härdeman -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
In reply to Andy WallsEm 08-09-2010 20:02, Andy Walls escreveu:
Quoted 15 lines · Jarod Wilson
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
I'd be inclined to
simply moveduty_cycleout of the union and leave just duration and carrier in it.Quoted 8 lines
Quoted 2 lines
That's not necessary and it could be confusing depending on where you put
duty_cycle.There's that. But without having code that actually uses
duty_cyclein a meaningful way yet, its hard to say for sure. If carrier andduty_cyclewere only being sent out in their own events, you might actually want a union of duration, carrier andduty_cycle. Though I suspect we'll probably want to pass along carrier andduty_cycleat the same time.
Quoted 4 lines
I suspect you're right on that. I don't have any experience with hardware that can actually estimate carrier freq or duty cycle. I suspect they can be measured together using edge detection on both rising and falling edges.
As duty cycle is not currently used, the better is to just remove it from the struct, adding it on a separate patch, together with a code that will need it.
Cheers,
Mauro
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
In reply to Maxim LevitskyEm 06-09-2010 18:26, Maxim Levitsky escreveu:
Quoted 339 lines
Add new event types for timeout & carrier report Move timeout handling from
ir_raw_event_store_with_filterto ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reportsNote: all new
ir_raw_eventvariables now should be initialized like that:DEFINE_IR_RAW_EVENT(ev);To clean an existing event, use
init_ir_raw_event(&ev);Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/ene_ir.c | 4 +- drivers/media/IR/ir-core-priv.h | 13 ++++++- drivers/media/IR/ir-jvc-decoder.c | 5 +- drivers/media/IR/ir-lirc-codec.c | 78 +++++++++++++++++++++++++++++++----- drivers/media/IR/ir-nec-decoder.c | 5 +- drivers/media/IR/ir-raw-event.c | 45 +++++++------------- drivers/media/IR/ir-rc5-decoder.c | 5 +- drivers/media/IR/ir-rc6-decoder.c | 5 +- drivers/media/IR/ir-sony-decoder.c | 5 +- drivers/media/IR/mceusb.c | 3 +- drivers/media/IR/streamzap.c | 8 ++- include/media/ir-core.h | 40 ++++++++++++++++--- 12 files changed, 153 insertions(+), 63 deletions(-)drivers/media/IR/ene_ir.c +2
-2@@ -701,7 +701,7 @@ static irqreturn_t ene_isr(int irq, void *data)unsigned long flags;irqreturn_t retval =IRQ_NONE ;struct ene_device *dev = (struct ene_device *)data; -struct ir_raw_event ev; +DEFINE_IR_RAW_EVENT (ev);spin_lock_irqsave (&dev->hw_lock, flags);@@ -904,7 +904,7 @@ static int ene_set_learning_mode(void *data, int enable) }/* outside interface: enable or disable idle mode */ -static void ene_rx_set_idle (void *data,int idle) +static void ene_rx_set_idle (void *data,bool idle) {struct ene_device *dev = (struct ene_device *)data;drivers/media/IR/ir-core-priv.h +12
-1@@ -82,6 +82,12 @@ struct ir_raw_event_ctrl {struct ir_input_dev *ir_dev;struct lirc_driver *drv;int carrier_low; + +ktime_t gap_start; +u64 gap_duration; +bool gap; +bool send_timeout_reports; + } lirc; };@@ -109,9 +115,14 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration) ev->duration -= duration; } +/* Returns true if event is normal pulse/space event */ +static inline bool is_timing_event (struct ir_raw_event ev) +{ +return !ev.carrier_report && !ev.reset; +} +#define TO_US (duration) DIV_ROUND_CLOSEST((duration), 1000)#define TO_STR (is_pulse) ((is_pulse) ? "pulse" : "space") -#define IS_RESET (ev) (ev.duration == 0)/* * Routines from ir-sysfs.c - Meant to be called only internally inside * ir-core drivers/media/IR/ir-jvc-decoder.c +3
-2@@ -50,8 +50,9 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_JVC ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-lirc-codec.c +67
-11@@ -32,6 +32,7 @@static int ir_lirc_decode (struct input_dev *input_dev,struct ir_raw_event ev) {struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); +struct lirc_codec *lirc = &ir_dev->raw->lirc;int sample;if (!(ir_dev->raw->enabled_protocols &IR_TYPE_LIRC ))@@ -40,21 +41,57 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf)return -EINVAL ; -if (IS_RESET (ev)) +/* Packet start */ +if (ev.reset)return 0 ; -IR_dprintk (2 ,"LIRC data transfer started (%uus %s)\n" , -TO_US (ev.duration),TO_STR (ev.pulse)); +/* Carrier reports */ +if (ev.carrier_report) { + sample =LIRC_FREQUENCY (ev.carrier); + +/* Packet end */ + }else if (ev.timeout) { + +if (lirc->gap) +return 0 ; + + lirc->gap_start =ktime_get (); + lirc->gap = true; + lirc->gap_duration = ev.duration; + +if (!lirc->send_timeout_reports) +return 0 ; + + sample =LIRC_TIMEOUT (ev.duration /1000 ); - sample = ev.duration /1000 ; -if (ev.pulse) - sample |=PULSE_BIT ; +/* Normal sample */ + }else { + +if (lirc->gap) { +int gap_sample; + + lirc->gap_duration +=ktime_to_ns (ktime_sub (ktime_get (), + lirc->gap_start)); + +/* Convert to ms and cap by LIRC_VALUE_MASK */ +do_div (lirc->gap_duration,1000 ); + lirc->gap_duration =min (lirc->gap_duration, + (u64 )LIRC_VALUE_MASK ); + + gap_sample =LIRC_SPACE (lirc->gap_duration); +lirc_buffer_write (ir_dev->raw->lirc.drv->rbuf, + (unsigned char *) &gap_sample); + lirc->gap = false; + } + + sample = ev.pulse ?LIRC_PULSE (ev.duration /1000 ) : +LIRC_SPACE (ev.duration /1000 ); + }lirc_buffer_write (ir_dev->raw->lirc.drv->rbuf, (unsigned char *) &sample);wake_up (&ir_dev->raw->lirc.drv->rbuf->wait_poll); -return 0 ; }@@ -103,6 +140,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,int ret =0 ;void *drv_data;unsigned long val =0 ; +u32 tmp; lirc =lirc_get_pdata (filep);if (!lirc)@@ -201,12 +239,26 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,break ;case LIRC_SET_REC_TIMEOUT : -if (val < ir_dev->props->min_timeout || - val > ir_dev->props->max_timeout) -return -EINVAL ; - ir_dev->props->timeout = val *1000 ; + tmp = val *1000 ; + +if (tmp < ir_dev->props->min_timeout || + tmp > ir_dev->props->max_timeout) +return -EINVAL ; + + ir_dev->props->timeout = tmp; +break ; + +case LIRC_SET_REC_TIMEOUT_REPORTS : + lirc->send_timeout_reports = !!val;break ; +case LIRC_SET_MEASURE_CARRIER_MODE : + +if (!ir_dev->props->s_carrier_report) +return -ENOSYS ; +return ir_dev->props->s_carrier_report ( + ir_dev->props->priv, !!val); +default :return lirc_dev_fop_ioctl (filep, cmd, arg); }@@ -277,6 +329,10 @@ static int ir_lirc_register(struct input_dev *input_dev)if (ir_dev->props->s_learning_mode) features |=LIRC_CAN_USE_WIDEBAND_RECEIVER ; +if (ir_dev->props->s_carrier_report) + features |=LIRC_CAN_MEASURE_CARRIER ; + +if (ir_dev->props->max_timeout) features |=LIRC_CAN_SET_REC_TIMEOUT ;drivers/media/IR/ir-nec-decoder.c +3
-2@@ -54,8 +54,9 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_NEC ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-raw-event.c +16
-29@@ -174,7 +174,7 @@ int ir_raw_event_store_with_filter(struct input_dev *input_dev,if (ir->idle && !ev->pulse)return 0 ;else if (ir->idle) -ir_raw_event_set_idle (input_dev,0 ); +ir_raw_event_set_idle (input_dev, false);if (!raw->this_ev.duration) { raw->this_ev = *ev;@@ -187,48 +187,35 @@ int ir_raw_event_store_with_filter(struct input_dev *input_dev,/* Enter idle mode if nessesary */ if (!ev->pulse && ir->props->timeout && - raw->this_ev.duration >= ir->props->timeout) -ir_raw_event_set_idle (input_dev,1 ); + raw->this_ev.duration >= ir->props->timeout) { +ir_raw_event_set_idle (input_dev, true); + }return 0 ; }EXPORT_SYMBOL_GPL (ir_raw_event_store_with_filter); -void ir_raw_event_set_idle (struct input_dev *input_dev,int idle) +/** +* ir_raw_event_set_idle() - hint the ir core if device is receiving +* IR data or not +* @input_dev: the struct input_dev device descriptor +* @idle: the hint value +*/ +void ir_raw_event_set_idle (struct input_dev *input_dev,bool idle) {struct ir_input_dev *ir =input_get_drvdata (input_dev);struct ir_raw_event_ctrl *raw = ir->raw; -ktime_t now; -u64 delta; -if (!ir->props) +if (!ir->props || !ir->raw)return ; -if (!ir->raw) - goto out; +IR_dprintk (2 ,"%s idle mode\n" , idle ?"enter" :"leave" );if (idle) { -IR_dprintk (2 ,"enter idle mode\n" ); - raw->last_event =ktime_get (); - }else { -IR_dprintk (2 ,"exit idle mode\n" ); - - now =ktime_get (); - delta =ktime_to_ns (ktime_sub (now, ir->raw->last_event)); - -WARN_ON (raw->this_ev.pulse); - - raw->this_ev.duration = -min (raw->this_ev.duration + delta, - (u64 )IR_MAX_DURATION ); - + raw->this_ev.timeout = true;ir_raw_event_store (input_dev, &raw->this_ev); - -if (raw->this_ev.duration ==IR_MAX_DURATION ) -ir_raw_event_reset (input_dev); - - raw->this_ev.duration =0 ; +init_ir_raw_event (&raw->this_ev); } -out: +if (ir->props->s_idle) ir->props->s_idle (ir->props->priv, idle); ir->idle = idle;drivers/media/IR/ir-rc5-decoder.c +3
-2@@ -55,8 +55,9 @@ static int ir_rc5_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC5 ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-rc6-decoder.c +0
-0
drivers/media/IR/ir-rc6-decoder.c static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev) · line 89
Quoted 7 lines
drivers/media/IR/ir-rc6-decoder.c +2
-2@@ -85,8 +85,9 @@ static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC6 ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset)
Again, why do you need to test first for !is_timing_event()?
Quoted 114 lines
drivers/media/IR/ir-rc6-decoder.c +1
-0+ data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-sony-decoder.c +3
-2@@ -48,8 +48,9 @@ static int ir_sony_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_SONY ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/mceusb.c +2
-1@@ -656,7 +656,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)static void mceusb_process_ir_data (struct mceusb_dev *ir,int buf_len) { -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);int i, start_index =0 ;u8 hdr =MCE_CONTROL_HEADER ;@@ -993,6 +993,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, ir->len_in = maxp; ir->flags.microsoft_gen1 = is_microsoft_gen1; ir->flags.tx_mask_inverted = tx_mask_inverted; +init_ir_raw_event (&ir->rawir);/* Saving usb interface data for use by the transmitter routine */ ir->usb_ep_in = ep_in;drivers/media/IR/streamzap.c +5
-3@@ -170,7 +170,7 @@ static void streamzap_flush_timeout(unsigned long arg)static void streamzap_delay_timeout (unsigned long arg) {struct streamzap_ir *sz = (struct streamzap_ir *)arg; -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);unsigned long flags;int len, ret;static unsigned long delay;@@ -215,7 +215,7 @@ static void streamzap_delay_timeout(unsigned long arg)static void streamzap_flush_delay_buffer (struct streamzap_ir *sz) { -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);bool wake = false;int ret;@@ -233,7 +233,7 @@ static void streamzap_flush_delay_buffer(struct streamzap_ir *sz)static void sz_push (struct streamzap_ir *sz) { -struct ir_raw_event rawir = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (rawir);unsigned long flags;int ret;@@ -512,6 +512,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf,if (!sz)return -ENOMEM ; +init_ir_raw_event (&sz->rawir); + sz->usbdev = usbdev; sz->interface = intf;include/media/ir-core.h +7
-3@@ -60,6 +60,7 @@ enum rc_driver_type {* @s_idle: optional: enable/disable hardware idle mode, upon which, device doesn't interrupt host until it sees IR pulses * @s_learning_mode: enable wide band receiver used for learning +* @s_carrier_report: enable carrier reports */ struct ir_dev_props {enum rc_driver_type driver_type;@@ -82,8 +83,9 @@ struct ir_dev_props {int (*s_tx_duty_cycle)(void *priv,u32 duty_cycle);int (*s_rx_carrier_range)(void *priv,u32 min,u32 max);int (*tx_ir)(void *priv,int *txbuf,u32 n); -void (*s_idle)(void *priv,int enable); +void (*s_idle)(void *priv,bool enable);int (*s_learning_mode)(void *priv,int enable); +int (*s_carrier_report) (void *priv,int enable); };struct ir_input_dev {@@ -162,22 +164,48 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);/* From ir-raw-event.c */ struct ir_raw_event { -unsigned pulse:1 ; -unsigned duration:31 ; + union { + u32 duration; + + struct {
include/media/ir-core.h u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); · line 180
Quoted 10 lines
include/media/ir-core.h +9
-0+u32 carrier; +u8 duty_cycle; + }; + }; + + unsigned pulse:1; + unsigned reset:1; + unsigned timeout:1; + unsigned carrier_report:1; };
Hmm... can an event have, simultaneously, more than one of those bits set? I don't think so. You could, instead, define the event type as:
#define EV_SPACE 0
#define EV_PULSE 1
#define EV_RESET 2
#define EV_TIMEOUT 3
#define EV_CARRIER 4
unsigned ev_type:3;
And use those macros for the tests:
#define IS_TIMING_EVENT(ev) (ev < EV_RESET)
#define IS_RESET(ev) (ev == EV_SPACE)
Also, it is not clear at the data struct that, when carrier_report = 1, it should use the carrier struct, instead of duration.
My suggestion is to use, instead:
struct ir_raw_event {
#define EV_SPACE 0
#define EV_PULSE 1
#define EV_RESET 2
#define EV_TIMEOUT 3
#define EV_CARRIER 4
unsigned ev_type:3;
union {
/* For EV_SPACE and EV_PULSE type of events */
u32 duration;
/* For EV_CARRIER type of events */
struct {
u32 carrier;
u8 duty_cycle;
};
};} __attribute__ ((packed));
Btw, as your code is changing the size of the events, it may be a good idea to use a larger buffer. For example, defining MAX_IR_EVENT_SIZE as something like
#define MAX_IR_EVENTS_PER_BUF 512
#define MAX_IR_EVENT_SIZE roundup_pow_of_two((MAX_IR_EVENTS_PER_BUF * sizeof(struct ir_raw_event)))
PS.: I'm not saying that 512 events for the buffer are ok or not. The buffer should be big enough to at least handle all events generated by one keystroke, as some drivers, like sms, only call the handler function after receiving all the events for one keystroke, but just leaving 512 without making it dependent of the size of the struct seems dangerous.
Quoted 33 lines
include/media/ir-core.h +18
-3-#define IR_MAX_DURATION 0x7FFFFFFF/* a bit more than 2 seconds */ +#define DEFINE_IR_RAW_EVENT (event) \ + struct ir_raw_event event = { \ + { .duration = 0 } , \ + .pulse = 0, \ + .reset = 0, \ + .timeout = 0, \ + .carrier_report = 0 } + +static inline void init_ir_raw_event (struct ir_raw_event *ev) +{ +memset (ev,0 ,sizeof (*ev)); +} + +#define IR_MAX_DURATION 0xFFFFFFFF/* a bit more than 4 seconds */ void ir_raw_event_handle (struct input_dev *input_dev);int ir_raw_event_store (struct input_dev *input_dev,struct ir_raw_event *ev);int ir_raw_event_store_edge (struct input_dev *input_dev,enum raw_event_type type);int ir_raw_event_store_with_filter (struct input_dev *input_dev,struct ir_raw_event *ev); -void ir_raw_event_set_idle (struct input_dev *input_dev,int idle); +void ir_raw_event_set_idle (struct input_dev *input_dev,bool idle);static inline void ir_raw_event_reset (struct input_dev *input_dev) { -struct ir_raw_event ev = { .pulse = false, .duration =0 }; +DEFINE_IR_RAW_EVENT (ev); + ev.reset = true; +ir_raw_event_store (input_dev, &ev);ir_raw_event_handle (input_dev); }
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Quoted 343 lines · Mauro Carvalho Chehab
Em 06-09-2010 18:26, Maxim Levitsky escreveu:
Quoted 342 lines
Add new event types for timeout & carrier report Move timeout handling from
ir_raw_event_store_with_filterto ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reportsNote: all new
ir_raw_eventvariables now should be initialized like that:DEFINE_IR_RAW_EVENT(ev);To clean an existing event, use
init_ir_raw_event(&ev);Signed-off-by Maxim Levitsky <[email protected]>--- drivers/media/IR/ene_ir.c | 4 +- drivers/media/IR/ir-core-priv.h | 13 ++++++- drivers/media/IR/ir-jvc-decoder.c | 5 +- drivers/media/IR/ir-lirc-codec.c | 78 +++++++++++++++++++++++++++++++----- drivers/media/IR/ir-nec-decoder.c | 5 +- drivers/media/IR/ir-raw-event.c | 45 +++++++------------- drivers/media/IR/ir-rc5-decoder.c | 5 +- drivers/media/IR/ir-rc6-decoder.c | 5 +- drivers/media/IR/ir-sony-decoder.c | 5 +- drivers/media/IR/mceusb.c | 3 +- drivers/media/IR/streamzap.c | 8 ++- include/media/ir-core.h | 40 ++++++++++++++++--- 12 files changed, 153 insertions(+), 63 deletions(-)drivers/media/IR/ene_ir.c +2
-2@@ -701,7 +701,7 @@ static irqreturn_t ene_isr(int irq, void *data)unsigned long flags;irqreturn_t retval =IRQ_NONE ;struct ene_device *dev = (struct ene_device *)data; -struct ir_raw_event ev; +DEFINE_IR_RAW_EVENT (ev);spin_lock_irqsave (&dev->hw_lock, flags);@@ -904,7 +904,7 @@ static int ene_set_learning_mode(void *data, int enable) }/* outside interface: enable or disable idle mode */ -static void ene_rx_set_idle (void *data,int idle) +static void ene_rx_set_idle (void *data,bool idle) {struct ene_device *dev = (struct ene_device *)data;drivers/media/IR/ir-core-priv.h +12
-1@@ -82,6 +82,12 @@ struct ir_raw_event_ctrl {struct ir_input_dev *ir_dev;struct lirc_driver *drv;int carrier_low; + +ktime_t gap_start; +u64 gap_duration; +bool gap; +bool send_timeout_reports; + } lirc; };@@ -109,9 +115,14 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration) ev->duration -= duration; } +/* Returns true if event is normal pulse/space event */ +static inline bool is_timing_event (struct ir_raw_event ev) +{ +return !ev.carrier_report && !ev.reset; +} +#define TO_US (duration) DIV_ROUND_CLOSEST((duration), 1000)#define TO_STR (is_pulse) ((is_pulse) ? "pulse" : "space") -#define IS_RESET (ev) (ev.duration == 0)/* * Routines from ir-sysfs.c - Meant to be called only internally inside * ir-core drivers/media/IR/ir-jvc-decoder.c +3
-2@@ -50,8 +50,9 @@ static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_JVC ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-lirc-codec.c +67
-11@@ -32,6 +32,7 @@static int ir_lirc_decode (struct input_dev *input_dev,struct ir_raw_event ev) {struct ir_input_dev *ir_dev =input_get_drvdata (input_dev); +struct lirc_codec *lirc = &ir_dev->raw->lirc;int sample;if (!(ir_dev->raw->enabled_protocols &IR_TYPE_LIRC ))@@ -40,21 +41,57 @@ static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf)return -EINVAL ; -if (IS_RESET (ev)) +/* Packet start */ +if (ev.reset)return 0 ; -IR_dprintk (2 ,"LIRC data transfer started (%uus %s)\n" , -TO_US (ev.duration),TO_STR (ev.pulse)); +/* Carrier reports */ +if (ev.carrier_report) { + sample =LIRC_FREQUENCY (ev.carrier); + +/* Packet end */ + }else if (ev.timeout) { + +if (lirc->gap) +return 0 ; + + lirc->gap_start =ktime_get (); + lirc->gap = true; + lirc->gap_duration = ev.duration; + +if (!lirc->send_timeout_reports) +return 0 ; + + sample =LIRC_TIMEOUT (ev.duration /1000 ); - sample = ev.duration /1000 ; -if (ev.pulse) - sample |=PULSE_BIT ; +/* Normal sample */ + }else { + +if (lirc->gap) { +int gap_sample; + + lirc->gap_duration +=ktime_to_ns (ktime_sub (ktime_get (), + lirc->gap_start)); + +/* Convert to ms and cap by LIRC_VALUE_MASK */ +do_div (lirc->gap_duration,1000 ); + lirc->gap_duration =min (lirc->gap_duration, + (u64 )LIRC_VALUE_MASK ); + + gap_sample =LIRC_SPACE (lirc->gap_duration); +lirc_buffer_write (ir_dev->raw->lirc.drv->rbuf, + (unsigned char *) &gap_sample); + lirc->gap = false; + } + + sample = ev.pulse ?LIRC_PULSE (ev.duration /1000 ) : +LIRC_SPACE (ev.duration /1000 ); + }lirc_buffer_write (ir_dev->raw->lirc.drv->rbuf, (unsigned char *) &sample);wake_up (&ir_dev->raw->lirc.drv->rbuf->wait_poll); -return 0 ; }@@ -103,6 +140,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,int ret =0 ;void *drv_data;unsigned long val =0 ; +u32 tmp; lirc =lirc_get_pdata (filep);if (!lirc)@@ -201,12 +239,26 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,break ;case LIRC_SET_REC_TIMEOUT : -if (val < ir_dev->props->min_timeout || - val > ir_dev->props->max_timeout) -return -EINVAL ; - ir_dev->props->timeout = val *1000 ; + tmp = val *1000 ; + +if (tmp < ir_dev->props->min_timeout || + tmp > ir_dev->props->max_timeout) +return -EINVAL ; + + ir_dev->props->timeout = tmp; +break ; + +case LIRC_SET_REC_TIMEOUT_REPORTS : + lirc->send_timeout_reports = !!val;break ; +case LIRC_SET_MEASURE_CARRIER_MODE : + +if (!ir_dev->props->s_carrier_report) +return -ENOSYS ; +return ir_dev->props->s_carrier_report ( + ir_dev->props->priv, !!val); +default :return lirc_dev_fop_ioctl (filep, cmd, arg); }@@ -277,6 +329,10 @@ static int ir_lirc_register(struct input_dev *input_dev)if (ir_dev->props->s_learning_mode) features |=LIRC_CAN_USE_WIDEBAND_RECEIVER ; +if (ir_dev->props->s_carrier_report) + features |=LIRC_CAN_MEASURE_CARRIER ; + +if (ir_dev->props->max_timeout) features |=LIRC_CAN_SET_REC_TIMEOUT ;drivers/media/IR/ir-nec-decoder.c +3
-2@@ -54,8 +54,9 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_NEC ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-raw-event.c +16
-29@@ -174,7 +174,7 @@ int ir_raw_event_store_with_filter(struct input_dev *input_dev,if (ir->idle && !ev->pulse)return 0 ;else if (ir->idle) -ir_raw_event_set_idle (input_dev,0 ); +ir_raw_event_set_idle (input_dev, false);if (!raw->this_ev.duration) { raw->this_ev = *ev;@@ -187,48 +187,35 @@ int ir_raw_event_store_with_filter(struct input_dev *input_dev,/* Enter idle mode if nessesary */ if (!ev->pulse && ir->props->timeout && - raw->this_ev.duration >= ir->props->timeout) -ir_raw_event_set_idle (input_dev,1 ); + raw->this_ev.duration >= ir->props->timeout) { +ir_raw_event_set_idle (input_dev, true); + }return 0 ; }EXPORT_SYMBOL_GPL (ir_raw_event_store_with_filter); -void ir_raw_event_set_idle (struct input_dev *input_dev,int idle) +/** +* ir_raw_event_set_idle() - hint the ir core if device is receiving +* IR data or not +* @input_dev: the struct input_dev device descriptor +* @idle: the hint value +*/ +void ir_raw_event_set_idle (struct input_dev *input_dev,bool idle) {struct ir_input_dev *ir =input_get_drvdata (input_dev);struct ir_raw_event_ctrl *raw = ir->raw; -ktime_t now; -u64 delta; -if (!ir->props) +if (!ir->props || !ir->raw)return ; -if (!ir->raw) - goto out; +IR_dprintk (2 ,"%s idle mode\n" , idle ?"enter" :"leave" );if (idle) { -IR_dprintk (2 ,"enter idle mode\n" ); - raw->last_event =ktime_get (); - }else { -IR_dprintk (2 ,"exit idle mode\n" ); - - now =ktime_get (); - delta =ktime_to_ns (ktime_sub (now, ir->raw->last_event)); - -WARN_ON (raw->this_ev.pulse); - - raw->this_ev.duration = -min (raw->this_ev.duration + delta, - (u64 )IR_MAX_DURATION ); - + raw->this_ev.timeout = true;ir_raw_event_store (input_dev, &raw->this_ev); - -if (raw->this_ev.duration ==IR_MAX_DURATION ) -ir_raw_event_reset (input_dev); - - raw->this_ev.duration =0 ; +init_ir_raw_event (&raw->this_ev); } -out: +if (ir->props->s_idle) ir->props->s_idle (ir->props->priv, idle); ir->idle = idle;drivers/media/IR/ir-rc5-decoder.c +3
-2@@ -55,8 +55,9 @@ static int ir_rc5_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC5 ))return 0 ; -if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset) + data->state =STATE_INACTIVE ;return 0 ; }drivers/media/IR/ir-rc6-decoder.c +0
-0@@ -85,8 +85,9 @@ static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC6 ))return 0 ;
Quoted 6 lines
drivers/media/IR/ir-rc6-decoder.c static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev) · line 89
Quoted 4 lines
drivers/media/IR/ir-rc6-decoder.c +2
-2-if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset)Again, why do you need to test first for !is_timing_event()?
Because the decoder should return early if the event is not a timing event (the return 0 two lines below)...think carrier report event...
Quoted 5 lines
Quoted 5 lines
drivers/media/IR/ir-rc6-decoder.c +1
-0+ data->state =STATE_INACTIVE ;return 0 ; }
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
Em 08-09-2010 19:49, David Härdeman escreveu:
Quoted 17 lines · Mauro Carvalho Chehab
Quoted 9 lines
Em 06-09-2010 18:26, Maxim Levitsky escreveu:
Quoted 8 lines
drivers/media/IR/ir-rc6-decoder.c +0
-0@@ -85,8 +85,9 @@ static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev)if (!(ir_dev->raw->enabled_protocols &IR_TYPE_RC6 ))return 0 ;Quoted 6 lines
drivers/media/IR/ir-rc6-decoder.c static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev) · line 89
Quoted 4 lines
drivers/media/IR/ir-rc6-decoder.c +2
-2-if (IS_RESET (ev)) { - data->state =STATE_INACTIVE ; +if (!is_timing_event (ev)) { +if (ev.reset)Again, why do you need to test first for !is_timing_event()?
Quoted 2 lines
Because the decoder should return early if the event is not a timing event (the return 0 two lines below)...think carrier report event...
Yeah, I saw that. I was supposed to remove all the comments about that, but I forgot to remove the last one ;)
Cheers,
Mauro.
Re: [PATCH 7/8] IR: extend ir_raw_event and do refactoring
In reply to Maxim LevitskyQuoted 6 lines · Maxim Levitsky
Add new event types for timeout & carrier report Move timeout handling from
ir_raw_event_store_with_filterto ir-lirc-codec, where it is really needed.
Now lirc bridge ensures proper gap handling. Extend lirc bridge for carrier & timeout reports
Quoted 6 lines
Note: all new
ir_raw_eventvariables now should be initialized like that:DEFINE_IR_RAW_EVENT(ev);To clean an existing event, use
init_ir_raw_event(&ev);Signed-off-by Maxim Levitsky <[email protected]>
Okay, so I think the end result of discussion on this patch was that we're all pretty much fine with it going in, even the as-yet-unused duty_cycle bit, as there *are* drivers that can use it sooner than later.
Signature · 2 lines
Jarod Wilson [email protected]
PATCH v5 8/8 IR: ene_ir: add support for carrier reports
In reply to Maxim Levitsky--- drivers/media/IR/ene_ir.c | 37 +++++++++++++++++++++++++++++-------- 1 files changed, 29 insertions(+), 8 deletions(-)
drivers/media/IR/ene_ir.c +29 -8
@@ -192,10 +192,11 @@ static int ene_hw_detect(struct ene_device *dev)/* Sense current received carrier */ void ene_rx_sense_carrier (struct ene_device *dev) { +DEFINE_IR_RAW_EVENT (ev); + +int carrier, duty_cycle;int period =ene_read_reg (dev,ENE_CIRCAR_PRD );int hperiod =ene_read_reg (dev,ENE_CIRCAR_HPRD ); -int carrier, duty_cycle; -if (!(period &ENE_CIRCAR_PRD_VALID ))return ;
@@ -208,13 +209,16 @@ void ene_rx_sense_carrier(struct ene_device *dev)dbg ("RX: hardware carrier period = %02x" , period);dbg ("RX: hardware carrier pulse period = %02x" , hperiod); - carrier =2000000 / period; duty_cycle = (hperiod *100 ) / period;dbg ("RX: sensed carrier = %d Hz, duty cycle %d%%" , - carrier, duty_cycle); - -/* TODO: Send carrier & duty cycle to IR layer */ + carrier, duty_cycle); +if (dev->carrier_detect_enabled) { + ev.carrier_report = true; + ev.carrier = carrier; + ev.duty_cycle = duty_cycle; +ir_raw_event_store (dev->idev, &ev); + } }/* this enables/disables the CIR RX engine */
@@ -728,7 +732,7 @@ static irqreturn_t ene_isr(int irq, void *data)dbg_verbose ("RX interrupt" ); -if (dev->carrier_detect_enabled || debug) +if (dev->hw_learning_and_tx_capable)ene_rx_sense_carrier (dev);/* On hardware that don't support extra buffer we need to trust
@@ -903,6 +907,23 @@ static int ene_set_learning_mode(void *data, int enable)return 0 ; } +static int ene_set_carrier_report (void *data,int enable) +{ +struct ene_device *dev = (struct ene_device *)data; +unsigned long flags; + +if (enable == dev->carrier_detect_enabled) +return 0 ; + +spin_lock_irqsave (&dev->hw_lock, flags); + dev->carrier_detect_enabled = enable; +ene_rx_disable (dev); +ene_rx_setup (dev); +ene_rx_enable (dev); +spin_unlock_irqrestore (&dev->hw_lock, flags); +return 0 ; +} +/* outside interface: enable or disable idle mode */ static void ene_rx_set_idle (void *data,bool idle) {
@@ -1032,7 +1053,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) ir_props->s_tx_mask = ene_set_tx_mask; ir_props->s_tx_carrier = ene_set_tx_carrier; ir_props->s_tx_duty_cycle = ene_set_tx_duty_cycle; -/* ir_props->s_carrier_report = ene_set_carrier_report; */ + ir_props->s_carrier_report = ene_set_carrier_report; }ene_setup_hw_buffer (dev);
Signature · 1 line
1.7.0.4
Quoted 3 lines · Maxim Levitsky
Hi,
Here is full overview of my patches:
What changed from V4?
Signature · 5 lines
David Härdeman -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · David Härdeman
Quoted 3 lines · Maxim Levitsky
Hi,
Here is full overview of my patches:
What changed from V4?
Nothing other that 2 build fixes that I forgot to include. I also cced linux-media because I was asked to.
Best regards,
Maxim Levitsky
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Em 06-09-2010 18:26, Maxim Levitsky escreveu:
Quoted 24 lines
Hi,
Here is full overview of my patches:
Patch #1 fixes races in ir thread.
It fixes the case whenktherad_stopwaits forever for the thread. This happens on module unload and therefore it never finishes. Sorry for introducing this bug.Patch #2, fixes a crash on my module load.
It happens because ir core initializes the input device a bit early, therefore it could be accessed while still not set up.Patch #3 fixes a small typo in lirc code that makes it impossible to use tx duty cycle setting.
Patch #4 fixes a problem seen on my system that results in stuck down forever key.
Patch #5 adds few keys to MCE keymap that were found on laptop of an user I tested this driver with
Patch #6, is a combined update ti my driver. It contains lot of refactoring thanks to docs I have now, and lot of fixes, and supports latest version of firmware (and I have 4 users asking for that) It is quite huge, but it would be a tedios job to break it up. This can't introduce regressions because the
ene_irwas never released. In addition to that it was tested by me and another two users.
Quoted 7 lines
Patch #7 the really only patch that touches drivers I don't have does touch the ir-core.
It is quite small, and it adds a proper solution to dilema about what to do with huge space between keypresses. Now this space is just truncated by the driver with timeout flag.
The lirc codec then ensures that right sample is send to the lircd.
Please review and test it.Patch #8 is very simple. It just builds on top of patch #7 and adds carrier reports to ene driver.
For now, I've applied patches 3, 4 and 5, as it is nice to have Jarod's review also.
Cheers,
Mauro
Quoted 31 lines · Mauro Carvalho Chehab
Em 06-09-2010 18:26, Maxim Levitsky escreveu:
Quoted 30 lines
Hi,
Here is full overview of my patches:
Patch #1 fixes races in ir thread.
It fixes the case whenktherad_stopwaits forever for the thread. This happens on module unload and therefore it never finishes. Sorry for introducing this bug.Patch #2, fixes a crash on my module load.
It happens because ir core initializes the input device a bit early, therefore it could be accessed while still not set up.Patch #3 fixes a small typo in lirc code that makes it impossible to use tx duty cycle setting.
Patch #4 fixes a problem seen on my system that results in stuck down forever key.
Patch #5 adds few keys to MCE keymap that were found on laptop of an user I tested this driver with
Patch #6, is a combined update ti my driver. It contains lot of refactoring thanks to docs I have now, and lot of fixes, and supports latest version of firmware (and I have 4 users asking for that) It is quite huge, but it would be a tedios job to break it up. This can't introduce regressions because the
ene_irwas never released. In addition to that it was tested by me and another two users.Patch #7 the really only patch that touches drivers I don't have does touch the ir-core.
It is quite small, and it adds a proper solution to dilema about what to do with huge space between keypresses. Now this space is just truncated by the driver with timeout flag.
The lirc codec then ensures that right sample is send to the lircd.
Please review and test it.
Quoted 3 lines
Quoted 1 line
Patch #8 is very simple. It just builds on top of patch #7 and adds carrier reports to ene driver.
For now, I've applied patches 3, 4 and 5, as it is nice to have Jarod's review also.
I've finally got them all applied atop current media_tree staging/v2.6.37, though none of the streamzap bits in patch 7 are applicable any longer. Will try to get through looking and commenting (and testing) of the rest of them tonight.
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 32 lines · Jarod Wilson
Quoted 31 lines · Mauro Carvalho Chehab
Em 06-09-2010 18:26, Maxim Levitsky escreveu:
Quoted 30 lines
Hi,
Here is full overview of my patches:
Patch #1 fixes races in ir thread.
It fixes the case whenktherad_stopwaits forever for the thread. This happens on module unload and therefore it never finishes. Sorry for introducing this bug.Patch #2, fixes a crash on my module load.
It happens because ir core initializes the input device a bit early, therefore it could be accessed while still not set up.Patch #3 fixes a small typo in lirc code that makes it impossible to use tx duty cycle setting.
Patch #4 fixes a problem seen on my system that results in stuck down forever key.
Patch #5 adds few keys to MCE keymap that were found on laptop of an user I tested this driver with
Patch #6, is a combined update ti my driver. It contains lot of refactoring thanks to docs I have now, and lot of fixes, and supports latest version of firmware (and I have 4 users asking for that) It is quite huge, but it would be a tedios job to break it up. This can't introduce regressions because the
ene_irwas never released. In addition to that it was tested by me and another two users.Patch #7 the really only patch that touches drivers I don't have does touch the ir-core.
It is quite small, and it adds a proper solution to dilema about what to do with huge space between keypresses. Now this space is just truncated by the driver with timeout flag.
The lirc codec then ensures that right sample is send to the lircd.
Please review and test it.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Patch #8 is very simple. It just builds on top of patch #7 and adds carrier reports to ene driver.
For now, I've applied patches 3, 4 and 5, as it is nice to have Jarod's review also.
I've finally got them all applied atop current
media_treestaging/v2.6.37, though none of the streamzap bits in patch 7 are applicable any longer. Will try to get through looking and commenting (and testing) of the rest of them tonight.
Also had to make a minor addition to the rc5-sz decoder (same change as in the other decoders). Almost have all the requisite test kernels for David's, Maxim's and Dmitry's patchsets built and installed, wish my laptop was faster... Probably would have been faster to use a lab box and copy data over. Oh well. So functional testing to hopefully commence tomorrow morning.
Signature · 2 lines
Jarod Wilson [email protected]
On Thu, Sep 09, 2010 at 12:34:27AM -0400, Jarod Wilson wrote:
...
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
For now, I've applied patches 3, 4 and 5, as it is nice to have Jarod's review also.
I've finally got them all applied atop current
media_treestaging/v2.6.37, though none of the streamzap bits in patch 7 are applicable any longer. Will try to get through looking and commenting (and testing) of the rest of them tonight.
Quoted 6 lines
Also had to make a minor addition to the rc5-sz decoder (same change as in the other decoders). Almost have all the requisite test kernels for David's, Maxim's and Dmitry's patchsets built and installed, wish my laptop was faster... Probably would have been faster to use a lab box and copy data over. Oh well. So functional testing to hopefully commence tomorrow morning.
Wuff. None of the three builds is at all stable on my laptop, but I can't actually point the finger at any of the three patchsets, since I'm getting spontaneous lockups doing nothing at all before even plugging in a receiver. I did however get occasional periods of a non-panicking (not starting X seems to help a lot). Initial results:
Dmitry's patchset:
- all good for imon, streamzap and mceusb
David's patchset:
- all good for mceusb, as expected, since David has mce hardware himself, did not try the others yet
Maxim's patchset:
- all good for mceusb and imon
- streamzap decoding fails miserably. I have an inkling why, but will need to get a stable testing platform before I can really properly dig into it.
Still working on that stable testing platform, which is "backport current ir-core to the latest Fedora 14 kernel", which is 2.6.35.4-based and rock-solid on this machine. After that, will start applying patchsets.
(I have yet to really look at the lockups, they look like random memory corruption though).
Signature · 2 lines
Jarod Wilson [email protected]
Quoted 5 lines · Jarod Wilson
Wuff. None of the three builds is at all stable on my laptop, but I can't actually point the finger at any of the three patchsets, since I'm getting spontaneous lockups doing nothing at all before even plugging in a receiver. I did however get occasional periods of a non-panicking (not starting X seems to help a lot). Initial results:
If you get lockups without even plugging in a receiver, does that mean that the rc-core driver hasn't even been loaded at that point?
Signature · 6 lines
David Härdeman -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · David Härdeman
Quoted 5 lines · Jarod Wilson
Wuff. None of the three builds is at all stable on my laptop, but I can't actually point the finger at any of the three patchsets, since I'm getting spontaneous lockups doing nothing at all before even plugging in a receiver. I did however get occasional periods of a non-panicking (not starting X seems to help a lot). Initial results:
If you get lockups without even plugging in a receiver, does that mean that the rc-core driver hasn't even been loaded at that point?
Correct, no rc-core bits loaded at all at this point.
Signature · 7 lines
Jarod Wilson [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Jarod Wilson
On Thu, Sep 09, 2010 at 12:34:27AM -0400, Jarod Wilson wrote:
...Quoted 7 lines
Quoted 6 lines
Quoted 1 line
For now, I've applied patches 3, 4 and 5, as it is nice to have Jarod's review also.
I've finally got them all applied atop current
media_treestaging/v2.6.37, though none of the streamzap bits in patch 7 are applicable any longer. Will try to get through looking and commenting (and testing) of the rest of them tonight.Quoted 6 lines
Also had to make a minor addition to the rc5-sz decoder (same change as in the other decoders). Almost have all the requisite test kernels for David's, Maxim's and Dmitry's patchsets built and installed, wish my laptop was faster... Probably would have been faster to use a lab box and copy data over. Oh well. So functional testing to hopefully commence tomorrow morning.
Quoted 6 lines
Wuff. None of the three builds is at all stable on my laptop, but I can't actually point the finger at any of the three patchsets, since I'm getting spontaneous lockups doing nothing at all before even plugging in a receiver. I did however get occasional periods of a non-panicking (not starting X seems to help a lot). Initial results:
Btw, my printk blackbox patch could help you a lot.
I can't count how many times it helped me.
I just enable softlockup, hardlockup, and nmi watchdog, and let system panic on oopses, and reboot. Or if you have hardware reboot button, you can just use it. The point is that most BIOSES don't clear the ram, and I take advantage of that.
Recently in an attempt to make it reserve only small portion of memory (before I would use mem=) I also made this work out of box.
After a reboot, to get crash dmesg, just do sudo cat /sys/kernel/debug/printk/crash_dmesg | strings
Note that kernel contains now a ramoops module that does similar things. It doesn't reserve the memory automatically, and (this is the reason I still don't use it) is only called by kernel to save oopses/panicks. It should be enough though too, but my patch actually places the printk buffer itself in the fixed area in the ram.
Best regards,
Maxim Levitsky
commit 8f1c423046c22dad6aaeca04bfcb0ab301843c36
Author: Maxim Levitsky <[email protected]> Date: Sat Jul 31 13:43:03 2010 +0300
printk: Allow to fix the physical address of printk buffer
Allows to put printk buffer at fixed location of ram (default 128M).
If debugfs is enabled, log of last boot is copied into system ram, and can be accessed via debugfs, for example cat /sys/kernel/debug/printk/crash_dmesg
arch/x86/include/asm/setup.h +1 -0
@@ -46,6 +46,7 @@ extern unsigned long saved_video_mode;extern void reserve_standard_io_resources (void );extern void i386_reserve_resources (void );extern void setup_default_timer_irq (void ); +extern void early_reserve_printk_buffer (void );#ifdef CONFIG_X86_MRST extern void x86_mrst_early_setup (void );
arch/x86/kernel/setup.c +1 -0
@@ -843,6 +843,7 @@ void __init setup_arch(char **cmdline_p)/* after early param, so could get panic from serial */ reserve_early_setup_data (); +early_reserve_printk_buffer ();if (acpi_mps_check ()) {#ifdef CONFIG_X86_LOCAL_APIC
arch/x86/mm/ioremap.c +0 -1
@@ -106,7 +106,6 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,if (is_ram &&pfn_valid (pfn) && !PageReserved (pfn_to_page (pfn)))return NULL ; -WARN_ON_ONCE (is_ram); }/*
kernel/printk.c +89 -0
107 lines not on this page · raw message
lib/Kconfig.debug +29 -0
@@ -788,6 +788,35 @@ config BOOT_PRINTK_DELAY BOOT_PRINTK_DELAY also may cause DETECT_SOFTLOCKUP to detect what it believes to be lockup conditions. +config HWMEM_PRINTK + bool "Log printk message buffer into fixed physical address (DANGEROUS)" + depends on DEBUG_KERNEL && PRINTK + help + This option allows to place kernel log buffer into pre-defined + area, somewhere in memory space. + + This creates some sort of black box recorder and can be very useful + to debug several problems, especially 'panics' that happen while you + use the X window system. + + + If you also select debugfs support, you can easily look at + kernel log of failed boot at: + /sys/kernel/debug/printk/crash_dmesg + + (Assuming you mounted debugfs on /sys/kernel/debug) + + Misuse of this option can be DANGEROUS, as it makes kernel write at + arbitary (selected by you) hardware memory range. + + It is only intended for debbuging, so say 'no' if not sure + +config HWMEM_PRINTK_DEFAULT_ADDRESS + hex + depends on HWMEM_PRINTK + prompt "Default address at which store the printk buffer (default 60M)" + default "0x3C00000" + config RCU_TORTURE_TEST tristate "torture tests for RCU" depends on DEBUG_KERNEL
Quoted 24 lines · Maxim Levitsky
Quoted 16 lines · Jarod Wilson
On Thu, Sep 09, 2010 at 12:34:27AM -0400, Jarod Wilson wrote:
...Quoted 7 lines
Quoted 6 lines
Quoted 1 line
For now, I've applied patches 3, 4 and 5, as it is nice to have Jarod's review also.
I've finally got them all applied atop current
media_treestaging/v2.6.37, though none of the streamzap bits in patch 7 are applicable any longer. Will try to get through looking and commenting (and testing) of the rest of them tonight.Quoted 6 lines
Also had to make a minor addition to the rc5-sz decoder (same change as in the other decoders). Almost have all the requisite test kernels for David's, Maxim's and Dmitry's patchsets built and installed, wish my laptop was faster... Probably would have been faster to use a lab box and copy data over. Oh well. So functional testing to hopefully commence tomorrow morning.
Quoted 6 lines
Wuff. None of the three builds is at all stable on my laptop, but I can't actually point the finger at any of the three patchsets, since I'm getting spontaneous lockups doing nothing at all before even plugging in a receiver. I did however get occasional periods of a non-panicking (not starting X seems to help a lot). Initial results:
Quoted 6 lines
Btw, my printk blackbox patch could help you a lot.
I can't count how many times it helped me.
I just enable softlockup, hardlockup, and nmi watchdog, and let system panic on oopses, and reboot. Or if you have hardware reboot button, you can just use it. The point is that most BIOSES don't clear the ram, and I take advantage of that.
Interesting. I was thinking perhaps I'd give a go at trying kdump on my laptop, but I've had pretty mixed results with kdump working correctly on random kernels (generally works quite well in RHEL, notsomuch in Fedora).
My hope is that this is something already fixed in later Linus' kernels, so I'll try a current Linus snap before I try looking any deeper. I'll file this away for consideration though!
Signature · 2 lines
Jarod Wilson [email protected]
A message that is not in the archive (sent off-list or not yet received): 1283808373-27876-1-git-send-email-maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 24 lines · Maxim Levitsky
Hi,
Here is full overview of my patches:
Patch #1 fixes races in ir thread.
It fixes the case whenktherad_stopwaits forever for the thread. This happens on module unload and therefore it never finishes. Sorry for introducing this bug.Patch #2, fixes a crash on my module load.
It happens because ir core initializes the input device a bit early, therefore it could be accessed while still not set up.Patch #3 fixes a small typo in lirc code that makes it impossible to use tx duty cycle setting.
Patch #4 fixes a problem seen on my system that results in stuck down forever key.
Patch #5 adds few keys to MCE keymap that were found on laptop of an user I tested this driver with
Patch #6, is a combined update ti my driver. It contains lot of refactoring thanks to docs I have now, and lot of fixes, and supports latest version of firmware (and I have 4 users asking for that) It is quite huge, but it would be a tedios job to break it up. This can't introduce regressions because the
ene_irwas never released. In addition to that it was tested by me and another two users.
Quoted 8 lines
Patch #7 the really only patch that touches drivers I don't have does touch the ir-core.
It is quite small, and it adds a proper solution to dilema about what to do with huge space between keypresses. Now this space is just truncated by the driver with timeout flag.
The lirc codec then ensures that right sample is send to the lircd.
Please review and test it.Patch #8 is very simple. It just builds on top of patch #7 and adds carrier reports to ene driver.
Any update?
Should I resent these (didn't change anything I think). What about other work that conflicts with this? What are the plans for (very close) merge window?
Best regards,
Maxim Levitsky
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb