Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1843C64ED6 for ; Mon, 27 Feb 2023 02:10:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbjB0CKr (ORCPT ); Sun, 26 Feb 2023 21:10:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjB0CKI (ORCPT ); Sun, 26 Feb 2023 21:10:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92F551BF3; Sun, 26 Feb 2023 18:09:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 96A8360DBE; Mon, 27 Feb 2023 02:09:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0F9C4339B; Mon, 27 Feb 2023 02:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677463750; bh=MDOBzsOmwyycbBJKWHx1C9Ml481JTVaL3IEp0ZgADAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndk1QaK/IoJZsJkjGBPttm0z/C96BnlgKXNJnTKEUkZb/elz8ipmI/OjgGpwFKJvE HS0P7iteA2HRBRQunhegE30FjisR+AxtxgC5mdd9eYNZvAEit02aF4xfomSoUz+14M Ksi7tkI4LOZjAlJbThh9/kzt6mspdVg8pFH8oXwoTjSp4j4uWIIoHcxur0OF3ZMqQK +tYoaOlL78WE35bWapry79MeHEujAzkB0PTsAX4xoKzosgnn+7wV+K1BsZfKBZMZrX 71SrVS6Ah8eB7avWQwKuLyu7REr/vE4s98t6AyrN7gDkXVDxbDij36MZJdX+BjAjAq wXPBx6dj9VgFA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jingyuan Liang , Dmitry Torokhov , Jiri Kosina , Sasha Levin , jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 04/25] HID: Add Mapping for System Microphone Mute Date: Sun, 26 Feb 2023 21:08:27 -0500 Message-Id: <20230227020855.1051605-4-sashal@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230227020855.1051605-1-sashal@kernel.org> References: <20230227020855.1051605-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jingyuan Liang [ Upstream commit 2d60f9f4f26785a00273cb81fe60eff129ebd449 ] HUTRR110 added a new usage code for a key that is supposed to mute/unmute microphone system-wide. Map the new usage code(0x01 0xa9) to keycode KEY_MICMUTE. Additionally hid-debug is adjusted to recognize this keycode as well. Signed-off-by: Jingyuan Liang Reviewed-by: Dmitry Torokhov Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-debug.c | 1 + drivers/hid/hid-input.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index f48d3534e0200..03da865e423c7 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -937,6 +937,7 @@ static const char *keys[KEY_MAX + 1] = { [KEY_KBD_LAYOUT_NEXT] = "KbdLayoutNext", [KEY_EMOJI_PICKER] = "EmojiPicker", [KEY_DICTATE] = "Dictate", + [KEY_MICMUTE] = "MicrophoneMute", [KEY_BRIGHTNESS_MIN] = "BrightnessMin", [KEY_BRIGHTNESS_MAX] = "BrightnessMax", [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index f197aed6444a5..0ae959e54462b 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -709,6 +709,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel break; } + if ((usage->hid & 0xf0) == 0xa0) { /* SystemControl */ + switch (usage->hid & 0xf) { + case 0x9: map_key_clear(KEY_MICMUTE); break; + default: goto ignore; + } + break; + } + if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ switch (usage->hid & 0xf) { case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; -- 2.39.0