Bug#1025141: powermgmt-base: Doesn't correctly detect we are on AC power

2023-03-01 Thread Raymond S Brand

Followup to Santiago's report:

The script is also reporting that my Dell 3260CFF (Compact Form Factor) 
is not on AC power when it is since it doesn't have a battery option.


The following may be of some help:

$ sh -x /sbin/on_ac_power
+ set -e
+ OFF_LINE_P=no
+ [ -d /sys/class/power_supply/ ]
+ test -d /sys/class/power_supply/hidpp_battery_0
+ test -r /sys/class/power_supply/hidpp_battery_0/type
+ cat /sys/class/power_supply/hidpp_battery_0/type
+ type=Battery
+ test -d /sys/class/power_supply/ucsi-source-psy-USBC000:001
+ test -r /sys/class/power_supply/ucsi-source-psy-USBC000:001/type
+ cat /sys/class/power_supply/ucsi-source-psy-USBC000:001/type
+ type=USB
+ [ -r /sys/class/power_supply/ucsi-source-psy-USBC000:001/online ]
+ cat /sys/class/power_supply/ucsi-source-psy-USBC000:001/online
+ online=0
+ [ 0 = 1 ]
+ [ 0 = 0 ]
+ OFF_LINE_P=yes
+ [ yes = yes ]
+ exit 1
$

The H/W doesn't actually have a battery option but does use a laptop 
style power brick or USB-C to supply power.




Bug#1025141: powermgmt-base: Doesn't correctly detect we are on AC power

2022-11-30 Thread Santiago Garcia Mantinan
Hi!

> It's possible that your machine can indeed be powered via USB C, new laptops
> usually can.  Which leads to fun like laptop that wants to be charged by a
> phone -- and indeed negotiating it that way.

If it was like that... do you think that USB-C would be a real USB or just
for power delivery? I could atach a USB-C hub I have arround. I don't think
a PD power supply will be able to supply enough power unless I unplug the
two SATA HD I have plugged and the graphic card. I could try to unplug all
this and try to get a PD power supply to test if you feel it would help us.

> Could you perhaps provide:
> cd /sys/class/power_supply && grep . */* 2>/dev/null|grep -v /uevent:

ucsi-source-psy-USBC000:001/current_max:0
ucsi-source-psy-USBC000:001/current_now:0
ucsi-source-psy-USBC000:001/online:0
ucsi-source-psy-USBC000:001/type:USB
ucsi-source-psy-USBC000:001/usb_type:[C] PD PD_PPS
ucsi-source-psy-USBC000:001/voltage_max:0
ucsi-source-psy-USBC000:001/voltage_min:0
ucsi-source-psy-USBC000:001/voltage_now:0

Regards...
-- 
Manty/BestiaTester -> http://manty.net



Bug#1025141: powermgmt-base: Doesn't correctly detect we are on AC power

2022-11-30 Thread Adam Borowski
On Wed, Nov 30, 2022 at 08:52:41AM +0100, Santiago García Mantiñán wrote:
> I'm running Debian stable on a HP ProDesk 600 G6 Small Form Factor PC
> (Family: 103C_53307F HP ProDesk)
> 
> It is a desktop machine which ovbiously runs on AC all the time, however
> on_ac_power returns 1 which is stopping things like unattended upgrades from 
> being run.
> 
> On /sys/class/power_supply/ there is only:
> lrwxrwxrwx 1 root root 0 Nov 29 14:53 ucsi-source-psy-USBC000:001 -> 
> ../../devices/platform/USBC000:00/power_supply/ucsi-source-psy-USBC000:001
> and there... /sys/class/power_supply/ucsi-source-psy-USBC000\:001/type
> says USB.

The SoC might be shared with laptops/etc and thus expose devices that are
present but not fully functional.

> I have opened the machine and the power supply seems to use only a couple of 
> 12V
> 4 pin connectors like the one introduced with the P4, but that's it, no sign 
> of USB.

The hardware block known as "power supply" it just one of possible sources
for the machine.  For example, Pine64 boards can be powered by:
 * "ac" (dumb USB micro-B)
 * battery
 * USB type A OTG (a _host_ not gadget interface)
 * (sort of) UART (insufficient power for stable operation)
and only the first two even have sensors that inform the kernel.

> My guess is that the USB thing there is one USB-c connector on the front of
> the machine, in fact it says on usb_type [C] PD PD_PPS which I guess means
> that the connector is compatible with power delivery.

It's possible that your machine can indeed be powered via USB C, new laptops
usually can.  Which leads to fun like laptop that wants to be charged by a
phone -- and indeed negotiating it that way.

> For what I see, acpi doesn't have info on power suppy, no sign of it
> executing acpi -V and /proc/acpi only has wakeup inside.  And there is no
> pmu or apm info either.

ACPI doesn't (usually?) know about USB devices; PMU and APM are stuff from
the distant past.

> I don't know what other info to add here, but please don't hesitate to ask
> whatever you need.

Could you perhaps provide:
cd /sys/class/power_supply && grep . */* 2>/dev/null|grep -v /uevent:


Thanks for your report -- with all those new USB-C power delivery schemes
actually being used by machines in the wild, it's time to recognize them,
instead of relying on the old assumption that "USB power supply" means
incoming power.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ Quis trollabit ipsos trollos?
⠈⠳⣄



Bug#1025141: powermgmt-base: Doesn't correctly detect we are on AC power

2022-11-30 Thread Santiago García Mantiñán
Package: powermgmt-base
Version: 1.37
Severity: normal

Dear Maintainer,

I'm running Debian stable on a HP ProDesk 600 G6 Small Form Factor PC
(Family: 103C_53307F HP ProDesk)

It is a desktop machine which ovbiously runs on AC all the time, however
on_ac_power returns 1 which is stopping things like unattended upgrades from 
being run.

On /sys/class/power_supply/ there is only:
lrwxrwxrwx 1 root root 0 Nov 29 14:53 ucsi-source-psy-USBC000:001 -> 
../../devices/platform/USBC000:00/power_supply/ucsi-source-psy-USBC000:001
and there... /sys/class/power_supply/ucsi-source-psy-USBC000\:001/type
says USB.

I have opened the machine and the power supply seems to use only a couple of 12V
4 pin connectors like the one introduced with the P4, but that's it, no sign of 
USB.

My guess is that the USB thing there is one USB-c connector on the front of
the machine, in fact it says on usb_type [C] PD PD_PPS which I guess means
that the connector is compatible with power delivery.

I guess BIOS may be the one to blame here, I have updated to the latest, now it 
is running...
Version: S07 Ver. 02.13.00
Release Date: 10/12/2022

It still happens with that BIOS, I even tried to use kernel 6.1 rc6 as
available on experimental right now to see if that made any change, but that
didn't change a thing.

For what I see, acpi doesn't have info on power suppy, no sign of it
executing acpi -V and /proc/acpi only has wakeup inside.  And there is no
pmu or apm info either.

I don't know what other info to add here, but please don't hesitate to ask
whatever you need.

Regards.

-- System Information:
Debian Release: 11.5
  APT prefers stable-security
  APT policy: (990, 'stable-security'), (990, 'stable'), (500, 
'stable-updates'), (500, 'proposed-updates'), (500, 'oldstable-updates'), (500, 
'oldstable-proposed-updates'), (500, 'oldoldstable'), (500, 'unstable'), (500, 
'oldstable'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-19-amd64 (SMP w/12 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=gl_ES.UTF-8, LC_CTYPE=gl_ES.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

-- no debconf information