From patchwork Wed Jan 26 02:00:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 507671 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0Q4lFMK023501 for ; Wed, 26 Jan 2011 04:47:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732Ab1AZCAP (ORCPT ); Tue, 25 Jan 2011 21:00:15 -0500 Received: from mail-gw0-f46.google.com ([74.125.83.46]:64333 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654Ab1AZCAM (ORCPT ); Tue, 25 Jan 2011 21:00:12 -0500 Received: by gwj20 with SMTP id 20so1960053gwj.19 for ; Tue, 25 Jan 2011 18:00:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=z4SafYsF8LgE99++qVEyp8ylRj3JoC81itud540MYcQ=; b=W3/C4xdovYzp8GR31lXVHvv+tDyJ7AnGjA2bDm95XW9lRdwm1WhoGX/M32lVpaivjL V7NC/LqEtoMbhp92Kf+tmkQ5BhIW5b6nCgGiCyo+4b1MSptfJ/xEjOJy/KL2/Ik6w6/y 43tnqr2G8j3OEcOQLlGby1nC0AHOizNcGT6lA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=OllnSP/0IfZSopwxnSAHYE7Wq94zYibxotm0ON2GUrdMJpi+2O5TPjJ/ehj/CIQktj fTkOE8ryD6L9PzM8psGEByCVXjtjbhVnJhYUBIXaf5/zUpuecaoEXUzn1lZbnM/OdHdc Qa4ImoSDFc1zmwqizx28B3i99pY5YJTrfhUBA= Received: by 10.151.60.17 with SMTP id n17mr394606ybk.351.1296007211772; Tue, 25 Jan 2011 18:00:11 -0800 (PST) Received: from mailhub.coreip.homeip.net (c-98-234-113-65.hsd1.ca.comcast.net [98.234.113.65]) by mx.google.com with ESMTPS id v4sm9861986ybe.5.2011.01.25.18.00.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Jan 2011 18:00:09 -0800 (PST) Date: Tue, 25 Jan 2011 18:00:03 -0800 From: Dmitry Torokhov To: Mark Lord Cc: Mauro Carvalho Chehab , Linus Torvalds , Linux Kernel , linux-input@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: 2.6.36/2.6.37: broken compatibility with userspace input-utils ? Message-ID: <20110126020003.GA23085@core.coreip.homeip.net> References: <4D3E59CA.6070107@teksavvy.com> <4D3E5A91.30207@teksavvy.com> <20110125053117.GD7850@core.coreip.homeip.net> <4D3EB734.5090100@redhat.com> <20110125164803.GA19701@core.coreip.homeip.net> <20110125205453.GA19896@core.coreip.homeip.net> <4D3F4804.6070508@redhat.com> <4D3F4D11.9040302@teksavvy.com> <20110125232914.GA20130@core.coreip.homeip.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110125232914.GA20130@core.coreip.homeip.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 26 Jan 2011 04:47:18 +0000 (UTC) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index f60107c..c4645d7 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -374,21 +374,27 @@ static int ir_getkeycode(struct input_dev *dev, index = ir_lookup_by_scancode(rc_tab, scancode); } - if (index >= rc_tab->len) { - if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) - IR_dprintk(1, "unknown key for scancode 0x%04x\n", - scancode); + if (index < rc_tab->len) { + entry = &rc_tab->scan[index]; + + ke->index = index; + ke->keycode = entry->keycode; + ke->len = sizeof(entry->scancode); + memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); + + } else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) { + /* + * We do not really know the valid range of scancodes + * so let's respond with KEY_RESERVED to anything we + * do not have mapping for [yet]. + */ + ke->index = index; + ke->keycode = KEY_RESERVED; + } else { retval = -EINVAL; goto out; } - entry = &rc_tab->scan[index]; - - ke->index = index; - ke->keycode = entry->keycode; - ke->len = sizeof(entry->scancode); - memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); - retval = 0; out: