Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2904910pxb; Mon, 4 Apr 2022 02:18:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIpxl9ld9LP+edO6IZOjbAnSWhU80O7Yew7yh71+KZ4ntbsOAKq1hu0f+nEllqWNwIz0TH X-Received: by 2002:a17:90a:2a0f:b0:1ca:842a:b82 with SMTP id i15-20020a17090a2a0f00b001ca842a0b82mr7356779pjd.37.1649063921678; Mon, 04 Apr 2022 02:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649063921; cv=none; d=google.com; s=arc-20160816; b=keDFaWZ1uybMUd1JtThqyycJ8LpfwBkmJOPKK21GXSeHGrOVNXRqKHo10iYB/B9DNH oAXyf+G8Zv3YF/lnItC5J1L4wCFeToAPMLNGkx1Aq9wUayXvPnB3PXJnWZBSWTM/hqiH S9VUwxec8p1gBJ9Oal4z+SMQtGIu8+XnP6tC2Ia++LBsaUjUQY60r7IvEVEEkYDeAhkn Cd2mARGZjXWDcwqZbLJcMSQjeZtc3Kk558EUEqnbJK3WvQvB+TXfxzSDpPrNtpJ77opg e10bdl+6ANM9RSZJRRNLzIvTbqI0IjZW6TlPUkVgMWGQ3PbWCzSQCzH8o8CnoYef0B0f /ZBg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4oJBN65pTB67aVsmZpF1ut7XvmSrpTlIztGhwhjzXRs=; b=Kv4CE3t+c36e51xIkISKv9dJ2A41BtWXgjZPib7GSIfeSqMn+jREUWddujW2YP62hK LAfaH5iA+ncu989F9Jske+Fe9V+gadxWkomMsUhGDYkAwKJcWy0KDOBbP0bNXyQKR4RA QjdcG2kqNQekZF1r29M8eeV6RyvUFtbLP6aVXwgvnBAxd4AAOhbVSY+KMyVSArl/A6iz Uxrwx8F6rapMuB3p4CMvi4R1KQ9CwYQ+9JhfWCamS/tETOVquKHSSA0r05PtShdIUKZs rbp8tMUg/AuClZhZL4OGsyVtQEVgL07XblNsD3OETdm1XrfBQl1n8VpAfWdKgNvfqxW8 jk7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cGRUPWxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a17090a4b0900b001c6f8962d27si12203953pjh.116.2022.04.04.02.18.28; Mon, 04 Apr 2022 02:18:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cGRUPWxu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345073AbiDAOhU (ORCPT + 99 others); Fri, 1 Apr 2022 10:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347574AbiDAOdM (ORCPT ); Fri, 1 Apr 2022 10:33:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 927A624B5E9; Fri, 1 Apr 2022 07:29:49 -0700 (PDT) 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 D00BA61CAD; Fri, 1 Apr 2022 14:29:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ADAAC340EE; Fri, 1 Apr 2022 14:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648823388; bh=+ZrSclaFE68paTdR3TTbREjHMDM8oVkoun4X1TcPAkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGRUPWxuhcTDAVvQZ/R77fT5dlNtpQL9CBtsf+FbhE3UJUzN3ec4idOc0W7QiS+Yr j1vAr8C1wybqMxBngI0albzqD259TwY8iRzQMwFvjRNH69yE8daUx/k+UTpWwCuAO9 rirTxx3Q6ofnh0/s+OxrfLb+MknMa5jD3+GxtCR1rqYCJ6J7kNomhsWXCrH1LURDTd oD0gXDfCKe/fPkxSIgOBevXZbSxbPDcThOeiale4B/d3eYeqX667aFBxL8qZ/Zsgpf wdZm9ZqFR3rQu6FyHu9XuGniEMO/H0O/wxFBkIRs8ZwVR5u+a6dkr9s6Ui4cK3XepF milQoT681i6EQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Jiri Kosina , Sasha Levin , jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 075/149] HID: apple: Report Magic Keyboard 2021 battery over USB Date: Fri, 1 Apr 2022 10:24:22 -0400 Message-Id: <20220401142536.1948161-75-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220401142536.1948161-1-sashal@kernel.org> References: <20220401142536.1948161-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: José Expósito [ Upstream commit 8ae5c16c9d421d43f32f66d2308031f1bd3f9336 ] Like the Apple Magic Keyboard 2015, when connected over USB, the 2021 version registers 2 different interfaces. One of them is used to report the battery level. However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually. Add the APPLE_RDESC_BATTERY quirk to fix the battery report descriptor and manually fetch the battery level. Tested with the ANSI, ISO and JIS variants of the keyboard. Signed-off-by: José Expósito Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 7dc89dc6b0f0..18de4ccb0fb2 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c @@ -748,7 +748,7 @@ 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 | APPLE_ISO_TILDE_QUIRK }, + .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_FINGERPRINT_2021), -- 2.34.1