Series short description
Subsystems (3)
cover Series short description
The following series implements the suggested change to ir-core to use a 1:31 struct for pulse/space durations, adds two new raw decoders, converts two users of ir-functions to plain ir-core and fixes a few small bugs in ir-core.
---
David Härdeman (8):
ir-core: change duration to be coded as a u32 integer
ir-core: Add JVC support to ir-core
ir-core: Add Sony support to ir-core
ir-core: remove ir-functions usage from dm1105
ir-core: convert mantis from ir-functions.c
ir-core: fix double spinlock init in drivers/media/IR/rc-map.c
ir-core: fix table resize during keymap init
ir-core: fix some confusing comments
drivers/media/IR/Kconfig | 18 ++ drivers/media/IR/Makefile | 2 drivers/media/IR/ir-core-priv.h | 63 ++++--- drivers/media/IR/ir-jvc-decoder.c | 320 ++++++++++++++++++++++++++++++++++++ drivers/media/IR/ir-keytable.c | 12 + drivers/media/IR/ir-nec-decoder.c | 120 ++++++++------ drivers/media/IR/ir-raw-event.c | 32 ++-- drivers/media/IR/ir-rc5-decoder.c | 105 ++++++------ drivers/media/IR/ir-rc6-decoder.c | 221 +++++++++++++------------ drivers/media/IR/ir-sony-decoder.c | 312 +++++++++++++++++++++++++++++++++++ drivers/media/IR/ir-sysfs.c | 12 + drivers/media/IR/rc-map.c | 5 - 12 files changed, 955 insertions(+), 267 deletions(-) create mode 100644 drivers/media/IR/ir-jvc-decoder.c create mode 100644 drivers/media/IR/ir-sony-decoder.c
PATCH 1/8 ir-core: change duration to be coded as a u32 integer
This patch implements the agreed upon 1:31 integer encoded pulse/duration struct for ir-core raw decoders. All decoders have been tested after the change. Comments are welcome.
--- drivers/media/IR/ir-core-priv.h | 49 ++++---- drivers/media/IR/ir-nec-decoder.c | 120 +++++++++++--------- drivers/media/IR/ir-raw-event.c | 30 +++-- drivers/media/IR/ir-rc5-decoder.c | 105 ++++++++---------- drivers/media/IR/ir-rc6-decoder.c | 221 +++++++++++++++++++------------------ 5 files changed, 271 insertions(+), 254 deletions(-)
drivers/media/IR/ir-core-priv.h +23 -26
@@ -21,7 +21,7 @@struct ir_raw_handler {struct list_head list; -int (*decode)(struct input_dev *input_dev,s64 duration); +int (*decode)(struct input_dev *input_dev,struct ir_raw_event event);int (*raw_register)(struct input_dev *input_dev);int (*raw_unregister)(struct input_dev *input_dev); };
@@ -35,26 +35,28 @@ struct ir_raw_event_ctrl { };/* macros for IR decoders */ -#define PULSE (units) ((units)) -#define SPACE (units) (-(units)) -#define IS_RESET (duration) ((duration) == 0) -#define IS_PULSE (duration) ((duration) > 0) -#define IS_SPACE (duration) ((duration) < 0) -#define DURATION (duration) (abs((duration))) -#define IS_TRANSITION (x, y) ((x) * (y) < 0) -#define DECREASE_DURATION (duration, amount) \ - do { \ - if (IS_SPACE(duration)) \ - duration += (amount); \ - else if (IS_PULSE(duration)) \ - duration -= (amount); \ - } while (0) - -#define TO_UNITS (duration, unit_len) \ - ((int)((duration) > 0 ? \ - DIV_ROUND_CLOSEST(abs((duration)), (unit_len)) :\ - -DIV_ROUND_CLOSEST(abs((duration)), (unit_len)))) -#define TO_US (duration) ((int)TO_UNITS(duration, 1000)) +static inline bool geq_margin (unsigned d1,unsigned d2,unsigned margin) { +return d1 > (d2 - margin); +} + +static inline bool eq_margin (unsigned d1,unsigned d2,unsigned margin) { +return ((d1 > (d2 - margin)) && (d1 < (d2 + margin))); +} + +static inline bool is_transition (struct ir_raw_event *x,struct ir_raw_event *y) { +return x->pulse != y->pulse; +} + +static inline void decrease_duration (struct ir_raw_event *ev,unsigned duration) { +if (duration > ev->duration) + ev->duration =0 ; +else + ev->duration -= duration; +} + +#define TO_US (duration) (((duration) + 500) / 1000) +#define TO_STR (is_pulse) ((is_pulse) ? "pulse" : "space") +#define IS_RESET (ev) (ev.duration == 0)/* * Routines from ir-keytable.c to be used internally on ir-core and decoders
@@ -76,11 +78,6 @@ void ir_unregister_class(struct input_dev *input_dev);*/ int ir_raw_event_register (struct input_dev *input_dev);void ir_raw_event_unregister (struct input_dev *input_dev); -static inline void ir_raw_event_reset (struct input_dev *input_dev) -{ -ir_raw_event_store (input_dev,0 ); -ir_raw_event_handle (input_dev); -}int ir_raw_handler_register (struct ir_raw_handler *ir_raw_handler);void ir_raw_handler_unregister (struct ir_raw_handler *ir_raw_handler);void ir_raw_init (void );
drivers/media/IR/ir-nec-decoder.c +67 -53
188 lines not on this page · raw message
drivers/media/IR/ir-raw-event.c +18 -12
@@ -57,12 +57,12 @@ static struct work_struct wq_load;static void ir_raw_event_work (struct work_struct *work) { -s64 d; +struct ir_raw_event ev;struct ir_raw_event_ctrl *raw = container_of(work, struct ir_raw_event_ctrl, rx_work); -while (kfifo_out (&raw->kfifo, &d,sizeof (d)) ==sizeof (d)) -RUN_DECODER (decode, raw->input_dev, d); +while (kfifo_out (&raw->kfifo, &ev,sizeof (ev)) ==sizeof (ev)) +RUN_DECODER (decode, raw->input_dev, ev); }int ir_raw_event_register (struct input_dev *input_dev)
@@ -114,21 +114,21 @@ void ir_raw_event_unregister(struct input_dev *input_dev)/** * ir_raw_event_store() - pass a pulse/space duration to the raw ir decoders * @input_dev: the struct input_dev device descriptor -* @duration: duration of the pulse or space in ns +* @ev: the struct ir_raw_event descriptor of the pulse/space * * This routine (which may be called from an interrupt context) stores a * pulse/space duration for the raw ir decoding state machines. Pulses are * signalled as positive values and spaces as negative values. A zero value * will reset the decoding state machines. */ -int ir_raw_event_store (struct input_dev *input_dev,s64 duration) +int ir_raw_event_store (struct input_dev *input_dev,struct ir_raw_event *ev) {struct ir_input_dev *ir =input_get_drvdata (input_dev);if (!ir->raw)return -EINVAL ; -if (kfifo_in (&ir->raw->kfifo, &duration,sizeof (duration)) !=sizeof (duration)) +if (kfifo_in (&ir->raw->kfifo, ev,sizeof (*ev)) !=sizeof (*ev))return -ENOMEM ;return 0 ;
@@ -151,6 +151,7 @@ int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type typstruct ir_input_dev *ir =input_get_drvdata (input_dev);ktime_t now;s64 delta;/* ns */ +struct ir_raw_event ev;int rc =0 ;if (!ir->raw)
@@ -163,16 +164,21 @@ int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type typ* being called for the first time, note that delta can't * possibly be negative. */ -if (delta >NSEC_PER_SEC || !ir->raw->last_type) + ev.duration =0 ; +if (delta >IR_MAX_DURATION || !ir->raw->last_type) type |=IR_START_EVENT ; +else + ev.duration = delta;if (type &IR_START_EVENT )ir_raw_event_reset (input_dev); -else if (ir->raw->last_type &IR_SPACE ) - rc =ir_raw_event_store (input_dev, -delta); -else if (ir->raw->last_type &IR_PULSE ) - rc =ir_raw_event_store (input_dev, delta); -else +else if (ir->raw->last_type &IR_SPACE ) { + ev.pulse = false; + rc =ir_raw_event_store (input_dev, &ev); + }else if (ir->raw->last_type &IR_PULSE ) { + ev.pulse = true; + rc =ir_raw_event_store (input_dev, &ev); + }else return 0 ; ir->raw->last_event = now;
drivers/media/IR/ir-rc5-decoder.c +49 -56
171 lines not on this page · raw message
drivers/media/IR/ir-rc6-decoder.c +114 -107
294 lines not on this page · raw message
include/media/ir-core.h +14 -2
@@ -127,9 +127,21 @@ void ir_keydown(struct input_dev *dev, int scancode, u8 toggle);/* From ir-raw-event.c */ +struct ir_raw_event { +unsigned pulse:1 ; +unsigned duration:31 ; +}; + +#define IR_MAX_DURATION 0x7FFFFFFF/* a bit more than 2 seconds */ +void ir_raw_event_handle (struct input_dev *input_dev); -int ir_raw_event_store (struct input_dev *input_dev,s64 duration); +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); - +static inline void ir_raw_event_reset (struct input_dev *input_dev) +{ +struct ir_raw_event ev = { .pulse = false, .duration =0 }; +ir_raw_event_store (input_dev, &ev); +ir_raw_event_handle (input_dev); +}#endif /* _IR_CORE */
--
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
PATCH 2/8 ir-core: Add JVC support to ir-core
In reply to David HärdemanThis patch adds a JVC decoder to ir-core.
--- drivers/media/IR/Kconfig | 9 + drivers/media/IR/Makefile | 1 drivers/media/IR/ir-core-priv.h | 7 + drivers/media/IR/ir-jvc-decoder.c | 320 +++++++++++++++++++++++++++++++++++++ drivers/media/IR/ir-raw-event.c | 1 drivers/media/IR/ir-sysfs.c | 4 6 files changed, 342 insertions(+), 0 deletions(-) create mode 100644 drivers/media/IR/ir-jvc-decoder.c
drivers/media/IR/Kconfig +9 -0
@@ -36,3 +36,12 @@ config IR_RC6_DECODER ---help--- Enable this option if you have an infrared remote control which uses the RC6 protocol, and you need software decoding support. + +config IR_JVC_DECODER + tristate "Enable IR raw decoder for the JVC protocol" + depends on IR_CORE + default y + + ---help--- + Enable this option if you have an infrared remote control which + uses the JVC protocol, and you need software decoding support.
drivers/media/IR/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_VIDEO_IR) += ir-common.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o +obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o
drivers/media/IR/ir-core-priv.h +7 -0
@@ -111,4 +111,11 @@ void ir_raw_init(void);#define load_rc6_decode () 0#endif +/* from ir-jvc-decoder.c */ +#ifdef CONFIG_IR_JVC_DECODER_MODULE +#define load_jvc_decode () request_module("ir-jvc-decoder") +#else +#define load_jvc_decode () 0 +#endif +#endif /* _IR_RAW_EVENT */
drivers/media/IR/ir-jvc-decoder.c new file +320 -0
320 lines not on this page · raw message
drivers/media/IR/ir-raw-event.c +1 -0
@@ -233,6 +233,7 @@ static void init_decoders(struct work_struct *work)load_nec_decode ();load_rc5_decode ();load_rc6_decode (); +load_jvc_decode ();/* If needed, we may later add some init code. In this case, it is needed to change the CONFIG_MODULE test at ir-core.h
drivers/media/IR/ir-sysfs.c +4 -0
@@ -62,6 +62,8 @@ static ssize_t show_protocol(struct device *d, s ="nec" ; else if (ir_type == IR_TYPE_RC6) s ="rc6" ; + else if (ir_type == IR_TYPE_JVC) + s ="jvc" ; else s ="other" ;
@@ -99,6 +101,8 @@ static ssize_t store_protocol(struct device *d, ir_type |=IR_TYPE_PD ;if (!strcasecmp (buf,"nec" )) ir_type |=IR_TYPE_NEC ; +if (!strcasecmp (buf,"jvc" )) + ir_type |=IR_TYPE_JVC ; }if (!ir_type) {
include/media/rc-map.h +1 -0
@@ -16,6 +16,7 @@#define IR_TYPE_PD (1 << 1)/* Pulse distance encoded IR */ #define IR_TYPE_NEC (1 << 2)#define IR_TYPE_RC6 (1 << 3)/* Philips RC6 protocol */ +#define IR_TYPE_JVC (1 << 4)/* JVC protocol */ #define IR_TYPE_OTHER (1u << 31)struct ir_scancode {
PATCH 3/8 ir-core: Add Sony support to ir-core
In reply to David HärdemanThis patch adds a Sony12/15/20 decoder to ir-core.
--- drivers/media/IR/Kconfig | 9 + drivers/media/IR/Makefile | 1 drivers/media/IR/ir-core-priv.h | 7 + drivers/media/IR/ir-raw-event.c | 1 drivers/media/IR/ir-sony-decoder.c | 312 ++++++++++++++++++++++++++++++++++++ drivers/media/IR/ir-sysfs.c | 4 6 files changed, 334 insertions(+), 0 deletions(-) create mode 100644 drivers/media/IR/ir-sony-decoder.c
drivers/media/IR/Kconfig +9 -0
@@ -45,3 +45,12 @@ config IR_JVC_DECODER ---help--- Enable this option if you have an infrared remote control which uses the JVC protocol, and you need software decoding support. + +config IR_SONY_DECODER + tristate "Enable IR raw decoder for the Sony protocol" + depends on IR_CORE + default y + + ---help--- + Enable this option if you have an infrared remote control which + uses the Sony protocol, and you need software decoding support.
drivers/media/IR/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o +obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o
drivers/media/IR/ir-core-priv.h +7 -0
@@ -118,4 +118,11 @@ void ir_raw_init(void);#define load_jvc_decode () 0#endif +/* from ir-sony-decoder.c */ +#ifdef CONFIG_IR_SONY_DECODER_MODULE +#define load_sony_decode () request_module("ir-sony-decoder") +#else +#define load_sony_decode () 0 +#endif +#endif /* _IR_RAW_EVENT */
drivers/media/IR/ir-raw-event.c +1 -0
@@ -234,6 +234,7 @@ static void init_decoders(struct work_struct *work)load_rc5_decode ();load_rc6_decode ();load_jvc_decode (); +load_sony_decode ();/* If needed, we may later add some init code. In this case, it is needed to change the CONFIG_MODULE test at ir-core.h
drivers/media/IR/ir-sony-decoder.c new file +312 -0
312 lines not on this page · raw message
drivers/media/IR/ir-sysfs.c +4 -0
@@ -64,6 +64,8 @@ static ssize_t show_protocol(struct device *d, s ="rc6" ; else if (ir_type == IR_TYPE_JVC) s ="jvc" ; + else if (ir_type == IR_TYPE_SONY) + s ="sony" ; else s ="other" ;
@@ -103,6 +105,8 @@ static ssize_t store_protocol(struct device *d, ir_type |=IR_TYPE_NEC ;if (!strcasecmp (buf,"jvc" )) ir_type |=IR_TYPE_JVC ; +if (!strcasecmp (buf,"sony" )) + ir_type |=IR_TYPE_SONY ; }if (!ir_type) {
include/media/rc-map.h +1 -0
@@ -17,6 +17,7 @@#define IR_TYPE_NEC (1 << 2)#define IR_TYPE_RC6 (1 << 3)/* Philips RC6 protocol */ #define IR_TYPE_JVC (1 << 4)/* JVC protocol */ +#define IR_TYPE_SONY (1 << 5)/* Sony12/15/20 protocol */ #define IR_TYPE_OTHER (1u << 31)struct ir_scancode {
PATCH 4/8 ir-core: remove ir-functions usage from dm1105
In reply to David HärdemanConvert drivers/media/dvb/dm1105/dm1105.c to not rely on ir-functions.c.
---
0 files changed, 0 insertions(+), 0 deletions(-)
drivers/media/dvb/dm1105/dm1105.c +7 -12
@@ -27,7 +27,7 @@#include <linux/pci.h> #include <linux/dma-mapping.h> #include <linux/input.h> -#include <media/ir-common.h> +#include <media/ir-core.h> #include "demux.h" #include "dmxdev.h"
@@ -266,7 +266,6 @@ static void dm1105_card_list(struct pci_dev *pci)/* infrared remote control */ struct infrared {struct input_dev *input_dev; -struct ir_input_state ir;char input_phys[32 ];struct work_struct work;u32 ir_command;
@@ -532,8 +531,7 @@ static void dm1105_emit_key(struct work_struct *work) data = (ircom >>8 ) &0x7f ; -ir_input_keydown (ir->input_dev, &ir->ir, data); -ir_input_nokey (ir->input_dev, &ir->ir); +ir_keydown (ir->input_dev, data,0 ); }/* work handler */
@@ -596,7 +594,6 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) {struct input_dev *input_dev;char *ir_codes =NULL ; -u64 ir_type =IR_TYPE_OTHER ;int err = -ENOMEM ; input_dev =input_allocate_device ();
@@ -607,12 +604,6 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105)snprintf (dm1105->ir.input_phys,sizeof (dm1105->ir.input_phys),"pci-%s/ir0" ,pci_name (dm1105->pdev)); - err =ir_input_init (input_dev, &dm1105->ir.ir, ir_type); -if (err <0 ) { -input_free_device (input_dev); -return err; - } - input_dev->name ="DVB on-card IR receiver" ; input_dev->phys = dm1105->ir.input_phys; input_dev->id.bustype =BUS_PCI ;
@@ -630,8 +621,12 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105)INIT_WORK (&dm1105->ir.work, dm1105_emit_key); err =ir_input_register (input_dev, ir_codes,NULL ,MODULE_NAME ); +if (err <0 ) { +input_free_device (input_dev); +return err; + } -return err; +return 0 ; } void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105)
PATCH 5/8 ir-core: convert mantis from ir-functions.c
In reply to David HärdemanConvert drivers/media/dvb/mantis/mantis_input.c to not use ir-functions.c (The driver is anyway not complete enough to actually use the subsystem yet).
---
0 files changed, 0 insertions(+), 0 deletions(-)
drivers/media/dvb/mantis/mantis_input.c +1 -4
@@ -19,7 +19,7 @@*/ #include <linux/input.h> -#include <media/ir-common.h> +#include <media/ir-core.h> #include <linux/pci.h> #include "dmxdev.h"
@@ -104,7 +104,6 @@ EXPORT_SYMBOL_GPL(ir_mantis);int mantis_input_init (struct mantis_pci *mantis) {struct input_dev *rc; -struct ir_input_state rc_state;char name[80 ], dev[80 ];int err;
@@ -120,8 +119,6 @@ int mantis_input_init(struct mantis_pci *mantis) rc->name = name; rc->phys = dev; -ir_input_init (rc, &rc_state,IR_TYPE_OTHER ); - rc->id.bustype =BUS_PCI ; rc->id.vendor = mantis->vendor_id; rc->id.product = mantis->device_id;
Re: [PATCH 5/8] ir-core: convert mantis from ir-functions.c
Quoted 2 lines · David Härdeman
Convert
drivers/media/dvb/mantis/mantis_input.cto not useir-functions.c(The driver is anyway not complete enough to actually use the subsystem yet).
Huh ? I don't follow what you imply here ..
--
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-core: convert mantis from ir-functions.c
Quoted 6 lines · Manu Abraham
Quoted 2 lines · David Härdeman
Convert
drivers/media/dvb/mantis/mantis_input.cto not useir-functions.c(The driver is anyway not complete enough to actually use the subsystem yet).Huh ? I don't follow what you imply here ..
The mantis_input.c file seems to be a skeleton as far as I could tell...not actually in use yet. Or am I mistaken?
Signature · 1 line
David Härdeman
Re: [PATCH 5/8] ir-core: convert mantis from ir-functions.c
Quoted 10 lines · David Härdeman
Quoted 6 lines · Manu Abraham
Quoted 2 lines · David Härdeman
Convert
drivers/media/dvb/mantis/mantis_input.cto not useir-functions.c(The driver is anyway not complete enough to actually use the subsystem yet).Huh ? I don't follow what you imply here ..
The
mantis_input.cfile seems to be a skeleton as far as I could tell...not actually in use yet. Or am I mistaken?
Only the input related parts of the IR stuff is there in mantis_input.c, the hardware handling is done by mantis_uart.c/h. There is a small bit which has not gone upstream yet, which is pending;
http://jusst.de/hg/mantis-v4l-dvb/rev/ad8b00c9edc2
--
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-core: convert mantis from ir-functions.c
Quoted 9 lines · Manu Abraham
Quoted 8 lines · David Härdeman
Quoted 6 lines · Manu Abraham
Quoted 2 lines · David Härdeman
Convert
drivers/media/dvb/mantis/mantis_input.cto not useir-functions.c(The driver is anyway not complete enough to actually use the subsystem yet).Huh ? I don't follow what you imply here ..
Quoted 9 lines
Quoted 2 lines
The
mantis_input.cfile seems to be a skeleton as far as I could tell...not actually in use yet. Or am I mistaken?Only the input related parts of the IR stuff is there in
mantis_input.c, the hardware handling is done by mantis_uart.c/h. There is a small bit which has not gone upstream yet, which is pending;
http://jusst.de/hg/mantis-v4l-dvb/rev/ad8b00c9edc2
Yes, and that patch includes actually calling mantis_input_init(), which wasn't called previously, so mantis_input.c wasn't actually in use.
Anyways, my patch still applies (or the principle at least) - use the functionality of ir-core and not ir-functions.c (which is going away).
And on a related note, the above patch adds keytables with entries like KEY_0, they should probably be KEY_NUMERIC_* instead.
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
PATCH 6/8 ir-core: fix double spinlock init in drivers/media/IR/rc-map.c
In reply to David HärdemanFix a double initialization of the same spinlock in drivers/media/IR/rc-map.c.
--- drivers/media/IR/ir-sysfs.c | 2 -- drivers/media/IR/rc-map.c | 5 ----- 2 files changed, 0 insertions(+), 7 deletions(-)
drivers/media/IR/ir-sysfs.c +0 -2
@@ -294,8 +294,6 @@ static int __init ir_core_init(void)/* Initialize/load the decoders/keymap code that will be used */ ir_raw_init (); -rc_map_init (); -return 0 ; }
drivers/media/IR/rc-map.c +0 -5
@@ -81,8 +81,3 @@ void ir_unregister_map(struct rc_keymap *map) }EXPORT_SYMBOL_GPL (ir_unregister_map); -void rc_map_init (void ) -{ -spin_lock_init (&rc_map_lock); - -}
--
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
PATCH 7/8 ir-core: fix table resize during keymap init
In reply to David Härdemandrivers/media/IR/ir-keytable.c would alloc a suitably sized keymap table only to have it resized as it is populated with the initial keymap.
--- drivers/media/IR/ir-keytable.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/media/IR/ir-keytable.c +6 -4
@@ -77,6 +77,7 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab)* @rc_tab: the struct ir_scancode_table to set the keycode in * @scancode: the scancode for the ir command * @keycode: the keycode for the ir command +* @resize: whether the keytable may be shrunk * @return: -EINVAL if the keycode could not be inserted, otherwise zero. * * This routine is used internally to manipulate the scancode->keycode table.
@@ -84,7 +85,8 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab)*/ static int ir_do_setkeycode (struct input_dev *dev,struct ir_scancode_table *rc_tab, -int scancode,int keycode) +int scancode,int keycode, +bool resize) {unsigned int i;int old_keycode =KEY_RESERVED ;
@@ -128,7 +130,7 @@ static int ir_do_setkeycode(struct input_dev *dev,if (old_keycode ==KEY_RESERVED ) {/* No previous mapping found, we might need to grow the table */ -if (ir_resize_table (rc_tab)) +if (resize &&ir_resize_table (rc_tab))return -ENOMEM ; IR_dprintk(1, "#%d: New scan 0x%04x with key 0x%04x\n",
@@ -176,7 +178,7 @@ static int ir_setkeycode(struct input_dev *dev,struct ir_scancode_table *rc_tab = &ir_dev->rc_tab;spin_lock_irqsave (&rc_tab->lock, flags); - rc =ir_do_setkeycode (dev, rc_tab, scancode, keycode); + rc =ir_do_setkeycode (dev, rc_tab, scancode, keycode, true);spin_unlock_irqrestore (&rc_tab->lock, flags);return rc; }
@@ -203,7 +205,7 @@ static int ir_setkeytable(struct input_dev *dev,spin_lock_irqsave (&rc_tab->lock, flags);for (i =0 ; i < from->size; i++) { rc =ir_do_setkeycode (dev, to, from->scan[i].scancode, - from->scan[i].keycode); + from->scan[i].keycode, false);if (rc)break ; }
PATCH 8/8 ir-core: fix some confusing comments
In reply to David HärdemanFix some confusing comments in drivers/media/IR/*
--- drivers/media/IR/ir-keytable.c | 2 +- drivers/media/IR/ir-sysfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/IR/ir-keytable.c +1 -1
@@ -1,4 +1,4 @@ -/* ir-register.c - handle IR scancode->keycode tables +/* ir-keytable.c - handle IR scancode->keycode tables * * Copyright (C) 2009 by Mauro Carvalho Chehab <[email protected]> *
drivers/media/IR/ir-sysfs.c +1 -1
@@ -1,4 +1,4 @@ -/* ir-register.c - handle IR scancode->keycode tables +/* ir-sysfs.c - sysfs interface for RC devices (/sys/class/rc) * * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <[email protected]> *
Quoted 4 lines · David Härdeman
The following series implements the suggested change to ir-core to use a 1:31 struct for pulse/space durations, adds two new raw decoders, converts two users of ir-functions to plain ir-core and fixes a few small bugs in ir-core.
Sorry about the subject of this mail...missed filling in that field :)
--
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