Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

media: lirc: use the correct carrier for scancode transmit



If the lirc device supports it, set the carrier for the protocol.

Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 9b619258
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ static struct ir_raw_handler jvc_handler = {
	.protocols	= RC_PROTO_BIT_JVC,
	.decode		= ir_jvc_decode,
	.encode		= ir_jvc_encode,
	.carrier	= 38000,
};

static int __init ir_jvc_decode_init(void)
+18 −11
Original line number Diff line number Diff line
@@ -122,6 +122,17 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
	if (!lirc)
		return -EFAULT;

	dev = lirc->dev;
	if (!dev) {
		ret = -EFAULT;
		goto out;
	}

	if (!dev->tx_ir) {
		ret = -EINVAL;
		goto out;
	}

	if (lirc->send_mode == LIRC_MODE_SCANCODE) {
		struct lirc_scancode scan;

@@ -154,6 +165,13 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
		for (i = 0; i < count; i++)
			/* Convert from NS to US */
			txbuf[i] = DIV_ROUND_UP(raw[i].duration, 1000);

		if (dev->s_tx_carrier) {
			int carrier = ir_raw_encode_carrier(scan.rc_proto);

			if (carrier > 0)
				dev->s_tx_carrier(dev, carrier);
		}
	} else {
		if (n < sizeof(unsigned int) || n % sizeof(unsigned int))
			return -EINVAL;
@@ -167,17 +185,6 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
			return PTR_ERR(txbuf);
	}

	dev = lirc->dev;
	if (!dev) {
		ret = -EFAULT;
		goto out;
	}

	if (!dev->tx_ir) {
		ret = -EINVAL;
		goto out;
	}

	for (i = 0; i < count; i++) {
		if (txbuf[i] > IR_MAX_DURATION / 1000 - duration || !txbuf[i]) {
			ret = -EINVAL;
+1 −0
Original line number Diff line number Diff line
@@ -473,6 +473,7 @@ static struct ir_raw_handler mce_kbd_handler = {
	.encode		= ir_mce_kbd_encode,
	.raw_register	= ir_mce_kbd_register,
	.raw_unregister	= ir_mce_kbd_unregister,
	.carrier	= 36000,
};

static int __init ir_mce_kbd_decode_init(void)
+1 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@ static struct ir_raw_handler nec_handler = {
							RC_PROTO_BIT_NEC32,
	.decode		= ir_nec_decode,
	.encode		= ir_nec_encode,
	.carrier	= 38000,
};

static int __init ir_nec_decode_init(void)
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ static struct ir_raw_handler rc5_handler = {
							RC_PROTO_BIT_RC5_SZ,
	.decode		= ir_rc5_decode,
	.encode		= ir_rc5_encode,
	.carrier	= 36000,
};

static int __init ir_rc5_decode_init(void)
Loading