From patchwork Sat May 17 14:43:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 4196601 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9CD709F32B for ; Sat, 17 May 2014 14:45:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDFA32039C for ; Sat, 17 May 2014 14:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DDE5220380 for ; Sat, 17 May 2014 14:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757503AbaEQOor (ORCPT ); Sat, 17 May 2014 10:44:47 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:49660 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757116AbaEQOoo (ORCPT ); Sat, 17 May 2014 10:44:44 -0400 Received: by mail-pb0-f41.google.com with SMTP id uo5so3845039pbc.14 for ; Sat, 17 May 2014 07:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=0MyWVrCiKWgyZJvEwBjxvkA+KNEo6U2aubSZT2edI4s=; b=vhYvcO4v/LuVXVXCASsaUnB6cUj3Rk/BWC0jFIBEJrAnpur9WNWL7qsMTkNCAiD507 oSlImb0uYm5qYFklLVos/pGgZ0bUeIurHH6dOh3XOD/v2bvsE+AJtWRII+KBavGjkFlx tlrynQYNYnurcXgctfofcHb2Jy0CE0Zm/C+J89edXreP9wq057edXS/fASQ9LHGDyEcC 3Zepzo9AsIa9yAs8SNQZn2JKwbIh5KXwnwlNjktYfhaHqCE+DBDup+C96ptrU2ieXK7o QIV2jSqGnvb+5jEd85GVXmZxBPsCHiOrgjHW+W11OMNw1J9EI2tcrJcINrAZeSP62MBo ezrg== X-Received: by 10.68.254.5 with SMTP id ae5mr28871021pbd.83.1400337883894; Sat, 17 May 2014 07:44:43 -0700 (PDT) Received: from Pali-Latitude.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPSA id ib5sm20317021pbb.55.2014.05.17.07.44.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 17 May 2014 07:44:43 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Dmitry Torokhov , Matthew Garrett Cc: linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-hotplug@vger.kernel.org, Matthew Garrett , linux-kernel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 2/2] dell-wmi: Add support for Fn key combinations Date: Sat, 17 May 2014 16:43:37 +0200 Message-Id: <1400337817-14473-3-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400337817-14473-1-git-send-email-pali.rohar@gmail.com> References: <201405171639.45722@pali> <1400337817-14473-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Bios DMI table contains scancodes for some Fn key combinations. But corresponding keycodes in DMI table have same value 255. And dell-wmi driver map value 255 to KEY_PROG3. This means that it is not possible to distinguish between Fn key combinations (e.g Fn+Q and Fn+W), because kernel reports for all of them only KEY_PROG3. This patch adding new table for mapping Bios DMI scancodes to linux keycodes when bios DMI keycode is set to "generic" keycode 255. So different Fn key combinations will have different keycodes. Signed-off-by: Pali Rohár --- drivers/platform/x86/dell-wmi.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 390e8e3..c54d675 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c @@ -140,7 +140,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_PROG3 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* table for bios code 0xff */ +static const u16 scancode_to_linux_keycode[256] __initconst = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + KEY_FN_Q, KEY_FN_W, KEY_FN_E, KEY_FN_R, + KEY_FN_T, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, KEY_FN_A, KEY_FN_S, + KEY_FN_D, KEY_FN_F, KEY_FN_G, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static struct input_dev *dell_wmi_input_dev; @@ -212,6 +232,11 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) keymap[i].keycode = bios_entry->keycode < 256 ? bios_to_linux_keycode[bios_entry->keycode] : KEY_RESERVED; + if (bios_entry->keycode == 255 && bios_entry->scancode < 256) + keymap[i].keycode = + scancode_to_linux_keycode[bios_entry->scancode]; + if (!keymap[i].keycode) + keymap[i].keycode = KEY_RESERVED; } keymap[hotkey_num].type = KE_END;