summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ir-lirc-codec.c
diff options
context:
space:
mode:
authorSean Young2016-12-02 18:16:09 +0100
committerMauro Carvalho Chehab2017-01-30 14:53:02 +0100
commit07e9293c188dbfff4617b0ac5bb56ad5478d33a5 (patch)
tree027ee7984613a4d4a1fd61729a32365ee55cdee7 /drivers/media/rc/ir-lirc-codec.c
parent[media] lirc_dev: LIRC_{G,S}ET_REC_MODE do not work (diff)
downloadkernel-qcow2-linux-07e9293c188dbfff4617b0ac5bb56ad5478d33a5.tar.gz
kernel-qcow2-linux-07e9293c188dbfff4617b0ac5bb56ad5478d33a5.tar.xz
kernel-qcow2-linux-07e9293c188dbfff4617b0ac5bb56ad5478d33a5.zip
[media] lirc: LIRC_{G,S}ET_SEND_MODE fail if device cannot transmit
These ioctls should not succeed if the device cannot send. Also make it clear that these ioctls should return the lirc mode, although the actual value does not change. Signed-off-by: Sean Young <sean@mess.org> Reviewed-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/ir-lirc-codec.c')
-rw-r--r--drivers/media/rc/ir-lirc-codec.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index c3277308a70b..9e41305ad32e 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -204,11 +204,17 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
/* legacy support */
case LIRC_GET_SEND_MODE:
- val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK;
+ if (!dev->tx_ir)
+ return -ENOTTY;
+
+ val = LIRC_MODE_PULSE;
break;
case LIRC_SET_SEND_MODE:
- if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK))
+ if (!dev->tx_ir)
+ return -ENOTTY;
+
+ if (val != LIRC_MODE_PULSE)
return -EINVAL;
return 0;