From patchwork Fri Jul 29 19:41:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 9252789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 81AE36077C for ; Fri, 29 Jul 2016 19:42:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 728322840B for ; Fri, 29 Jul 2016 19:42:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66F7E2840D; Fri, 29 Jul 2016 19:42:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44CF42840B for ; Fri, 29 Jul 2016 19:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751529AbcG2Tl7 (ORCPT ); Fri, 29 Jul 2016 15:41:59 -0400 Received: from mout.gmx.net ([212.227.15.19]:61904 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbcG2Tl6 (ORCPT ); Fri, 29 Jul 2016 15:41:58 -0400 Received: from ultralex.fritz.box ([31.18.248.238]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0M5cpk-1b4wYc2PZA-00xbZN; Fri, 29 Jul 2016 21:41:54 +0200 From: Oleksij Rempel To: linux-input@vger.kernel.org Cc: Oleksij Rempel , Dmitry Torokhov Subject: [PATCH] Input: atkbd - filter buggy codes on ASUS Q500A Date: Fri, 29 Jul 2016 21:41:44 +0200 Message-Id: <1469821304-30255-1-git-send-email-linux@rempel-privat.de> X-Mailer: git-send-email 2.7.4 X-Provags-ID: V03:K0:KZLUVke2eKB4CMy0k2vw69yH6Gp2E604vPjkrwrooLUXwWDjQOO lDw9TH7NTtjAW9+d+WygwLiuaxG36XtJW81qoEuZRwLCO7WU4DeFPWXORSJUoonV6j+r+cH gwF59xWrUZSDusNsHvK61/f8om2XxLUizX9aqwrOAVjeK0Dn/zR4kubTxQjemLR2ZZj0dlX BKm07o18i+FQ9Pc85X1dQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:TZgyT+oH9EQ=:vxf//ci1vEt7uSL1oruvRf zfMGjgGOe4/3WYXJ9EuEYyazzL57jXYadJ3AFERIiPxIiCMtyOC3Byj85CEwkQ9noPNxlExPS iki5+HCxuDr8c+xRwhFf7+vII+hac+36HmpTzEbKpD7CY8nNrGk9jpy9TYvZ3IuhAQErpkMmp z+A/UG8v3nbh19snI3ZbN67hrWV/yDL2U7aiuUvF3jEkNzS1gBK5avLd8xCdDcfWtAQVawY5H B0nkUnxkBnVZp4r9YDfS4mfOCBzVzt1Or/sZ3f4OLFKPFWphWGjpR6O+iIt07wLSrydb0vmnk EE22syS69/B4JBNJz9wYFKSJdRii0YHjGWUTuE4+ZoJwH5ed/j0j1vdlslLNp2Q/6OyNivkQG zdVi20kUDGU2wF6fZXR3loJe3oHgID1OUwZnSR/gkrNQWKC2rPTivG/Y8aZ/H5LqL2AselPH6 hM/h6wfdjDo+tmiVeTwSL5TkblPt10ijoFuK43aTQFtPUFkibXS3VAIoZJamEeY+0TZWagpaZ 7TUj3ZaOsxrAeni7k3Fb2HyfeeQPm0P1wKi8zWPO/2PfTEV0tiyhxyLg6PBx55H72f60JJcfE XxbBRyYoes0VcFm3922yyoV4bPBX0Jmyr0G17BuQG01BC1pU4CB/mE3Lbz4RPg2xsWbmyCD1A VfPc8i0oL6OJwypfx3ugSS4R/osg2RK3OfakPgXKWKn+cCkTtftYhaYrhLe1oM/J7DznYw8fG diFe8gGlfezYlvq7Nu0ev216wcEd9d4DmLJIEZrN/uIv7pztZBILjgkK7YI= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some revision of ASUS Q500A series have keyboard related issue which is reproducible only if Windows with installed ASUS tools was ever started. In this case the Linux side will have blocked keyboard or report wrong or incomplete hotkey events. To make Linux work properly again complete power down (unplug power supply and remove battery) should be made. Linux/atkbd after clean start will get fallowing code on VOLUME_UP key: {0xe0, 0x30, 0xe0, 0xb0}. After Windows, same key will generate this codes: {0xe1, 0x23, 0xe0, 0x30, 0xe0, 0xb0}. As result atkdb will be confused by buggy codes. This patch is filtering this buggy code out. https://bugzilla.kernel.org/show_bug.cgi?id=119391 Signed-off-by: Oleksij Rempel Sponsored-by: Alex Henrie CC: Dmitry Torokhov --- drivers/input/keyboard/atkbd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index ec876b5..949c199 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -996,6 +996,17 @@ static unsigned int atkbd_oqo_01plus_scancode_fixup(struct atkbd *atkbd, return code; } +static unsigned int atkbd_asus_q500a_scancode_fixup(struct atkbd *atkbd, + unsigned int code) +{ + if (atkbd->translated && atkbd->emul == 2 && code == 0x23) { + atkbd->emul = 0; + return ATKBD_RET_ERR; + } + + return code; +} + /* * atkbd_set_keycode_table() initializes keyboard's keycode table * according to the selected scancode set @@ -1802,6 +1813,14 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { }, .callback = atkbd_deactivate_fixup, }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "Q500A"), + }, + .callback = atkbd_setup_scancode_fixup, + .driver_data = atkbd_asus_q500a_scancode_fixup, + }, { } };