Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4623599pxj; Wed, 12 May 2021 09:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRxsEO/BE3aHASXeZpQhHGOtGJCpuQmNM6UbnXNmE88n4aY4sObG8GPMsL/gI0cHYPsmJ/ X-Received: by 2002:aca:f0c:: with SMTP id 12mr23713329oip.131.1620836881784; Wed, 12 May 2021 09:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836881; cv=none; d=google.com; s=arc-20160816; b=QtY33FrnAokU3lm5D47d1doWSy1H8BRSkVC4JBHDOARfLo3wK+2klMr/HLbO1opUbx giRiBO2KRdmwhe9Tv/+Akrw7xOkJTFdZ12QMlXY3RGMFfeDu4jzVezMqavG+5h5cAGOX JxDEH6vkiLRc3Q/qhHmeOevR4ju0QEb8+ofOxwj5KAnTagEkN3dJiXmivvHSuxWNmHgT Wy/2NSxlwo9yZOURjZ7LJmgNnN3mZC6gVIjsz+XDwStQ2vukiprt57XX9pm5m5rKOr+a 0TnUUGA9melXdMGXInWCTEjtaFcO5JhImzL8+SgLFHfmHldNpbXjgk67+rLiSqbHgiDL sUjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7HEMyJq+02POJ9c4IvGKRIRqpwcXCm1WZWX1lGSMaFc=; b=XsUBlYC+OlYBgMjfBF8g7S0nbkUe6ucbOuLL2UPEbv3Ukd/Lnc6lhvE9UD5rmQYGyu cqj2q5uGH909XCsuy05jKXVraA3ItZLQSzB4FJEzpK1YEN9WGHNnWm5b2L8cucUE0wdG fioEZu76pnCosxv9+dS7+w696XR9WjuXT3jkvEnvTQ67TY6HUWfULHwkEubo1JO6Grro GHI3j+A/iO179MXdUOO5spw8MeSRpUBYkLH6DCS2/iimxx3BFbmvoDhdj6staRpj8XS9 TW76Jz8ldC8Abcu90DSXzOVUOEwaqs9MLOBmvnUcQpXCAx/e0+IYjCu4VhRmpzvFRgto NZYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xYe6xclQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si233749oth.205.2021.05.12.09.27.48; Wed, 12 May 2021 09:28:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xYe6xclQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237949AbhELQYi (ORCPT + 99 others); Wed, 12 May 2021 12:24:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:55290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236236AbhELPhX (ORCPT ); Wed, 12 May 2021 11:37:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC49861C4B; Wed, 12 May 2021 15:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832732; bh=nlX+jdxuZUhjCl11Av14x6M7WtnJTWnqSGD9+Js8oYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xYe6xclQOKqoGBJj8TgNRDWnMjgdphR3uXPugJ+H8wR1X9n0HPSmbCMn0PI9Rp0H2 pXn7IByLfe1iaOx1kSztO0BCUtSA74zlaiXvj194ElexejI+yFfM69vRbzBjYp/alU cGasSSymZ7+HRFuVMRk1UPCU0B2VebpZstjWkY64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , Hans de Goede , Jiri Kosina , Sasha Levin Subject: [PATCH 5.10 399/530] HID: lenovo: Map mic-mute button to KEY_F20 instead of KEY_MICMUTE Date: Wed, 12 May 2021 16:48:29 +0200 Message-Id: <20210512144832.881471983@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede [ Upstream commit 617103246cfd19af837e4cb614ba9f877c4f7779 ] Mapping the mic-mute button to KEY_MICMUTE is technically correct but KEY_MICMUTE translates to a scancode of 256 (248 + 8) under X, which does not fit in 8 bits, so it does not work. Because of this userspace is expecting KEY_F20 instead, theoretically KEY_MICMUTE should work under Wayland but even there it does not work, because the desktop-environment is listening only for KEY_F20 and not for KEY_MICMUTE. Fixes: bc04b37ea0ec ("HID: lenovo: Add ThinkPad 10 Ultrabook Keyboard support") Reviewed-by: Marek BehĂșn Signed-off-by: Hans de Goede Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-lenovo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index b2596ed37880..0ff03fed9770 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -33,6 +33,9 @@ #include "hid-ids.h" +/* Userspace expects F20 for mic-mute KEY_MICMUTE does not work */ +#define LENOVO_KEY_MICMUTE KEY_F20 + struct lenovo_drvdata { u8 led_report[3]; /* Must be first for proper alignment */ int led_state; @@ -134,7 +137,7 @@ static int lenovo_input_mapping_tpkbd(struct hid_device *hdev, if (usage->hid == (HID_UP_BUTTON | 0x0010)) { /* This sub-device contains trackpoint, mark it */ hid_set_drvdata(hdev, (void *)1); - map_key_clear(KEY_MICMUTE); + map_key_clear(LENOVO_KEY_MICMUTE); return 1; } return 0; @@ -149,7 +152,7 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, (usage->hid & HID_USAGE_PAGE) == HID_UP_LNVENDOR) { switch (usage->hid & HID_USAGE) { case 0x00f1: /* Fn-F4: Mic mute */ - map_key_clear(KEY_MICMUTE); + map_key_clear(LENOVO_KEY_MICMUTE); return 1; case 0x00f2: /* Fn-F5: Brightness down */ map_key_clear(KEY_BRIGHTNESSDOWN); @@ -239,7 +242,7 @@ static int lenovo_input_mapping_tp10_ultrabook_kbd(struct hid_device *hdev, map_key_clear(KEY_FN_ESC); return 1; case 9: /* Fn-F4: Mic mute */ - map_key_clear(KEY_MICMUTE); + map_key_clear(LENOVO_KEY_MICMUTE); return 1; case 10: /* Fn-F7: Control panel */ map_key_clear(KEY_CONFIG); -- 2.30.2