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

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

[media] rc: split nec protocol into its three variants



Currently we do not know what variant (bit length) of the nec protocol
is used, other than from guessing from the length of the scancode. Now
nec will be handled the same way as the sony protocol or the rc6 protocol;
one variant per bit length.

In the future we might want to expose the rc protocol type to userspace
and we don't want to be introducing this world of pain into userspace
too.

Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 00bb8207
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
	case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
		/* Integrated CX23885 IR controller */
		driver_type = RC_DRIVER_IR_RAW;
		allowed_protos = RC_BIT_NEC;
		allowed_protos = RC_BIT_ALL;
		/* The grey Terratec remote with orange buttons */
		rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS;
		break;
+3 −2
Original line number Diff line number Diff line
@@ -144,7 +144,8 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
		scancode = RC_SCANCODE_NECX(addr, cmd);

		if (0 == (gpio & ir->mask_keyup))
			rc_keydown_notimeout(ir->dev, RC_TYPE_NEC, scancode, 0);
			rc_keydown_notimeout(ir->dev, RC_TYPE_NECX, scancode,
									0);
		else
			rc_keyup(ir->dev);

@@ -345,7 +346,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
		 * 002-T mini RC, provided with newer PV hardware
		 */
		ir_codes = RC_MAP_PIXELVIEW_MK12;
		rc_type = RC_BIT_NEC;
		rc_type = RC_BIT_NECX;
		ir->gpio_addr = MO_GP1_IO;
		ir->mask_keyup = 0x80;
		ir->polling = 10; /* ms */
+2 −2
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, enum rc_type *protocol,
	if (data[9] != (unsigned char)(~data[8]))
		return 0;

	*protocol = RC_TYPE_NEC;
	*protocol = RC_TYPE_NECX;
	*scancode = RC_SCANCODE_NECX(data[11] << 8 | data[10], data[9]);
	*toggle = 0;
	return 1;
@@ -1035,7 +1035,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
		dev->init_data.name = "BeholdTV";
		dev->init_data.get_key = get_key_beholdm6xx;
		dev->init_data.ir_codes = RC_MAP_BEHOLD;
		dev->init_data.type = RC_BIT_NEC;
		dev->init_data.type = RC_BIT_NECX;
		info.addr = 0x2d;
		break;
	case SAA7134_BOARD_AVERMEDIA_CARDBUS_501:
+2 −1
Original line number Diff line number Diff line
@@ -203,7 +203,8 @@ static int igorplugusb_probe(struct usb_interface *intf,
	 * This device can only store 36 pulses + spaces, which is not enough
	 * for the NEC protocol and many others.
	 */
	rc->allowed_protocols = RC_BIT_ALL & ~(RC_BIT_NEC | RC_BIT_RC6_6A_20 |
	rc->allowed_protocols = RC_BIT_ALL & ~(RC_BIT_NEC | RC_BIT_NECX |
			RC_BIT_NEC32 | RC_BIT_RC6_6A_20 |
			RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE |
			RC_BIT_SONY20 | RC_BIT_MCE_KBD | RC_BIT_SANYO);

+4 −2
Original line number Diff line number Diff line
@@ -34,19 +34,21 @@ static int img_ir_nec_scancode(int len, u64 raw, u64 enabled_protocols,
				bitrev8(addr_inv) << 16 |
				bitrev8(data)     <<  8 |
				bitrev8(data_inv);
		request->protocol = RC_TYPE_NEC32;
	} else if ((addr_inv ^ addr) != 0xff) {
		/* Extended NEC */
		/* scan encoding: AAaaDD */
		request->scancode = addr     << 16 |
				addr_inv <<  8 |
				data;
		request->protocol = RC_TYPE_NECX;
	} else {
		/* Normal NEC */
		/* scan encoding: AADD */
		request->scancode = addr << 8 |
				data;
	}
		request->protocol = RC_TYPE_NEC;
	}
	return IMG_IR_SCANCODE;
}

@@ -109,7 +111,7 @@ static int img_ir_nec_filter(const struct rc_scancode_filter *in,
 *        http://wiki.altium.com/display/ADOH/NEC+Infrared+Transmission+Protocol
 */
struct img_ir_decoder img_ir_nec = {
	.type = RC_BIT_NEC,
	.type = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32,
	.control = {
		.decoden = 1,
		.code_type = IMG_IR_CODETYPE_PULSEDIST,
Loading