Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757599Ab0LBRaa (ORCPT ); Thu, 2 Dec 2010 12:30:30 -0500 Received: from casper.infradead.org ([85.118.1.10]:48163 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752830Ab0LBRa2 (ORCPT ); Thu, 2 Dec 2010 12:30:28 -0500 Message-ID: <4CF7D7A0.7050607@infradead.org> Date: Thu, 02 Dec 2010 15:30:08 -0200 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100827 Red Hat/3.1.3-1.el6 Lightning/1.0b2 Thunderbird/3.1.3 MIME-Version: 1.0 To: James Hogan CC: Andy Walls , =?UTF-8?B?RGF2aWQgSMOkcmRlbWFu?= , Jarod Wilson , Maxim Levitsky , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Dmitry Torokhov Subject: Re: [PATCH] ir-nec-decoder: fix extended NEC scancodes References: <7m5j914h31hev0dqkj085vd7.1290777731791@email.android.com> <20101126211213.GA21473@gandalf> In-Reply-To: <20101126211213.GA21473@gandalf> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3492 Lines: 91 Em 26-11-2010 19:12, James Hogan escreveu: > (expanded cc list) > > On Fri, Nov 26, 2010 at 08:39:25AM -0500, Andy Walls wrote: >> You might want to check the handling against this NEC datasheet >> >> http://www.datasheetcatalog.org/datasheet/nec/UPD6122G-002.pdf >> >> The datasheet calls the address bytes "custom code" (high byte apparently) and "custom code'" (low byte apparently) with both bytes sent lsb first. It appears the high byte is sent first when using 16 bit codes. > > Thanks for the link Andy. You appear to be correct, which suggests that > winbond-cir is the "wrong" one. Curiously there is a comment in > winbond-cir.c which explicitly mentions which byte is which: > > 854 * With NEC extended, Address1 is the LSB of the Address and > 855 * Address2 is the MSB, Command parsing remains unchanged. > > but then it also says: > > 25 * To do: > 26 * o Test NEC and RC5 > > I suppose its all a matter of convention, but I think they should at > least be consistent, so I'll go by the NEC datasheet and submit a patch > to winbond-cir instead. Yes, they should be consistent. I also think that RC core is right. So, the better is to change it at winbond-cir. > > Cheers > James > >> James Hogan wrote: >> >>> Could somebody check this as I'm unable to test it. >>> >>> I'm also not entirely certain it isn't winbond-cir that is in error >>> instead of ir-nec-decoder. >>> >>> Cheers >>> James >>> -- >>> After comparing the extended NEC scancode construction of the software >>> decoder and winbond-cir it appears the software decoder is putting the >>> two address bytes the wrong way around. >>> >>> Here's how the decoders currently generate scancodes: >>> winbond-cir normal NEC: msb [ 0x0, 0x0, addr, cmd ] lsb >>> soft normal NEC: msb [ 0x0, 0x0, addr, cmd ] lsb >>> winbond-cir extended NEC: msb [ 0x0, not_addr, addr, cmd ] lsb >>> soft extended NEC: msb [ 0x0, addr, not_addr, cmd ] lsb >>> >>> The soft decider is not consistent with [1], assuming the "Address high" >>> byte (not_addr) should be more significant than the "Address low" byte >>> (addr) in the scancode. >>> >>> [1] http://www.sbprojects.com/knowledge/ir/nec.htm >>> >>> Signed-off-by: James Hogan >>> --- >>> drivers/media/IR/ir-nec-decoder.c | 4 ++-- >>> 1 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/media/IR/ir-nec-decoder.c >>> b/drivers/media/IR/ir-nec-decoder.c >>> index 70993f7..11d3e78 100644 >>> --- a/drivers/media/IR/ir-nec-decoder.c >>> +++ b/drivers/media/IR/ir-nec-decoder.c >>> @@ -166,8 +166,8 @@ static int ir_nec_decode(struct input_dev >>> *input_dev, struct ir_raw_event ev) >>> >>> if ((address ^ not_address) != 0xff) { >>> /* Extended NEC */ >>> - scancode = address << 16 | >>> - not_address << 8 | >>> + scancode = not_address << 16 | >>> + address << 8 | >>> command; >>> IR_dprintk(1, "NEC (Ext) scancode 0x%06x\n", scancode); >>> } else { > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/