From patchwork Fri Mar 28 14:18:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 14032072 X-Patchwork-Delegate: jikos@jikos.cz Received: from PNZPR01CU001.outbound.protection.outlook.com (mail-centralindiaazolkn19011030.outbound.protection.outlook.com [52.103.68.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 586F921421B; Fri, 28 Mar 2025 14:26:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.103.68.30 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743172014; cv=fail; b=IvwCQNqCh82fJU/X09Ph/0Bz03gP4xGSqa8CGMH0XwehVCKa1L1LwLTybIk0JTdJ/LNKlPvGhij/Sk8UB50HurT469Awbin6smLPdynr1JJ2pTuI+ZajgKgJPwuuWPhq2FI0SvFA0jsKGyurcbuVt5exeotq4aN4CWr8kE3e8m0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743172014; c=relaxed/simple; bh=b37/FPgu82P/p+dt7dm6jL8PHu/l3c16LCQ7H8Wt1xs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=IytCKKsGGXfkoNqM9Q4Fz3keSC+/bFGLv4lPcypyzhJjECSy1IsuyPZfQwBjyrIaeq6UQMwCoWT4rlR1OW/vBEieC1lG3NAmDnrHCinMPK1Dgwy3VvpshP3A2z0Dp3j5JBIx1xqFgwk8xCPfUhEwwfqHRVL06GnmmFzr0QJn0Vo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com; spf=pass smtp.mailfrom=live.com; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b=j86fGDBR; arc=fail smtp.client-ip=52.103.68.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=live.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b="j86fGDBR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s5Pu6yz4QiCDbS6UiAUKHqG0Tzgfzii3hgzEs5llsLTK90CjKVEnHse/M/jDheAZwijPkV8dl8DOWwCBrj754DIgZ/xKL8z7Bklce52asurAff1IKkKe58ROrW+nJzAilhnxxepRdeAbqfVrac084yzniuMOKDJFR8ZvV4v/YVJk506phl5neVUU/Ew/kI4jWiimxVquQA5aSmBn5VOWnO5b3ZGAm2UjKAWQOL0WQ7fsKxsKtheLyHN5I5Gf1v0FpZg2ZISyTudGK57NIXpopWeZ5XRKl7Xk1YaYJDvuDpg/8JANZB2j1wCeOOzM33kjieATQx/yP3W5zrSCDgZxyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MNC7MN9Y10OcKnn4KzodRFpVn3mMlPo87kxfSqxr340=; b=Da9jSUppjEeolr4HQst6yXLnbmGE798RImL/aqYoIwDe0V/bB3oPF5I2w1jxBlbR8GMQIpsycbkVC4b2VXflKS66jh//iYn2ZdaPoYr5f9uTsAxWy01neqMuzzHn/VQRzEUW9bSta/PDg0zdFYNw02kAeXECj/DCqZBvWIIcIYSoCsU9k7bIK1FEq35zgZZPeyjsu3fw2tqCp+IL9lVyim/Ca6flSuzWfaftaCxaEPIYPoTHBN/6H1hLlWc3aY37ewWPIpLGxVB34iHMIF10o2kky7PgVUT5YrwIN8kFv8gx/NCZLGqxQ8dByNOdnnvcCYBw6oDf4LGqqtgXkR3DNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MNC7MN9Y10OcKnn4KzodRFpVn3mMlPo87kxfSqxr340=; b=j86fGDBR3vZSW9FjJdk9dSkM5xNEneUiblCSFmmeu71HrEvNOZqF8TeEoKjCU8uKKb2g2vBcrfhzdibfDNulIIfNwdY77e0dZD50QQIVPcNpgg4nLE5sY5+vFK+hB6c/MfPBYvfRFp0s5f6K4Y/nHiSKRoy3EnzFndip+MmOU7y6uRQRZkI4WV3eSh8HHNFpEA/KeyzA80QHu9WK2rFthbkpuQ5QST3paTagFyWYCLYcrn1Nz5Vs1lfGmM3r3puagNOZlup5iTSHTD1iUCsVAiazT718Y9NTAWl8YJBMnx8LWvWDWsjQwcxkkMEnc1lSWFMDbtIjzPl5dWiQra6iWQ== Received: from PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:f7::14) by PN0PR01MB9447.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:10f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Fri, 28 Mar 2025 14:26:47 +0000 Received: from PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM ([fe80::324:c085:10c8:4e77]) by PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM ([fe80::324:c085:10c8:4e77%7]) with mapi id 15.20.8534.043; Fri, 28 Mar 2025 14:26:47 +0000 From: gargaditya08@live.com To: jikos@kernel.org, jkosina@suse.com, bentiss@kernel.org, benjamin.tissoires@redhat.com Cc: g.sokol99@g-sokol.info, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Aditya Garg Subject: [PATCH v4 4/5] HID: apple: Add Apple Magic Keyboard A3118 USB-C support Date: Fri, 28 Mar 2025 19:48:26 +0530 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250328142625.12980-1-gargaditya08@live.com> References: <20250328142625.12980-1-gargaditya08@live.com> X-ClientProxiedBy: BMXPR01CA0086.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:54::26) To PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:f7::14) X-Microsoft-Original-Message-ID: <20250328142625.12980-5-gargaditya08@live.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PN3PR01MB9597:EE_|PN0PR01MB9447:EE_ X-MS-Office365-Filtering-Correlation-Id: f796f87e-34b7-4d63-b26c-08dd6e04929d X-Microsoft-Antispam: BCL:0;ARA:14566002|15080799006|461199028|19110799003|8060799006|7092599003|5072599009|440099028|3412199025|1710799026; X-Microsoft-Antispam-Message-Info: YVUg2yQTi3TDVwcpbr7xa01R57KsqSzZJG5mYrp1S+8fIegHH+w4ooAevn6C/rof1TLQnrKFzXPkyhQvcEh5dpvJ0SazNwHCy8Ocu4YioLWkIlOETpikoyDbhd+J7fEknyJiNItRObo47MhDBiPR6BJD+zxtxc5gCrBKYthhtrqyxTb6W5BAamoPr5/opXlc8cti89q0BRVmQEpU6aMAmwlju/L6RLmX4qw95wWNETsV9B6tUmYCBWGGZUUPaMShHOovsr8x+orSii9FI2LfVlfMsWVJPcSyGUzM3Ey8dZV+OfarcnpPKcmSqC6xM+RdIntQgEzUkyzl65rvONFH21P0buv67VifX6d1jI1BkYCaQ8/MZPzcxPXxJZF/R5c7+S14GYE+6bkWBKyXyLXbRbvBrhGft8mhCmGqkH6Cf62D5SeKiUzAZzV+1GSq8EZKP5fmaxZ/q61rvw2efW0Z+8IAPHYFf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ossTenant-Network-Message-Id: f796f87e-34b7-4d63-b26c-08dd6e04929d X-MS-Exchange-CrossTenant-AuthSource: PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2025 14:26:47.8383 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN0PR01MB9447 From: Grigorii Sokolik Add Apple Magic Keyboard 2024 with Touch ID device ID (05ac:0321) to those recognized by the hid-apple driver. Keyboard is otherwise compatible with the existing implementation for its earlier 2021 model. Signed-off-by: Grigorii Sokolik Co-developed-by: Aditya Garg Signed-off-by: Aditya Garg --- drivers/hid/hid-apple.c | 21 +++++++++++++-------- drivers/hid/hid-ids.h | 9 +++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index fde438bee..e95a54113 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -165,7 +165,7 @@ static const struct apple_key_translation magic_keyboard_2015_fn_keys[] = { { } }; -static const struct apple_key_translation apple2021_fn_keys[] = { +static const struct apple_key_translation magic_keyboard_2021_and_2024_fn_keys[] = { { KEY_BACKSPACE, KEY_DELETE }, { KEY_ENTER, KEY_INSERT }, { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, @@ -482,10 +482,11 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, table = magic_keyboard_2015_fn_keys; break; case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021: - case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024: case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021: case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021: - table = apple2021_fn_keys; + case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024: + case USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2024: + table = magic_keyboard_2021_and_2024_fn_keys; break; case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J132: case USB_DEVICE_ID_APPLE_WELLSPRINGT2_J213: @@ -690,7 +691,7 @@ static void apple_setup_input(struct input_dev *input) apple_setup_key_translation(input, apple_iso_keyboard); apple_setup_key_translation(input, magic_keyboard_alu_fn_keys); apple_setup_key_translation(input, magic_keyboard_2015_fn_keys); - apple_setup_key_translation(input, apple2021_fn_keys); + apple_setup_key_translation(input, magic_keyboard_2021_and_2024_fn_keys); apple_setup_key_translation(input, macbookpro_no_esc_fn_keys); apple_setup_key_translation(input, macbookpro_dedicated_esc_fn_keys); } @@ -1165,10 +1166,6 @@ static const struct hid_device_id apple_devices[] = { .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021), .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024), - .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, - { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024), - .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021), .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021), @@ -1177,6 +1174,14 @@ static const struct hid_device_id apple_devices[] = { .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021), .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024), + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024), + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2024), + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY }, + { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2024), + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT), .driver_data = APPLE_MAGIC_BACKLIGHT }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 288a2b864..8682e1b11 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -162,6 +162,11 @@ #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_JIS 0x0257 #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2015 0x0267 #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015 0x026c +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 0x0320 +#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2024 0x0321 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 @@ -183,10 +188,6 @@ #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_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 0x0320 -#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a -#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f #define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102 #define USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY 0x8302