Commit 62d6f199 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab
Browse files

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: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7d402db8
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -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))
		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;
+4 −1
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@ int ir_lirc_register(struct rc_dev *dev)
	dev->lirc_dev.release = lirc_release_device;
	dev->send_mode = LIRC_MODE_PULSE;

	if (dev->driver_type == RC_DRIVER_SCANCODE)
		dev->rec_mode = LIRC_MODE_SCANCODE;
	else
		dev->rec_mode = LIRC_MODE_MODE2;

	if (dev->driver_type == RC_DRIVER_IR_RAW) {
+3 −3
Original line number Diff line number Diff line
@@ -1814,7 +1814,7 @@ int rc_register_device(struct rc_dev *dev)
	}

	/* Ensure that the lirc kfifo is setup before we start the thread */
	if (dev->driver_type != RC_DRIVER_SCANCODE) {
	if (dev->allowed_protocols != RC_PROTO_BIT_CEC) {
		rc = ir_lirc_register(dev);
		if (rc < 0)
			goto out_rx;
@@ -1835,7 +1835,7 @@ int rc_register_device(struct rc_dev *dev)
	return 0;

out_lirc:
	if (dev->driver_type != RC_DRIVER_SCANCODE)
	if (dev->allowed_protocols != RC_PROTO_BIT_CEC)
		ir_lirc_unregister(dev);
out_rx:
	rc_free_rx_device(dev);
@@ -1898,7 +1898,7 @@ void rc_unregister_device(struct rc_dev *dev)
	 * lirc device should be freed with dev->registered = false, so
	 * that userspace polling will get notified.
	 */
	if (dev->driver_type != RC_DRIVER_SCANCODE)
	if (dev->allowed_protocols != RC_PROTO_BIT_CEC)
		ir_lirc_unregister(dev);

	device_del(&dev->dev);