]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
V4L/DVB: cx23885, cx25840: Report the actual length of an IR Rx timeout event
authorAndy Walls <awalls@md.metrocast.net>
Sun, 1 Aug 2010 02:28:37 +0000 (23:28 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 9 Aug 2010 02:42:56 +0000 (23:42 -0300)
Instead of reporting an IR Rx timeout event as a ridiculously
long space, report it as a space of the lenght of the timeout.

This partially fixes operation with LIRC without breaking
interoperation with the in kernel decoders.  The gaps lengths
reported to LIRC are still not real however.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-input.c
drivers/media/video/cx23885/cx23888-ir.c
drivers/media/video/cx25840/cx25840-ir.c

index 3f924e21b9575f7d67d99d71c8585d41828aabfe..252817acc35bc1b8c14cfb77f1a78496f21bc7bb 100644 (file)
 
 static void convert_measurement(u32 x, struct ir_raw_event *y)
 {
-       if (x == V4L2_SUBDEV_IR_PULSE_RX_SEQ_END) {
-               y->pulse = false;
-               y->duration = V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS;
-               return;
-       }
-
        y->pulse = (x & V4L2_SUBDEV_IR_PULSE_LEVEL_MASK) ? true : false;
        y->duration = x & V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS;
 }
index aa07286b8d9ba18a7bc84f32a88f88993b5c59f5..684d23db98a70332e76cfcb43266bb7fc686b84e 100644 (file)
@@ -675,16 +675,18 @@ static int cx23888_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,
        *num = n * sizeof(u32);
 
        for (p = (u32 *) buf, i = 0; i < n; p++, i++) {
+
                if ((*p & FIFO_RXTX_RTO) == FIFO_RXTX_RTO) {
-                       *p = V4L2_SUBDEV_IR_PULSE_RX_SEQ_END;
+                       /* Assume RTO was because of no IR light input */
+                       u = 0;
                        v4l2_dbg(2, ir_888_debug, sd, "rx read: end of rx\n");
-                       continue;
+               } else {
+                       u = (*p & FIFO_RXTX_LVL)
+                                         ? V4L2_SUBDEV_IR_PULSE_LEVEL_MASK : 0;
+                       if (invert)
+                               u = u ? 0 : V4L2_SUBDEV_IR_PULSE_LEVEL_MASK;
                }
 
-               u = (*p & FIFO_RXTX_LVL) ? V4L2_SUBDEV_IR_PULSE_LEVEL_MASK : 0;
-               if (invert)
-                       u = u ? 0 : V4L2_SUBDEV_IR_PULSE_LEVEL_MASK;
-
                v = (u32) pulse_width_count_to_ns((u16) (*p & FIFO_RXTX),
                                                  divider);
                if (v >= V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS)
index 326c2554c05c5a46d1d202c3528ce9d7eab6a826..be23c5b37a2f3ab37df3ce3b8e6350bf881e9bda 100644 (file)
@@ -677,16 +677,18 @@ static int cx25840_ir_rx_read(struct v4l2_subdev *sd, u8 *buf, size_t count,
        *num = n * sizeof(u32);
 
        for (p = (u32 *) buf, i = 0; i < n; p++, i++) {
+
                if ((*p & FIFO_RXTX_RTO) == FIFO_RXTX_RTO) {
-                       *p = V4L2_SUBDEV_IR_PULSE_RX_SEQ_END;
+                       /* Assume RTO was because of no IR light input */
+                       u = 0;
                        v4l2_dbg(2, ir_debug, sd, "rx read: end of rx\n");
-                       continue;
+               } else {
+                       u = (*p & FIFO_RXTX_LVL)
+                                         ? V4L2_SUBDEV_IR_PULSE_LEVEL_MASK : 0;
+                       if (invert)
+                               u = u ? 0 : V4L2_SUBDEV_IR_PULSE_LEVEL_MASK;
                }
 
-               u = (*p & FIFO_RXTX_LVL) ? V4L2_SUBDEV_IR_PULSE_LEVEL_MASK : 0;
-               if (invert)
-                       u = u ? 0 : V4L2_SUBDEV_IR_PULSE_LEVEL_MASK;
-
                v = (u32) pulse_width_count_to_ns((u16) (*p & FIFO_RXTX),
                                                  divider);
                if (v >= V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS)