Linux Input/HID development
 help / color / mirror / Atom feed
From: Frank Praznik <frank.praznik@oh.rr.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, dh.herrmann@gmail.com,
	Frank Praznik <frank.praznik@oh.rr.com>
Subject: [PATCH v3 5/6] HID: sony: Set initial battery level to 100% to avoid false low battery warnings
Date: Wed,  5 Feb 2014 20:03:48 -0500	[thread overview]
Message-ID: <1391648629-3077-6-git-send-email-frank.praznik@oh.rr.com> (raw)
In-Reply-To: <1391648629-3077-1-git-send-email-frank.praznik@oh.rr.com>

Set the initial battery level to 100% to avoid false low battery warnings if
the battery state is polled before a report with the actual battery level is
received.

Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
---
 drivers/hid/hid-sony.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 4b8cb98..84633bf 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1404,6 +1404,11 @@ static int sony_battery_probe(struct sony_sc *sc)
 	struct hid_device *hdev = sc->hdev;
 	int ret;
 
+	/* Set the default battery level to 100% to avoid low battery warnings
+	 * if the battery is polled before the first device report is received.
+	 */
+	sc->battery_capacity = 100;
+
 	power_id = (unsigned long)atomic_inc_return(&power_id_seq);
 
 	sc->battery.properties = sony_battery_props;
-- 
1.8.5.3


  parent reply	other threads:[~2014-02-06  1:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06  1:03 [PATCH v3 0/6] HID: sony: Add full Bluetooth support for the Dualshock 4 Frank Praznik
2014-02-06  1:03 ` [PATCH v3 1/6] HID: sony: Use low-level transport driver functions Frank Praznik
2014-02-06  1:03 ` [PATCH v3 2/6] HID: sony: Add modified Dualshock 4 Bluetooth HID descriptor Frank Praznik
2014-02-06  1:03 ` [PATCH v3 3/6] HID: sony: Add Dualshock 4 Bluetooth output report formatting Frank Praznik
2014-02-06  1:03 ` [PATCH v3 4/6] HID: sony: Add Dualshock 4 Bluetooth battery and touchpad parsing Frank Praznik
2014-02-06  1:03 ` Frank Praznik [this message]
2014-02-06  1:03 ` [PATCH v3 6/6] HID: sony: Add conditionals to enable all features in Bluetooth mode Frank Praznik
2014-02-12 12:14 ` [PATCH v3 0/6] HID: sony: Add full Bluetooth support for the Dualshock 4 David Herrmann
2014-02-17 13:18   ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391648629-3077-6-git-send-email-frank.praznik@oh.rr.com \
    --to=frank.praznik@oh.rr.com \
    --cc=dh.herrmann@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox