From: bugzilla-daemon@kernel.org
To: linux-usb@vger.kernel.org
Subject: [Bug 215799] apple-mfi-fastcharge causes automatic pm hibernation entry, when iPhone gets attached
Date: Wed, 06 Apr 2022 20:17:13 +0000 [thread overview]
Message-ID: <bug-215799-208809-nWSmZk9nPV@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-215799-208809@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=215799
--- Comment #6 from Manuel Ullmann (labre@posteo.de) ---
(In reply to Oliver Neukum from comment #5)
> just to make this clear. We seem to have two bugs. Do both need to be fixed
> to remedy this issue, or do we have two independent bugs?
They are partially dependent on each other, however the kernel can’t fix the
issue alone, while userspace can by adding a safe guard/workaround.
Is it technically more correct to report the charger as USB or should it rather
stay like it is? If the answer is yes, then the patch should be incorporated.
Whether it is required depends on how the laptop-mode-tools developing
community considers workarounds for buggy drivers.
Consider the following commit [1]:
diff --git a/usr/sbin/laptop_mode b/usr/sbin/laptop_mode
index 5e2ef72..c4387ab 100755
--- a/usr/sbin/laptop_mode
+++ b/usr/sbin/laptop_mode
@@ -488,7 +488,7 @@ lmt_load_config ()
BATTERY_NOT_DISCHARGING=0
for POWER_SUPPLY in /sys/class/power_supply/* ; do
if [ -f $POWER_SUPPLY/type ] ; then
- SYSFS_POWER_SUPPLY=1
+ SYSFS_POWER_SUPPLY=$(( SYSFS_POWER_SUPPLY + 1 ))
if [ "$(cat $POWER_SUPPLY/type)" = "Mains" ]; then
log "VERBOSE" "Determining power state from
$POWER_SUPPLY/online."
if [ "$(cat $POWER_SUPPLY/online)" = 1 ]; then
@@ -497,6 +497,14 @@ lmt_load_config ()
fi
elif [ "$(cat $POWER_SUPPLY/type)" = "Battery" ]; then
log "VERBOSE" "Determining power state from
status of battery $POWER_SUPPLY."
+ #INFO: Because there are and will always be
br0ken drivers
+ if [ ! -f $POWER_SUPPLY/status ]; then
+ log "ERR" "Your power_supply is lacking
a status node"
+ log "ERR" "Its driver might be
reporting a wrong type"
+ log "ERR" "Ignoring this battery"
+ SYSFS_POWER_SUPPLY=$((
SYSFS_POWER_SUPPLY - 1 ))
+ continue
+ fi
#INFO: Because there are and will always be
br0ken batteries
if [ "$(cat $POWER_SUPPLY/status)" !=
"Discharging" ]; then
if [ "$(cat $POWER_SUPPLY/status)" =
"Unknown" ]; then
@@ -512,11 +520,15 @@ lmt_load_config ()
ON_AC=0
break
fi
+ else
+ log "VERBOSE" "Power_supply has unexpected type
$(cat $POWER_SUPPLY/type)"
+ log "VERBOSE" "Ignoring it"
+ SYSFS_POWER_SUPPLY=$(( SYSFS_POWER_SUPPLY - 1 ))
fi
fi
done
- if [ $SYSFS_POWER_SUPPLY = 1 ] ; then
+ if [ $SYSFS_POWER_SUPPLY -gt 0 ] ; then
# Already found it!
log "VERBOSE" "Not trying other options, already found a power
supply."
elif [ $BATTERY_NOT_DISCHARGING = 1 ]; then
--
2.35.1
With the kernel patch, just the else case and increment/decrement would be
required. Without it, the handling in the battery case is required. As I said,
I would consider this a reasonable addition for robustness, but I don’t know,
whether the laptop-mode-tools community shares that opinion.
Thank you again for pointing me in the right direction.
[1]:
https://github.com/rickysarraf/laptop-mode-tools/pull/186/commits/9ddcb2e9f4665fa0b0620fc7eb397917d029fdfd
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
next prev parent reply other threads:[~2022-04-06 21:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 22:22 [Bug 215799] New: apple-mfi-fastcharge causes automatic pm hibernation entry, when iPhone gets attached bugzilla-daemon
2022-04-04 22:23 ` [Bug 215799] " bugzilla-daemon
2022-04-05 8:26 ` bugzilla-daemon
2022-04-05 9:42 ` bugzilla-daemon
2022-04-06 1:56 ` bugzilla-daemon
2022-04-06 8:47 ` bugzilla-daemon
2022-04-06 20:17 ` bugzilla-daemon [this message]
2022-04-07 11:13 ` bugzilla-daemon
2022-04-07 18:09 ` bugzilla-daemon
2022-04-07 21:03 ` bugzilla-daemon
2022-04-07 22:10 ` bugzilla-daemon
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=bug-215799-208809-nWSmZk9nPV@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=linux-usb@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;
as well as URLs for NNTP newsgroup(s).