alternative shortcuts; cd cinelerra-5.1; patch -p1 -i alt_shortcuts.patch
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / em28xx-input.patch1
1 diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
2 index 5aa15a7..a27a621 100644
3 --- a/drivers/media/usb/em28xx/em28xx-input.c
4 +++ b/drivers/media/usb/em28xx/em28xx-input.c
5 @@ -63,8 +63,10 @@ struct em28xx_IR {
6  
7         /* poll decoder */
8         int polling;
9 +       int keypressed;
10         struct delayed_work work;
11         unsigned int full_code:1;
12 +       unsigned int last_toggle_bit;
13         unsigned int last_readcount;
14         u64 rc_proto;
15  
16 @@ -331,8 +333,34 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
17                 dprintk("ir->get_key() failed: %d\n", result);
18                 return;
19         }
20 -
21 -       if (unlikely(poll_result.read_count != ir->last_readcount)) {
22 +       if (ir->dev->model == EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595) {
23 +               if (likely(poll_result.toggle_bit == ir->last_toggle_bit &&
24 +                          poll_result.read_count == ir->last_readcount))
25 +                       return;
26 +               dprintk("%s: toggle: %d, count: %d, key 0x%04x\n", __func__,
27 +                       poll_result.toggle_bit, poll_result.read_count,
28 +                       poll_result.scancode);
29 +               ir->rc->input_dev->evbit[0] &= ~BIT_MASK(EV_REP);
30 +               if( poll_result.read_count & 1 ) {
31 +                       if (!ir->keypressed) {
32 +                               ir->keypressed = true;
33 +                               if( poll_result.toggle_bit == ir->last_toggle_bit )
34 +                                       return;
35 +                               ir->rc->keypressed = false;
36 +                               rc_keydown_notimeout(ir->rc,
37 +                                       poll_result.protocol,
38 +                                       poll_result.scancode,
39 +                                       poll_result.toggle_bit);
40 +                               ir->rc->keypressed = false;
41 +                       }
42 +               }
43 +               else if (ir->keypressed) {
44 +                       ir->keypressed = false;
45 +                       ir->rc->keypressed = true;
46 +                       rc_keyup(ir->rc);
47 +               }
48 +       }
49 +       else if (unlikely(poll_result.read_count != ir->last_readcount)) {
50                 dprintk("%s: toggle: %d, count: %d, key 0x%04x\n", __func__,
51                         poll_result.toggle_bit, poll_result.read_count,
52                         poll_result.scancode);
53 @@ -357,10 +385,11 @@ static void em28xx_ir_handle_key(struct em28xx_IR *ir)
54                          * non-zero read count as opposed to a readcount
55                          * that is incrementing
56                          */
57 -                       ir->last_readcount = 0;
58 -               else
59 -                       ir->last_readcount = poll_result.read_count;
60 +                       poll_result.read_count = 0;
61         }
62 +
63 +       ir->last_toggle_bit = poll_result.toggle_bit;
64 +       ir->last_readcount = poll_result.read_count;
65  }
66  
67  static void em28xx_ir_work(struct work_struct *work)