Reporting pulse/space events via the /dev/rc/rcX device node is an
important step towards having feature parity with LIRC.

Signed-off-by: David Härdeman <da...@hardeman.nu>
---
 drivers/media/rc/rc-ir-raw.c |   11 +++++++++++
 include/media/rc-core.h      |   10 ++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 88a2932..e6a6eea 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -73,6 +73,17 @@ int ir_raw_event_store(struct rc_dev *dev, struct 
ir_raw_event *ev)
        IR_dprintk(2, "sample: (%05dus %s)\n",
                   TO_US(ev->duration), TO_STR(ev->pulse));
 
+       if (ev->reset)
+               rc_event(dev, RC_IR_RAW, RC_IR_RAW_RESET, 1);
+       else if (ev->carrier_report)
+               rc_event(dev, RC_IR_RAW, RC_IR_RAW_CARRIER, ev->carrier);
+       else if (ev->timeout)
+               rc_event(dev, RC_IR_RAW, RC_IR_RAW_STOP, 1);
+       else if (ev->pulse)
+               rc_event(dev, RC_IR_RAW, RC_IR_RAW_PULSE, ev->duration);
+       else
+               rc_event(dev, RC_IR_RAW, RC_IR_RAW_SPACE, ev->duration);
+
        if (kfifo_in(&dev->raw->kfifo, ev, 1) != 1)
                return -ENOMEM;
 
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index ab9a72e..f2ff7f7 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -378,6 +378,7 @@ struct rc_keytable {
 #define RC_DEBUG               0x0
 #define RC_CORE                        0x1
 #define RC_KEY                 0x2
+#define RC_IR_RAW              0x3
 
 /* RC_CORE codes */
 #define RC_CORE_DROPPED                0x0
@@ -388,6 +389,15 @@ struct rc_keytable {
 #define RC_KEY_SCANCODE                0x2
 #define RC_KEY_TOGGLE          0x3
 
+/* RC_IR_RAW codes */
+#define RC_IR_RAW_SPACE                0x0
+#define RC_IR_RAW_PULSE                0x1
+#define RC_IR_RAW_START                0x2
+#define RC_IR_RAW_STOP         0x3
+#define RC_IR_RAW_RESET                0x4
+#define RC_IR_RAW_CARRIER      0x5
+#define RC_IR_RAW_DUTY_CYCLE   0x6
+
 /**
  * struct rc_event - used to communicate rc events to userspace
  * @type:      the event type

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to