Forwarding to y'all. Just some extra info: `cat /sys/class/power_supply/ucsi-source-psy-USBC000:001/online` shows zero when the cable is unplugged, same for `/sys/class/power_supply/ADP0/online` status, but that means nothing for upower and all system services considering that there a power source available and not setting display brightness and other parameters due to that. Checked in Ubuntu as well, same situation with their kernel 5.8. ---------- Forwarded message --------- От: Vladimir Yerilov <openmindead@xxxxxxxxx> Date: вт, 10 нояб. 2020 г. в 01:23 Subject: Re: Power supply detection issue caused by ucsi_psy? To: Benjamin Berg <bberg@xxxxxxxxxx> Hi Benjamin and all, Unfortunately, these patches had no effect on my side. The OS still thinks there's some power source called "/org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001" when there's actually no cables attached. I used 5.10-rc3 as base with your patches applied on top of it. пн, 9 нояб. 2020 г. в 21:36, Benjamin Berg <bberg@xxxxxxxxxx>: > > Hi, > > On Mon, 2020-11-09 at 13:20 +0200, Heikki Krogerus wrote: > > On Mon, Nov 09, 2020 at 08:48:06PM +1000, Vladimir Yerilov wrote: > > > Since linux 5.8 I'm experiencing a problem related to power source > > > detection on my laptop. My machine is equipped with 2 typec ports, one > > > of them has power delivery and is used for charging, another one has > > > only data transfer capability. The issue is, when I unplug the power > > > cable, the OS is reporting something like "Battery at 100%, plugged in > > > but still discharging" (KDE Plasma notification) - whether another > > > port is used or not. I checked with upower, you can see the output for > > > kernel 5.4 and 5.10 attached. In brief, on 5.8 onwards I have some > > > "line_power_ucsi_source_psy_USBC000o001" device which is considered a > > > power supply and that prevents OS to switch to "battery mode" when > > > unplugging the cable, instead it thinks there's a power source but not > > > powerful enough to charge the battery, upower says this: "on-battery: > > > no", but actually no ac power source is connected. > > > I did some research with git bisect up to the merge commit > > > `e611c0fe318c6d6827ee2bba660fbc23cf73f7dc` ("Merge tag 'usb-5.8-rc1' > > > of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb"), and > > > looked through its content. My wild guess based on upower output is > > > that a new driver introduced there, /drivers/usb/typec/ucsi/psy.c, is > > > responsible for this wrong behavior. > > > > > > Could you please look into that based on info I'm providing? > > > Thank you! > > > > This sounds a bit like the issue that was reported and fixed here: > > https://lore.kernel.org/lkml/20201009144047.505957-1-benjamin@xxxxxxxxxxxxxxxx/ > > I agree, sounds very much like the issue I was seeing. > > What machine/model are you seeing this on? The PPM is implemented in > Firmware, so the behaviour will depend on the Vendor or even model. I > observed it on a Lenovo laptop, but would be curious to know if similar > issues happen elsewhere. > > I only observed an issue when using a thunderbolt dock and not with a > plain USB-C charger. > > > Can you try the two patches from that series? > > Yeah, that would be a good data point. > > Benjamin > > > +Bejamin, who prepared those patches. > > > > > Device: /org/freedesktop/UPower/devices/line_power_ADP0 > > > native-path: ADP0 > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:27:39 +10 (97 seconds > > > ago) > > > has history: no > > > has statistics: no > > > line-power > > > warning-level: none > > > online: yes > > > icon-name: 'ac-adapter-symbolic' > > > > > > Device: /org/freedesktop/UPower/devices/battery_BAT0 > > > native-path: BAT0 > > > vendor: SUNWODA > > > model: R15B01W > > > serial: ACFA > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:27:39 +10 (97 seconds > > > ago) > > > has history: yes > > > has statistics: yes > > > battery > > > present: yes > > > rechargeable: yes > > > state: charging > > > warning-level: none > > > energy: 46.198 Wh > > > energy-empty: 0 Wh > > > energy-full: 46.664 Wh > > > energy-full-design: 60.04 Wh > > > energy-rate: 2.059 W > > > voltage: 8.672 V > > > time to full: 13.6 minutes > > > percentage: 99% > > > capacity: 77.7215% > > > technology: lithium-ion > > > icon-name: 'battery-full-charging-symbolic' > > > History (charge): > > > 1604813259 0.000 unknown > > > History (rate): > > > 1604813259 0.000 unknown > > > > > > Device: > > > /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o > > > 001 > > > native-path: ucsi-source-psy-USBC000:001 > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:27:39 +10 (97 seconds > > > ago) > > > has history: no > > > has statistics: no > > > line-power > > > warning-level: none > > > online: yes > > > icon-name: 'ac-adapter-symbolic' > > > > > > Device: /org/freedesktop/UPower/devices/DisplayDevice > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:27:39 +10 (97 seconds > > > ago) > > > has history: no > > > has statistics: no > > > battery > > > present: yes > > > state: charging > > > warning-level: none > > > energy: 46.198 Wh > > > energy-full: 46.664 Wh > > > energy-rate: 2.059 W > > > time to full: 13.6 minutes > > > percentage: 99% > > > icon-name: 'battery-full-charging-symbolic' > > > > > > Daemon: > > > daemon-version: 0.99.11 > > > on-battery: no > > > lid-is-closed: no > > > lid-is-present: yes > > > critical-action: HybridSleep > > > Device: /org/freedesktop/UPower/devices/line_power_ADP0 > > > native-path: ADP0 > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:29:25 +10 (18 seconds > > > ago) > > > has history: no > > > has statistics: no > > > line-power > > > warning-level: none > > > online: no > > > icon-name: 'ac-adapter-symbolic' > > > > > > Device: /org/freedesktop/UPower/devices/battery_BAT0 > > > native-path: BAT0 > > > vendor: SUNWODA > > > model: R15B01W > > > serial: ACFA > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:29:25 +10 (18 seconds > > > ago) > > > has history: yes > > > has statistics: yes > > > battery > > > present: yes > > > rechargeable: yes > > > state: discharging > > > warning-level: none > > > energy: 46.198 Wh > > > energy-empty: 0 Wh > > > energy-full: 46.664 Wh > > > energy-full-design: 60.04 Wh > > > energy-rate: 1.998 W > > > voltage: 8.44 V > > > time to empty: 23.1 hours > > > percentage: 99% > > > capacity: 77.7215% > > > technology: lithium-ion > > > icon-name: 'battery-full-symbolic' > > > History (charge): > > > 1604813365 99.000 charging > > > History (rate): > > > 1604813365 1.998 charging > > > > > > Device: > > > /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o > > > 001 > > > native-path: ucsi-source-psy-USBC000:001 > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:27:39 +10 (124 seconds > > > ago) > > > has history: no > > > has statistics: no > > > line-power > > > warning-level: none > > > online: yes > > > icon-name: 'ac-adapter-symbolic' > > > > > > Device: /org/freedesktop/UPower/devices/DisplayDevice > > > power supply: yes > > > updated: Sun 08 Nov 2020 15:29:25 +10 (18 seconds > > > ago) > > > has history: no > > > has statistics: no > > > battery > > > present: yes > > > state: discharging > > > warning-level: none > > > energy: 46.198 Wh > > > energy-full: 46.664 Wh > > > energy-rate: 1.998 W > > > time to empty: 23.1 hours > > > percentage: 99% > > > icon-name: 'battery-full-symbolic' > > > > > > Daemon: > > > daemon-version: 0.99.11 > > > on-battery: no > > > lid-is-closed: no > > > lid-is-present: yes > > > critical-action: HybridSleep > > > > > > > thanks, > > -- ---- Best regards, Vladimir Yerilov -- ---- Best regards, Vladimir Yerilov
Device: /org/freedesktop/UPower/devices/line_power_ADP0 native-path: ADP0 power supply: yes updated: Tue 10 Nov 2020 01:20:58 +10 (40 seconds ago) has history: no has statistics: no line-power warning-level: none online: no icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: SUNWODA model: R15B01W serial: ACFA power supply: yes updated: Tue 10 Nov 2020 01:20:58 +10 (40 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: discharging warning-level: none energy: 46.198 Wh energy-empty: 0 Wh energy-full: 46.664 Wh energy-full-design: 60.04 Wh energy-rate: 2.5 W voltage: 8.36 V time to empty: 18.5 hours percentage: 99% capacity: 77.7215% technology: lithium-ion icon-name: 'battery-full-symbolic' History (charge): 1604935258 99.000 fully-charged History (rate): 1604935258 2.500 fully-charged Device: /org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001 native-path: ucsi-source-psy-USBC000:001 power supply: yes updated: Tue 10 Nov 2020 01:15:13 +10 (385 seconds ago) has history: no has statistics: no line-power warning-level: none online: yes icon-name: 'ac-adapter-symbolic' Device: /org/freedesktop/UPower/devices/DisplayDevice power supply: yes updated: Tue 10 Nov 2020 01:20:58 +10 (40 seconds ago) has history: no has statistics: no battery present: yes state: discharging warning-level: none energy: 46.198 Wh energy-full: 46.664 Wh energy-rate: 2.5 W time to empty: 18.5 hours percentage: 99% icon-name: 'battery-full-symbolic' Daemon: daemon-version: 0.99.11 on-battery: no lid-is-closed: no lid-is-present: yes critical-action: HybridSleep