diff options
author | Sean Young <sean@mess.org> | 2017-09-24 12:43:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-12-14 10:35:22 -0500 |
commit | 62d6f1994b41b9210b07ca453372797f59141e5c (patch) | |
tree | 19e74a7c53757d9438817c2d061df306e458c048 | |
parent | 7d402db89b5b6d3ca5128937dc04653df8668978 (diff) |
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>
-rw-r--r-- | drivers/media/rc/ir-lirc-codec.c | 19 | ||||
-rw-r--r-- | drivers/media/rc/lirc_dev.c | 5 | ||||
-rw-r--r-- | drivers/media/rc/rc-main.c | 6 |
3 files changed, 22 insertions, 8 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, | |||
304 | 304 | ||
305 | switch (cmd) { | 305 | switch (cmd) { |
306 | case LIRC_GET_FEATURES: | 306 | case LIRC_GET_FEATURES: |
307 | if (dev->driver_type == RC_DRIVER_SCANCODE) | ||
308 | val |= LIRC_CAN_REC_SCANCODE; | ||
309 | |||
307 | if (dev->driver_type == RC_DRIVER_IR_RAW) { | 310 | if (dev->driver_type == RC_DRIVER_IR_RAW) { |
308 | val |= LIRC_CAN_REC_MODE2 | LIRC_CAN_REC_SCANCODE; | 311 | val |= LIRC_CAN_REC_MODE2 | LIRC_CAN_REC_SCANCODE; |
309 | if (dev->rx_resolution) | 312 | if (dev->rx_resolution) |
@@ -344,11 +347,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, | |||
344 | break; | 347 | break; |
345 | 348 | ||
346 | case LIRC_SET_REC_MODE: | 349 | case LIRC_SET_REC_MODE: |
347 | if (dev->driver_type == RC_DRIVER_IR_RAW_TX) | 350 | switch (dev->driver_type) { |
351 | case RC_DRIVER_IR_RAW_TX: | ||
348 | return -ENOTTY; | 352 | return -ENOTTY; |
349 | 353 | case RC_DRIVER_SCANCODE: | |
350 | if (!(val == LIRC_MODE_MODE2 || val == LIRC_MODE_SCANCODE)) | 354 | if (val != LIRC_MODE_SCANCODE) |
351 | return -EINVAL; | 355 | return -EINVAL; |
356 | break; | ||
357 | case RC_DRIVER_IR_RAW: | ||
358 | if (!(val == LIRC_MODE_MODE2 || | ||
359 | val == LIRC_MODE_SCANCODE)) | ||
360 | return -EINVAL; | ||
361 | break; | ||
362 | } | ||
352 | 363 | ||
353 | dev->rec_mode = val; | 364 | dev->rec_mode = val; |
354 | return 0; | 365 | return 0; |
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index d766abcffeac..2a0c48698309 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c | |||
@@ -57,7 +57,10 @@ int ir_lirc_register(struct rc_dev *dev) | |||
57 | dev->lirc_dev.release = lirc_release_device; | 57 | dev->lirc_dev.release = lirc_release_device; |
58 | dev->send_mode = LIRC_MODE_PULSE; | 58 | dev->send_mode = LIRC_MODE_PULSE; |
59 | 59 | ||
60 | dev->rec_mode = LIRC_MODE_MODE2; | 60 | if (dev->driver_type == RC_DRIVER_SCANCODE) |
61 | dev->rec_mode = LIRC_MODE_SCANCODE; | ||
62 | else | ||
63 | dev->rec_mode = LIRC_MODE_MODE2; | ||
61 | 64 | ||
62 | if (dev->driver_type == RC_DRIVER_IR_RAW) { | 65 | if (dev->driver_type == RC_DRIVER_IR_RAW) { |
63 | if (kfifo_alloc(&dev->rawir, MAX_IR_EVENT_SIZE, GFP_KERNEL)) | 66 | if (kfifo_alloc(&dev->rawir, MAX_IR_EVENT_SIZE, GFP_KERNEL)) |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 058807bc80dc..5830cb2c5943 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -1814,7 +1814,7 @@ int rc_register_device(struct rc_dev *dev) | |||
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | /* Ensure that the lirc kfifo is setup before we start the thread */ | 1816 | /* Ensure that the lirc kfifo is setup before we start the thread */ |
1817 | if (dev->driver_type != RC_DRIVER_SCANCODE) { | 1817 | if (dev->allowed_protocols != RC_PROTO_BIT_CEC) { |
1818 | rc = ir_lirc_register(dev); | 1818 | rc = ir_lirc_register(dev); |
1819 | if (rc < 0) | 1819 | if (rc < 0) |
1820 | goto out_rx; | 1820 | goto out_rx; |
@@ -1835,7 +1835,7 @@ int rc_register_device(struct rc_dev *dev) | |||
1835 | return 0; | 1835 | return 0; |
1836 | 1836 | ||
1837 | out_lirc: | 1837 | out_lirc: |
1838 | if (dev->driver_type != RC_DRIVER_SCANCODE) | 1838 | if (dev->allowed_protocols != RC_PROTO_BIT_CEC) |
1839 | ir_lirc_unregister(dev); | 1839 | ir_lirc_unregister(dev); |
1840 | out_rx: | 1840 | out_rx: |
1841 | rc_free_rx_device(dev); | 1841 | rc_free_rx_device(dev); |
@@ -1898,7 +1898,7 @@ void rc_unregister_device(struct rc_dev *dev) | |||
1898 | * lirc device should be freed with dev->registered = false, so | 1898 | * lirc device should be freed with dev->registered = false, so |
1899 | * that userspace polling will get notified. | 1899 | * that userspace polling will get notified. |
1900 | */ | 1900 | */ |
1901 | if (dev->driver_type != RC_DRIVER_SCANCODE) | 1901 | if (dev->allowed_protocols != RC_PROTO_BIT_CEC) |
1902 | ir_lirc_unregister(dev); | 1902 | ir_lirc_unregister(dev); |
1903 | 1903 | ||
1904 | device_del(&dev->dev); | 1904 | device_del(&dev->dev); |