diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-12 16:46:01 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-29 14:53:33 -0500 |
commit | 0a6b8a851efae71b0a6f2cbf5d40880553dfabaa (patch) | |
tree | 291a745e76e48434ab86f131f7be8b925ed4806a /drivers/media/video/em28xx/em28xx-input.c | |
parent | 91812fa74f29f70a2c3a4bf58f7601f86092794f (diff) |
V4L/DVB (9612): Fix key repetition with HVR-950 IR
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-input.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-input.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index f724cae8b040..159b5c307f25 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c | |||
@@ -67,6 +67,7 @@ struct em28xx_IR { | |||
67 | u32 mask_keycode; | 67 | u32 mask_keycode; |
68 | u32 mask_keydown; | 68 | u32 mask_keydown; |
69 | u32 mask_keyup; | 69 | u32 mask_keyup; |
70 | u32 mask_repeat; | ||
70 | 71 | ||
71 | int (*get_key)(struct em28xx_IR *); | 72 | int (*get_key)(struct em28xx_IR *); |
72 | }; | 73 | }; |
@@ -165,15 +166,17 @@ static int default_polling_getkey(struct em28xx_IR *ir) | |||
165 | { | 166 | { |
166 | struct em28xx *dev = ir->dev; | 167 | struct em28xx *dev = ir->dev; |
167 | int rc; | 168 | int rc; |
168 | u32 msg; | 169 | u8 msg[4] = { 0, 0, 0, 0 }; |
169 | 170 | ||
170 | /* Read key toggle, brand, and key code */ | 171 | /* Read key toggle, brand, and key code |
172 | on registers 0x45, 0x46 and 0x47 | ||
173 | */ | ||
171 | rc = dev->em28xx_read_reg_req_len(dev, 0, EM28XX_R45_IR, | 174 | rc = dev->em28xx_read_reg_req_len(dev, 0, EM28XX_R45_IR, |
172 | (u8 *)&msg, sizeof(msg)); | 175 | msg, sizeof(msg)); |
173 | if (rc < 0) | 176 | if (rc < 0) |
174 | return rc; | 177 | return rc; |
175 | 178 | ||
176 | return (int)(msg & 0x7fffffffl); | 179 | return (int)(le32_to_cpu(*(u32 *)msg)); |
177 | } | 180 | } |
178 | 181 | ||
179 | /********************************************************** | 182 | /********************************************************** |
@@ -192,6 +195,7 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) | |||
192 | 195 | ||
193 | if (gpio == ir->last_gpio) | 196 | if (gpio == ir->last_gpio) |
194 | return; | 197 | return; |
198 | |||
195 | ir->last_gpio = gpio; | 199 | ir->last_gpio = gpio; |
196 | 200 | ||
197 | /* extract data */ | 201 | /* extract data */ |
@@ -214,6 +218,14 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir) | |||
214 | ir_input_keydown(ir->input, &ir->ir, data, data); | 218 | ir_input_keydown(ir->input, &ir->ir, data, data); |
215 | else | 219 | else |
216 | ir_input_nokey(ir->input, &ir->ir); | 220 | ir_input_nokey(ir->input, &ir->ir); |
221 | } else if (ir->mask_repeat) { | ||
222 | int count = ir->mask_repeat & gpio; | ||
223 | |||
224 | /* Avoid keyboard bouncing */ | ||
225 | if ((count == 1) || (count >= 5)) { | ||
226 | ir_input_keydown(ir->input, &ir->ir, data, data); | ||
227 | ir_input_nokey(ir->input, &ir->ir); | ||
228 | } | ||
217 | } else { | 229 | } else { |
218 | /* can't distinguish keydown/up :-/ */ | 230 | /* can't distinguish keydown/up :-/ */ |
219 | ir_input_keydown(ir->input, &ir->ir, data, data); | 231 | ir_input_keydown(ir->input, &ir->ir, data, data); |
@@ -274,6 +286,7 @@ int em28xx_ir_init(struct em28xx *dev) | |||
274 | ir_type = IR_TYPE_OTHER; | 286 | ir_type = IR_TYPE_OTHER; |
275 | ir_codes = ir_codes_hauppauge_new; | 287 | ir_codes = ir_codes_hauppauge_new; |
276 | ir->mask_keycode = 0x007f0000; | 288 | ir->mask_keycode = 0x007f0000; |
289 | ir->mask_repeat = 0x0000007f; | ||
277 | break; | 290 | break; |
278 | } | 291 | } |
279 | 292 | ||