From patchwork Fri Oct 8 07:37:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 12544499 X-Patchwork-Delegate: jikos@jikos.cz 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBD09C433F5 for ; Fri, 8 Oct 2021 07:37:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95B6F60E05 for ; Fri, 8 Oct 2021 07:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231979AbhJHHjN (ORCPT ); Fri, 8 Oct 2021 03:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbhJHHjM (ORCPT ); Fri, 8 Oct 2021 03:39:12 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB10DC061570 for ; Fri, 8 Oct 2021 00:37:17 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id u7so7435900pfg.13 for ; Fri, 08 Oct 2021 00:37:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+jXb/u4Nu2v0/y0TpbZQTGUginK+N59q3pyzqXdN+BY=; b=TQ0C0GStxlREcwyFSOar+jbmZKyb1mXgfG+1LY4veiPTzClEXhn3CEceXuNvqdJ3le UXCf9J4thgXFtro59+usCxr/ssuPYKgqfhvX29IrEXsYe2sMKZdDw15t6g+aq50D42pF T9YnymxFdm3Wi2iPryh9/boBWQwMlBlvluPkdn3EtKv6FE8eceqGJmSCk9BhDm9uQO2f LFf61kgu/sT2jzMPStqtskpDXAdeMgInUKqGWGKr24geZMpr64Zt6ikshx+canZ+Ds60 7QKuYDyuJnX5A3do80B9XSDNEqjjxuGSK4pY4UHyX+16yLbM6eLZ39rkzmpm4sZ5R24h Imyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+jXb/u4Nu2v0/y0TpbZQTGUginK+N59q3pyzqXdN+BY=; b=eFNtqqt0TuSzEMerhT+qkMNqpkFnY3kzuPJjGE8GLzPWGNjMaURsVMdCERA2ujt90G fbkhk38Pfpex7tn5SSgPUKFX29+nbjRO1cWmUUD0UKlncobsmr6q+01HRiITlokqXco0 Si/N/uFY5zcK0/NJW/KlNkLah7ohMb0SoAHUsZysP/9bZs4O8nuWVN80uHf1Pv3PCEyq Lbn2EObRcwJ9wovTPa6rJPJGZkEaiazf2r7TGpcuta+EOsCMJYUrPA7J8tdCX9A73g2R /MqImnpX9SpW/IAMATayVcoisL13oVCQr6h8SRwD4xNu86ynidouWAg/80M2bcBqGEvl FRlg== X-Gm-Message-State: AOAM533mz7iA7Ck2yECFPCR3FjtCPUYnIpmd1o/WDbZIKuSz6ogCYS5i wnleauP6Bfsqujd0eNXSKXHLVbV4xTY= X-Google-Smtp-Source: ABdhPJxaCXRvsMAHBp8NG5z2SAIfo4TabeEqMJZ+3xQ+cs77kHQx7w/aeiRpDFuUNRAnLaIqkGqKAg== X-Received: by 2002:a62:1ac3:0:b0:44b:85d0:5a98 with SMTP id a186-20020a621ac3000000b0044b85d05a98mr8592915pfa.18.1633678637037; Fri, 08 Oct 2021 00:37:17 -0700 (PDT) Received: from xavier.lan ([207.135.154.184]) by smtp.gmail.com with ESMTPSA id 22sm1556583pgn.88.2021.10.08.00.37.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 00:37:16 -0700 (PDT) From: Alex Henrie To: linux-input@vger.kernel.org, benjamin.tissoires@redhat.com, hadess@hadess.net, jikos@kernel.org, jose.exposito89@gmail.com, jslaby@suse.cz, juw@posteo.de, lukas@wunner.de Cc: Alex Henrie Subject: [PATCH 1/3] HID: apple: Rename MAGIC_KEYBOARD_ANSI to MAGIC_KEYBOARD_2015 Date: Fri, 8 Oct 2021 01:37:00 -0600 Message-Id: <20211008073702.5761-1-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The ANSI, ISO, and JIS variants of this keyboard all have the same product ID. Signed-off-by: Alex Henrie --- drivers/hid/hid-apple.c | 8 ++++---- drivers/hid/hid-ids.h | 4 ++-- drivers/hid/hid-quirks.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 6ccfa0cb997a..6f019e4f7bba 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -544,13 +544,13 @@ static const struct hid_device_id apple_devices[] = { .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI), + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015), .driver_data = APPLE_HAS_FN }, - { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI), + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015), .driver_data = APPLE_HAS_FN }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI), + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015), .driver_data = APPLE_HAS_FN }, - { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI), + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), .driver_data = APPLE_HAS_FN }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 29564b370341..c84ff8e4038f 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -159,8 +159,8 @@ #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256 #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257 -#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI 0x0267 -#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_ANSI 0x026c +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015 0x0267 +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015 0x026c #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index 2e104682c22b..256bf42f9629 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -299,7 +299,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS) }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, #endif From patchwork Fri Oct 8 07:37:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 12544501 X-Patchwork-Delegate: jikos@jikos.cz 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A718CC4332F for ; Fri, 8 Oct 2021 07:37:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A73761042 for ; Fri, 8 Oct 2021 07:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232629AbhJHHjO (ORCPT ); Fri, 8 Oct 2021 03:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232378AbhJHHjO (ORCPT ); Fri, 8 Oct 2021 03:39:14 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36797C061570 for ; Fri, 8 Oct 2021 00:37:19 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id w14so5652499pll.2 for ; Fri, 08 Oct 2021 00:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QoD1YkFciRZhqrXBVBN4kfBFUKcrV4f1F3xbpsUVZQQ=; b=UzbCv8uPx2nuJimFdfzuoAYHuUZCmsqKRJLqCp+iz+ZTGKiW24olcgR3Yi97k/fBtP DGzUjWhgqbc2rbjfpsXKC84/PMvpWA7v+1DxLOQ8Jv/80c2qPnuy2E0Id8WOIcQJdlWY EaHPOknKy+eGsDLyRIuU3PpSh5PITnyZ5lUfusUHXdBwPNY/qOS7ohuV+aQFUhqB3lrm FU93FERe0rmGbK9XQlKOdsP2bgev9r4idpgi4LwNX2Ya4bF35EjGyyMd3V+dEyl9PbQi JCgIfwlIokeDSpogTMZ8SyF6vzU500JZ8sh383SV9AxvFmB6XIvmt4wZJUM3c4fATaeq IB7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QoD1YkFciRZhqrXBVBN4kfBFUKcrV4f1F3xbpsUVZQQ=; b=BzKy6Fq0iDhTvCyqxvABjwb6vFqo7PfsNswdjcG4U2TqwtUTe0L8t1v22TVNKDi5SD WGwiJ0NpFaZCni0YRz4ibCTjtmt+eAkTiDVIDSCXvQ1E+uMOFnMm8OyWbqNMSVEj2Emv k0vFUpsAHw1jWjqd18luF+d/HmHS/zCbwYbbyZOw9HRGgg9zOM3y8AsQGvjTtvj7FMSq pWo10qT8PN3GUd9R0x6TWFaKZSYnSoAy3itxl/U4pHGxaA2yzMJ5cDiNHzWyCjMkiWOU mUhyEUOMETFRfJ/DmAINOaTJLZhhG19Vo7w85PJzbfslhMqXKlnJFhTYDXzWjN4A1+IA x5MA== X-Gm-Message-State: AOAM5314MfRCs6lpiUwosNqqTgP+rK7QFludN8Qlx5N/SxEGR1jBm22X ko4h2l5vd32/a5SaTuPjeWeIj/vvvf4= X-Google-Smtp-Source: ABdhPJzeID1YIEsB0DBwA72j2XkYMIEJByGKJRq9X6FhmUDgCTb2vSVJgVBv0dqdlwyE78wUh9o2fQ== X-Received: by 2002:a17:902:6b84:b0:13f:2b8:c8e7 with SMTP id p4-20020a1709026b8400b0013f02b8c8e7mr8266178plk.76.1633678638415; Fri, 08 Oct 2021 00:37:18 -0700 (PDT) Received: from xavier.lan ([207.135.154.184]) by smtp.gmail.com with ESMTPSA id 22sm1556583pgn.88.2021.10.08.00.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 00:37:17 -0700 (PDT) From: Alex Henrie To: linux-input@vger.kernel.org, benjamin.tissoires@redhat.com, hadess@hadess.net, jikos@kernel.org, jose.exposito89@gmail.com, jslaby@suse.cz, juw@posteo.de, lukas@wunner.de Cc: Alex Henrie Subject: [PATCH 2/3] HID: apple: Add support for the 2021 Magic Keyboard Date: Fri, 8 Oct 2021 01:37:01 -0600 Message-Id: <20211008073702.5761-2-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211008073702.5761-1-alexhenrie24@gmail.com> References: <20211008073702.5761-1-alexhenrie24@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Signed-off-by: Alex Henrie --- drivers/hid/hid-apple.c | 4 ++++ drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + 3 files changed, 6 insertions(+) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 6f019e4f7bba..e7af40b737d8 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -640,6 +640,10 @@ static const struct hid_device_id apple_devices[] = { .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), + .driver_data = APPLE_HAS_FN }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), + .driver_data = APPLE_HAS_FN }, { } }; diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index c84ff8e4038f..8995350d5fd9 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -174,6 +174,7 @@ #define USB_DEVICE_ID_APPLE_IRCONTROL3 0x8241 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242 #define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243 +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c #define USB_VENDOR_ID_ASUS 0x0486 #define USB_DEVICE_ID_ASUS_T91MT 0x0185 diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index 256bf42f9629..06b7908c874c 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -302,6 +302,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021) }, #endif #if IS_ENABLED(CONFIG_HID_APPLEIR) { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, From patchwork Fri Oct 8 07:37:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Henrie X-Patchwork-Id: 12544503 X-Patchwork-Delegate: jikos@jikos.cz 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD0EBC433F5 for ; Fri, 8 Oct 2021 07:37:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89C0C60F9D for ; Fri, 8 Oct 2021 07:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232378AbhJHHjQ (ORCPT ); Fri, 8 Oct 2021 03:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229693AbhJHHjP (ORCPT ); Fri, 8 Oct 2021 03:39:15 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8DCEC061570 for ; Fri, 8 Oct 2021 00:37:20 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id u7so7435982pfg.13 for ; Fri, 08 Oct 2021 00:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AtHbvhTlx+3IEO/ObjVOMiej+ZMrDRMDJTNSXgWYANc=; b=PSiUcwsgfPFuK/ULz4LAeI4IVKn72cqe4MmxXJDHwEl7iuWeLpXTf+t3JSPo2jI6yQ jJxGTqmL+/lO4rr+nU6h64kLNYxLgVwGYS83X0+vkfO+WP+1sr1i0Lu8ftnP3IosM/eW gaI6TEb6rmuMuHjUR7ygwjOXdeFVKFIz8qv8E0psTtLUJZ+ZWa0qNdk0eASV+Hx9SmB9 SSyuoan3iIcHvFQfU1QNckJ8jdZOjxm2RWxWtkQX7ugD8Hv6lMBKtjHWIKkrzydE8UPy JGKuyDmSqC/0g3XKtVHkfVziYLMFGh+2QOkGpPiiAiVsDxd+FbyrjIkFrOceV4ob3n6A sjmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AtHbvhTlx+3IEO/ObjVOMiej+ZMrDRMDJTNSXgWYANc=; b=utWg5oOFH4+r8rhClpJeCV5OLy5McVJ1Boo2LmHBAKjUW7Uk23HcAEXynCfsBM5AXx O+ODuvB5dXxQvSeHywKQ58yhXRSeUELpmi2Vc7Bgce5Etvhcm3XVxzox63KY3vMI5Pq3 2dJna8/RCKpCgsjJ0DOdAFz+fd50BYHFu00PEvf8ESe4Pb18lQINEA6c88/8zODgBWFl rVvXhKUlSHpBKrxZl+FpXTLzF/BVYHw0gNQ0quGZNnJv76f7MASbTNpPJqGSuIldbH2l t4sj+N36eK2jSrrs1yGcE0SoQ05OQxvINzCuMDB2LDV7HwItIzNc+BwQs/gYVc9wqBzy eXgg== X-Gm-Message-State: AOAM5307JpxIzR7oDsh4a/BWynWI/eLwwPQoc81jkmjox7QnsCe/saLB tsQMrvPFFJq2Pv8P9iEH5xJPwoV7PIo= X-Google-Smtp-Source: ABdhPJwoQK6oNP86veKw2vd6xnv3wnhkQjlk2hTEqK1//k3+oopVPrxlcApnwtFW1OffXT5qgmt6rQ== X-Received: by 2002:a05:6a00:ac1:b0:44c:4dc6:b897 with SMTP id c1-20020a056a000ac100b0044c4dc6b897mr8644286pfl.25.1633678639868; Fri, 08 Oct 2021 00:37:19 -0700 (PDT) Received: from xavier.lan ([207.135.154.184]) by smtp.gmail.com with ESMTPSA id 22sm1556583pgn.88.2021.10.08.00.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 00:37:19 -0700 (PDT) From: Alex Henrie To: linux-input@vger.kernel.org, benjamin.tissoires@redhat.com, hadess@hadess.net, jikos@kernel.org, jose.exposito89@gmail.com, jslaby@suse.cz, juw@posteo.de, lukas@wunner.de Cc: Alex Henrie Subject: [PATCH 3/3] HID: apple: Bring back flag for Apple tilde key quirk Date: Fri, 8 Oct 2021 01:37:02 -0600 Message-Id: <20211008073702.5761-3-alexhenrie24@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211008073702.5761-1-alexhenrie24@gmail.com> References: <20211008073702.5761-1-alexhenrie24@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Some Apple ISO keyboards have a quirk where the backtick/tilde key is swapped with the less-than/greater-than key. Unfortunately, there is no perfectly reliable way to detect whether a keyboard has the quirk or not, but the quirk appears to only be present on models that support Bluetooth, and the affected keyboards usually report country code 13 in the HID descriptor. Therefore, the best we can do is to change /sys/module/hid_apple/parameters/iso_layout to a ternary: 0 = Not ISO or ISO and not quirky 1 = ISO and quirky -1 = Guess based on product ID and country code Table of keyboards I have tested: Product Model Shape Labels Bus Country Quirky ========================================================= 05ac:0201 M2452 ANSI Usonian USB 0 No 05ac:020b A1048 ANSI Usonian USB 0 No 05ac:020c A1048 ISO Québécois USB 13 No 05ac:0221 A1243 ISO Norwegian USB 13 No 05ac:0221 A1243 ISO Portuguese USB 13 No 05ac:0221 A1243 ISO Swedish USB 13 No 05ac:0221 A1243 ISO Swiss USB 13 No 05ac:022c A1255 ANSI Usonian BT 33 No 05ac:022d A1255 ISO Hebrew BT 13 Yes 05ac:022d A1255 ISO Québécois BT 13 Yes 05ac:022d A1255 ISO Spanish BT 13 Yes 05ac:023a A1314 ISO Russian BT 13 Yes 05ac:023a A1314 ISO Swiss BT 13 Yes 05ac:024f A1243 ANSI Usonian USB 0 No 05ac:0250 A1243 ISO British USB 13 No 05ac:0250 A1243 ISO German USB 13 No 05ac:0250 A1243 ISO Italian USB 13 No 05ac:0250 A1243 ISO Québécois USB 13 No 05ac:0251 A1243 JIS Japanese USB 15 No 05ac:0255 A1314 ANSI Usonian BT 33 No 05ac:0255 A1314 ANSI Taiwanese BT 33 No 05ac:0255 A1314 ANSI Thai BT 33 No 05ac:0256 A1314 ISO Arabic BT 13 Yes 05ac:0256 A1314 ISO French BT 13 Yes 05ac:0256 A1314 ISO German BT 13 Yes 05ac:0256 A1314 ISO Norwegian BT 13 Yes 05ac:0256 A1314 ISO Spanish BT 13 Yes 05ac:0256 A1314 ISO Swiss BT 13 Yes 05ac:0257 A1314 JIS Japanese BT 15 No 05ac:0267 A1644 ANSI Usonian USB 33 No 004c:0267 A1644 ANSI Usonian BT 0 No 05ac:0267 A1644 ISO British USB 13 Yes 004c:0267 A1644 ISO British BT 0 Yes 05ac:0267 A1644 ISO Swiss USB 13 Yes 004c:0267 A1644 ISO Swiss BT 0 Yes 05ac:0267 A1644 ISO Québécois USB 13 Yes 004c:0267 A1644 ISO Québécois BT 0 Yes 05ac:0267 A1644 JIS Japanese USB 15 No 004c:0267 A1644 JIS Japanese BT 0 No 05ac:029c A2450 ANSI Usonian USB 33 No 004c:029c A2450 ANSI Usonian BT 0 No 05ac:029c A2450 ISO Spanish USB 13 Yes 004c:029c A2450 ISO Spanish BT 0 Yes 05ac:029c A2450 JIS Japanese USB 15 No 004c:029c A2450 JIS Japanese BT 0 No Reported-by: José Expósito Signed-off-by: Alex Henrie Tested-by: and resend, so that I could apply it? --- drivers/hid/hid-apple.c | 46 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index e7af40b737d8..283bf22914ac 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -25,7 +25,7 @@ #define APPLE_IGNORE_MOUSE 0x0002 #define APPLE_HAS_FN 0x0004 #define APPLE_HIDDEV 0x0008 -/* 0x0010 reserved, was: APPLE_ISO_KEYBOARD */ +#define APPLE_ISO_TILDE_QUIRK 0x0010 #define APPLE_MIGHTYMOUSE 0x0020 #define APPLE_INVERT_HWHEEL 0x0040 #define APPLE_IGNORE_HIDINPUT 0x0080 @@ -40,10 +40,10 @@ module_param(fnmode, uint, 0644); MODULE_PARM_DESC(fnmode, "Mode of fn key on Apple keyboards (0 = disabled, " "[1] = fkeyslast, 2 = fkeysfirst)"); -static unsigned int iso_layout = 1; -module_param(iso_layout, uint, 0644); -MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. " - "(0 = disabled, [1] = enabled)"); +static int iso_layout = -1; +module_param(iso_layout, int, 0644); +MODULE_PARM_DESC(iso_layout, "Swap the backtick/tilde and greater-than/less-than keys. " + "([-1] = auto, 0 = disabled, 1 = enabled)"); static unsigned int swap_opt_cmd; module_param(swap_opt_cmd, uint, 0644); @@ -277,14 +277,13 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, } } - if (iso_layout) { - if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) { - trans = apple_find_translation(apple_iso_keyboard, usage->code); - if (trans) { - input_event_with_scancode(input, usage->type, - trans->to, usage->hid, value); - return 1; - } + if (iso_layout > 0 || (iso_layout < 0 && (asc->quirks & APPLE_ISO_TILDE_QUIRK) && + hid->country == HID_COUNTRY_INTERNATIONAL_ISO)) { + trans = apple_find_translation(apple_iso_keyboard, usage->code); + if (trans) { + input_event_with_scancode(input, usage->type, + trans->to, usage->hid, value); + return 1; } } @@ -533,9 +532,11 @@ static const struct hid_device_id apple_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | + APPLE_ISO_TILDE_QUIRK }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | + APPLE_ISO_TILDE_QUIRK }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, @@ -545,13 +546,13 @@ static const struct hid_device_id apple_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), .driver_data = APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING_ISO), @@ -633,7 +634,8 @@ static const struct hid_device_id apple_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN | + APPLE_ISO_TILDE_QUIRK }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY), @@ -641,9 +643,9 @@ static const struct hid_device_id apple_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY), .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), - .driver_data = APPLE_HAS_FN }, + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { } };