As an example, this patch adds support for the new RCIOCGIRRX ioctl
to rc-loopback.

Signed-off-by: David Härdeman <da...@hardeman.nu>
---
 drivers/media/rc/rc-loopback.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index 2ae1b5a..ba36fbe 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -204,6 +204,31 @@ static int loop_set_ir_rx(struct rc_dev *dev, struct 
rc_ir_rx *rx)
        return 0;
 }
 
+/**
+ * loop_get_ir_tx() - returns the current TX settings
+ * @dev: the &struct rc_dev to get the settings for
+ * @tx: the &struct rc_ir_tx to fill in with the current settings
+ *
+ * This function is used to return the current TX settings.
+ */
+static void loop_get_ir_tx(struct rc_dev *dev, struct rc_ir_tx *tx)
+{
+       struct loopback_dev *lodev = dev->priv;
+
+       tx->tx_supported = RXMASK_REGULAR | RXMASK_LEARNING;
+       tx->tx_connected = RXMASK_REGULAR | RXMASK_LEARNING;
+       tx->tx_enabled = lodev->txmask;
+       tx->freq = lodev->txcarrier;
+       tx->freq_min = 1;
+       tx->freq_max = UINT_MAX;
+       tx->duty = lodev->txduty;
+       tx->duty_min = 1;
+       tx->duty_max = 99;
+       tx->resolution = 1;
+       tx->resolution_min = 1;
+       tx->resolution_max = 1;
+}
+
 static int __init loop_init(void)
 {
        struct rc_dev *rc;
@@ -236,6 +261,7 @@ static int __init loop_init(void)
        rc->s_idle              = loop_set_idle;
        rc->get_ir_rx           = loop_get_ir_rx;
        rc->set_ir_rx           = loop_set_ir_rx;
+       rc->get_ir_tx           = loop_get_ir_tx;
 
        loopdev.txmask          = RXMASK_REGULAR;
        loopdev.txcarrier       = 36000;

--
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