154 lines
7.1 KiB
Diff
154 lines
7.1 KiB
Diff
|
From mboxrd@z Thu Jan 1 00:00:00 1970
|
||
|
Return-Path: <linux-kernel-owner@kernel.org>
|
||
|
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
|
||
|
aws-us-west-2-korg-lkml-1.web.codeaurora.org
|
||
|
X-Spam-Level:
|
||
|
X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED,
|
||
|
DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,
|
||
|
HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH,
|
||
|
MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham
|
||
|
autolearn_force=no version=3.4.0
|
||
|
Received: from mail.kernel.org (mail.kernel.org [198.145.29.99])
|
||
|
by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE24C433E0
|
||
|
for <linux-kernel@archiver.kernel.org>; Sat, 27 Mar 2021 13:10:34 +0000 (UTC)
|
||
|
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
|
||
|
by mail.kernel.org (Postfix) with ESMTP id 70E6A61993
|
||
|
for <linux-kernel@archiver.kernel.org>; Sat, 27 Mar 2021 13:10:34 +0000 (UTC)
|
||
|
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
|
||
|
id S230334AbhC0NHL (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
|
||
|
Sat, 27 Mar 2021 09:07:11 -0400
|
||
|
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59832 "EHLO
|
||
|
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
|
||
|
with ESMTP id S230347AbhC0NGo (ORCPT
|
||
|
<rfc822;linux-kernel@vger.kernel.org>);
|
||
|
Sat, 27 Mar 2021 09:06:44 -0400
|
||
|
Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536])
|
||
|
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AAD5C0613B1
|
||
|
for <linux-kernel@vger.kernel.org>; Sat, 27 Mar 2021 06:06:44 -0700 (PDT)
|
||
|
Received: by mail-pg1-x536.google.com with SMTP id 32so6451842pgm.1
|
||
|
for <linux-kernel@vger.kernel.org>; Sat, 27 Mar 2021 06:06:44 -0700 (PDT)
|
||
|
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
||
|
d=gmail.com; s=20161025;
|
||
|
h=from:to:cc:subject:date:message-id:in-reply-to:references
|
||
|
:mime-version:content-transfer-encoding;
|
||
|
bh=5GW0J0I07iFc3HTzTSsHG/cnT3ft+pF2eI68TUZquXs=;
|
||
|
b=jJACN/frvED8BOFNtDXFShzg5zpUEJjtXdexEk/8uljNrUnW9QBLA5orX/2hdcZdS4
|
||
|
9HL492GecBx3KY9Y5P/B3fttZmlHkwWbuUktmVlmaIOZv1jAPTyYz5zJYh0O0ncw9/rk
|
||
|
aPvRb4s1NZHByZ4XoCWbWOd98BvgHHQ/m4Zf1zmP5lYjBVMb2r6qSejuJ5ywQOCBKo9x
|
||
|
Q8SL42BOWrlNlsWmeP+oDEYWSDARHpKlRqQ63Y4LdvV2uS9IF6+bmHotGSRlHSLuFN1b
|
||
|
/PcfuSQynv38/EgH8MeE16VKzAvLXGu/KgcOLLCsSLgPFLqKAk3uQVc5QRLw00niguHp
|
||
|
MMUg==
|
||
|
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
||
|
d=1e100.net; s=20161025;
|
||
|
h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
|
||
|
:references:mime-version:content-transfer-encoding;
|
||
|
bh=5GW0J0I07iFc3HTzTSsHG/cnT3ft+pF2eI68TUZquXs=;
|
||
|
b=AueOy/X73fYr+YShlS2LMp2gWnsgDUIFV7eKHphj6Q1dBTHtj/dxdarFAonoqAtMRD
|
||
|
RCpUwakkFtecMcJPGG/2FRZdRmbJg/ksRvalLQhQCN8XYGB4T/o3zmaOUUooitcGC3gj
|
||
|
aeCCryhkv9OzDUYTwPsAzTjrDTkTB3Oh8IvWhfEIcb9x8k+J+OLaIrGozUxhtJkepSRc
|
||
|
Uswy+MJkcl8KfXiawODwnjX7JmWwm2SdpRbsBKjJjs+rad+ECgYEFyt8aqYbTabFtIuj
|
||
|
oaHtcYHS6FLYTFcRbhCcVECQo2OUzvJjPNe5GyHqUxlvmdFI/Wn68/dt5DKSl5CHRjrp
|
||
|
qdPA==
|
||
|
X-Gm-Message-State: AOAM530Dp411JuLoADUDvvtPhkgbdVcoa5u6Mm4STd67xIRk49ZPXT33
|
||
|
uWg1/mAtTfIfNFL2t5NEvBtvsCfrYoBgGzJJ
|
||
|
X-Google-Smtp-Source: ABdhPJw4EeRec5E5FY/fifXp32gxWuRl/ThAsWSiEflIS3aALG3LbhZVwkDmQhbhsG3gD8jRMsQIlw==
|
||
|
X-Received: by 2002:a62:17c4:0:b029:1f5:7cfe:ebc4 with SMTP id 187-20020a6217c40000b02901f57cfeebc4mr17080244pfx.5.1616850403793;
|
||
|
Sat, 27 Mar 2021 06:06:43 -0700 (PDT)
|
||
|
Received: from johnchen902-arch-ryzen.. (2001-b011-3815-3a1f-9afa-9bff-fe6e-3ce2.dynamic-ip6.hinet.net. [2001:b011:3815:3a1f:9afa:9bff:fe6e:3ce2])
|
||
|
by smtp.gmail.com with ESMTPSA id ot17sm6413787pjb.50.2021.03.27.06.06.42
|
||
|
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
|
||
|
Sat, 27 Mar 2021 06:06:43 -0700 (PDT)
|
||
|
From: John Chen <johnchen902@gmail.com>
|
||
|
To: linux-kernel@vger.kernel.org
|
||
|
Cc: Rohit Pidaparthi <rohitpid@gmail.com>,
|
||
|
RicardoEPRodrigues <ricardo.e.p.rodrigues@gmail.com>,
|
||
|
Jiri Kosina <jikos@kernel.org>,
|
||
|
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
|
||
|
John Chen <johnchen902@gmail.com>
|
||
|
Subject: [PATCH 4/4] HID: input: map battery capacity (00850065)
|
||
|
Date: Sat, 27 Mar 2021 21:05:08 +0800
|
||
|
Message-Id: <20210327130508.24849-5-johnchen902@gmail.com>
|
||
|
X-Mailer: git-send-email 2.31.0
|
||
|
In-Reply-To: <20210327130508.24849-1-johnchen902@gmail.com>
|
||
|
References: <20210327130508.24849-1-johnchen902@gmail.com>
|
||
|
MIME-Version: 1.0
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
Precedence: bulk
|
||
|
List-ID: <linux-kernel.vger.kernel.org>
|
||
|
X-Mailing-List: linux-kernel@vger.kernel.org
|
||
|
Archived-At: <https://lore.kernel.org/lkml/20210327130508.24849-5-johnchen902@gmail.com/>
|
||
|
List-Archive: <https://lore.kernel.org/lkml/>
|
||
|
List-Post: <mailto:linux-kernel@vger.kernel.org>
|
||
|
|
||
|
This is the capacity in percentage, relative to design capacity.
|
||
|
Specifically, it is present in Apple Magic Mouse 2.
|
||
|
|
||
|
In contrast, usage 00850064 is also the capacity in percentage, but is
|
||
|
relative to full capacity. It is not mapped here because I don't have
|
||
|
such device.
|
||
|
|
||
|
Signed-off-by: John Chen <johnchen902@gmail.com>
|
||
|
---
|
||
|
drivers/hid/hid-debug.c | 1 +
|
||
|
drivers/hid/hid-input.c | 11 +++++++++++
|
||
|
include/linux/hid.h | 3 +++
|
||
|
3 files changed, 15 insertions(+)
|
||
|
|
||
|
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
|
||
|
index d7eaf9100370..59f8d716d78f 100644
|
||
|
--- a/drivers/hid/hid-debug.c
|
||
|
+++ b/drivers/hid/hid-debug.c
|
||
|
@@ -417,6 +417,7 @@ static const struct hid_usage_entry hid_usage_table[] = {
|
||
|
{ 0x85, 0x44, "Charging" },
|
||
|
{ 0x85, 0x45, "Discharging" },
|
||
|
{ 0x85, 0x4b, "NeedReplacement" },
|
||
|
+ { 0x85, 0x65, "AbsoluteStateOfCharge" },
|
||
|
{ 0x85, 0x66, "RemainingCapacity" },
|
||
|
{ 0x85, 0x68, "RunTimeToEmpty" },
|
||
|
{ 0x85, 0x6a, "AverageTimeToFull" },
|
||
|
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
|
||
|
index 236bccd37760..5dea3669a927 100644
|
||
|
--- a/drivers/hid/hid-input.c
|
||
|
+++ b/drivers/hid/hid-input.c
|
||
|
@@ -1074,6 +1074,17 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||
|
}
|
||
|
goto unknown;
|
||
|
|
||
|
+ case HID_UP_BATTERY:
|
||
|
+ switch (usage->hid) {
|
||
|
+ case HID_BAT_ABSOLUTESTATEOFCHARGE:
|
||
|
+ hidinput_setup_battery(device, HID_INPUT_REPORT, field);
|
||
|
+ usage->type = EV_PWR;
|
||
|
+ return;
|
||
|
+ }
|
||
|
+ goto unknown;
|
||
|
+
|
||
|
case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */
|
||
|
set_bit(EV_REP, input->evbit);
|
||
|
switch (usage->hid & HID_USAGE) {
|
||
|
diff --git a/include/linux/hid.h b/include/linux/hid.h
|
||
|
index ef702b3f56e3..b40e1abbe11d 100644
|
||
|
--- a/include/linux/hid.h
|
||
|
+++ b/include/linux/hid.h
|
||
|
@@ -153,6 +153,7 @@ struct hid_item {
|
||
|
#define HID_UP_CONSUMER 0x000c0000
|
||
|
#define HID_UP_DIGITIZER 0x000d0000
|
||
|
#define HID_UP_PID 0x000f0000
|
||
|
+#define HID_UP_BATTERY 0x00850000
|
||
|
#define HID_UP_HPVENDOR 0xff7f0000
|
||
|
#define HID_UP_HPVENDOR2 0xff010000
|
||
|
#define HID_UP_MSVENDOR 0xff000000
|
||
|
@@ -297,6 +298,8 @@ struct hid_item {
|
||
|
#define HID_DG_TOOLSERIALNUMBER 0x000d005b
|
||
|
#define HID_DG_LATENCYMODE 0x000d0060
|
||
|
|
||
|
+#define HID_BAT_ABSOLUTESTATEOFCHARGE 0x00850065
|
||
|
+
|
||
|
#define HID_VD_ASUS_CUSTOM_MEDIA_KEYS 0xff310076
|
||
|
/*
|
||
|
* HID report types --- Ouch! HID spec says 1 2 3!
|
||
|
--
|
||
|
2.31.0
|
||
|
|
||
|
|