lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20101126213749.GB21473@gandalf>
Date:	Fri, 26 Nov 2010 21:37:49 +0000
From:	James Hogan <james@...anarts.com>
To:	David Härdeman <david@...deman.nu>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] winbond-cir: fix extended NEC scancode encoding

Hi,

This changes the scancode encoding behaviour for extended NEC on
winbond-cir by swapping the address bytes. This makes it consistent with
the software NEC decoder in drivers/media/IR, but changes the scancodes
for extended NEC. Comments in the code suggest NEC wasn't tested, and
I'm not sure if it has any users using extended NEC, so hopefully this
won't be a problem?

Note: i'm not able to test this patch other than compiling it.

Thanks
James
--
Swap the placement of the address bytes in the scancodes for extended
NEC in winbond-cir.

After comparing the extended NEC scancode construction of the software
NEC decoder (in media/IR) and winbond-cir it appears winbond-cir is
putting the two address bytes the wrong way around.

Here's how the decoders previously generated scancodes:
winbond-cir normal NEC:   msb [ 0x0,      0x0, address1, command ] lsb
soft normal NEC:          msb [ 0x0,      0x0, address1, command ] lsb
winbond-cir extended NEC: msb [ 0x0, address2, address1, command ] lsb
soft extended NEC:        msb [ 0x0, address1, address2, command ] lsb

A NEC data sheet [1] describes the first byte (address1) of extended NEC
as 'Higher 8 bits of custom code' and the second byte (address2) as
'Lower 8 bits of custom code'.

[1] http://www.datasheetcatalog.org/datasheet/nec/UPD6122G-002.pdf

Signed-off-by: James Hogan <james@...anarts.com>
---
 drivers/input/misc/winbond-cir.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c
index 64f1de7..01a9069 100644
--- a/drivers/input/misc/winbond-cir.c
+++ b/drivers/input/misc/winbond-cir.c
@@ -851,8 +851,8 @@ wbcir_parse_nec(struct device *dev, struct wbcir_data *data)
 	 * and Command2 was the inverse of Command1 and were used as
 	 * an error check.
 	 *
-	 * With NEC extended, Address1 is the LSB of the Address and
-	 * Address2 is the MSB, Command parsing remains unchanged.
+	 * With NEC extended, Address1 is the MSB of the Address and
+	 * Address2 is the LSB, Command parsing remains unchanged.
 	 *
 	 * A repeat message is coded as:
 	 * Leader		- 9 ms burst
@@ -916,7 +916,7 @@ wbcir_parse_nec(struct device *dev, struct wbcir_data *data)
 	/* Check for extended NEC protocol */
 	address = address1;
 	if (address1 != ~address2)
-		address |= address2 << 8;
+		address = address << 8 | address2;
 
 	scancode = address << 8 | command1;
 
-- 
1.7.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ