From the definition of the TI documentation page 3:

- A sink is a port that when attached consumes power from VBUS and a
sink is most often a device. A sink could include USB peripherals such
as a USB powered light or fan.

- A source is a port that when attached provides power over VBUS. Common
sources are a host or hub DFP. An example of a source application is a
USB Type-C wall charger.

The definitions are a bit confusing because when connecting two devices 
together, one port will be in sink and the other in source, so the definition 
needs to be read based on the perspective of the device being mentioned.
 
For example a webcam plugged in to the usb-c port of laptop, will have it's 
port in sink mode since power "sinks" to it from the laptop, but the laptop 
port will be in source mode since it is a "source" of power for the webcam. 

When charging a laptop, it is the one consuming power so it's port is in
sink mode while the usb charger will have it's port in source mode (a
USB wall charger will always be a source of power).

Thus although a laptop's USB-C port will always be in source mode when a
webcam or keyboard is plugged in to it, the webcam and the keyboard are
called "sink" devices since their ports are in sink mode and the laptop
will be the "source" device.

You can also confirm this view by looking at the systemd logs of
systemd-ac-power, where it first verified that the port was in sink mode
before checking if there was anything connected to it (they would have
been ignored if they were in source mode). And when nothing was
connected is did a fallback where it checked the battery status.

I have looked at systemd upstream and found an issue [1] mentioning that
intel NUC devices have their ports in sink mode by default (none are in
source mode), this lead to a PR [2] that added the battery check you saw
when enabling the systemd logs

[1] https://github.com/systemd/systemd/issues/24214
[2] https://github.com/systemd/systemd/pull/24220

** Bug watch added: github.com/systemd/systemd/issues #24214
   https://github.com/systemd/systemd/issues/24214

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1980991

Title:
  /usr/sbin/on_ac_power incorrectly reporting ac power status

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/powermgmt-base/+bug/1980991/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to