summaryrefslogtreecommitdiff
path: root/drivers/media/rc/ir-lirc-codec.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-09-24 12:43:24 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-14 10:35:22 -0500
commit62d6f1994b41b9210b07ca453372797f59141e5c (patch)
tree19e74a7c53757d9438817c2d061df306e458c048 /drivers/media/rc/ir-lirc-codec.c
parent7d402db89b5b6d3ca5128937dc04653df8668978 (diff)
downloadlwn-62d6f1994b41b9210b07ca453372797f59141e5c.tar.gz
lwn-62d6f1994b41b9210b07ca453372797f59141e5c.zip
media: lirc: scancode rc devices should have a lirc device too
Now that the lirc interface supports scancodes, RC scancode devices can also have a lirc device. The only receiving feature they will have enabled is LIRC_CAN_REC_SCANCODE. Note that CEC devices have no lirc device, since they can be controlled from their /dev/cecN chardev. Signed-off-by: Sean Young <sean@mess.org> 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.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 817258c87b5c..8c5df6e8579e 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -304,6 +304,9 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
switch (cmd) {
case LIRC_GET_FEATURES:
+ if (dev->driver_type == RC_DRIVER_SCANCODE)
+ val |= LIRC_CAN_REC_SCANCODE;
+
if (dev->driver_type == RC_DRIVER_IR_RAW) {
val |= LIRC_CAN_REC_MODE2 | LIRC_CAN_REC_SCANCODE;
if (dev->rx_resolution)
@@ -344,11 +347,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
break;
case LIRC_SET_REC_MODE:
- if (dev->driver_type == RC_DRIVER_IR_RAW_TX)
+ switch (dev->driver_type) {
+ case RC_DRIVER_IR_RAW_TX:
return -ENOTTY;
-
- if (!(val == LIRC_MODE_MODE2 || val == LIRC_MODE_SCANCODE))
- return -EINVAL;
+ case RC_DRIVER_SCANCODE:
+ if (val != LIRC_MODE_SCANCODE)
+ return -EINVAL;
+ break;
+ case RC_DRIVER_IR_RAW:
+ if (!(val == LIRC_MODE_MODE2 ||
+ val == LIRC_MODE_SCANCODE))
+ return -EINVAL;
+ break;
+ }
dev->rec_mode = val;
return 0;