From 07e9293c188dbfff4617b0ac5bb56ad5478d33a5 Mon Sep 17 00:00:00 2001 From: Sean Young Date: Fri, 2 Dec 2016 15:16:09 -0200 Subject: [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 Reviewed-by: Andi Shyti Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ir-lirc-codec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/media/rc') 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; -- cgit v1.2.3