Command-line script, app-menu/desktop launcher and per-user installer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.0 KiB
Markdown
69 lines
2.0 KiB
Markdown
# pdinfo
|
|
|
|
See what USB-C Power Delivery (PD) your Linux laptop is actually getting from its charger.
|
|
|
|
Desktop settings usually only say "plugged in". `pdinfo` reads the kernel's USB Type-C sysfs
|
|
interface and shows whether the charger negotiated PD, every voltage/current it offers,
|
|
its max wattage, and how fast the battery is charging right now.
|
|
|
|
```
|
|
=== USB-C Charger Info ===
|
|
|
|
[port0]
|
|
Mode: usb_power_delivery
|
|
PD supported: yes
|
|
PD revision: 2.0
|
|
Charger offers:
|
|
fixed_supply 5.0 V 3.00 A = 15 W
|
|
fixed_supply 9.0 V 3.00 A = 27 W
|
|
fixed_supply 15.0 V 3.00 A = 45 W
|
|
fixed_supply 20.0 V 2.25 A = 45 W
|
|
Charger max: 45 W
|
|
|
|
Battery BAT0: 33%, Charging, 29.7 W
|
|
```
|
|
|
|
A charger (or cable) that isn't doing PD shows:
|
|
|
|
```
|
|
Mode: 3.0A
|
|
PD supported: no
|
|
(no PD contract - plain USB-C power, max 15 W)
|
|
```
|
|
|
|
## Install
|
|
|
|
```sh
|
|
git clone https://gitea.apointless.space/bsncubed/pdinfo.git
|
|
cd pdinfo
|
|
./install.sh
|
|
```
|
|
|
|
This installs, for the current user only (no root needed):
|
|
|
|
- `~/.local/bin/pdinfo` - run `pdinfo` in a terminal
|
|
- a **USB-C Charger Info** entry in your app menu
|
|
- the same launcher on your desktop (skip with `./install.sh --no-desktop-icon`).
|
|
On GNOME/Ubuntu you may need to right-click it and pick **Allow Launching**.
|
|
|
|
Uninstall with `./install.sh --uninstall`.
|
|
|
|
## Requirements
|
|
|
|
- Linux with the USB Type-C class (`/sys/class/typec`) and USB PD class
|
|
(`/sys/class/usb_power_delivery`, kernel 6.0+). Most modern laptops expose this via UCSI.
|
|
- bash and awk.
|
|
|
|
## Notes / caveats
|
|
|
|
- The listed offers come from the charger's Source Capabilities as reported by the
|
|
laptop's PD controller firmware. Some firmware reports little or nothing; if `PD supported`
|
|
says `no` with a charger you know does PD, try a different cable first.
|
|
- `voltage_now` from the UCSI power supply is often stale on some laptops, so `pdinfo`
|
|
reports the charger's offers and the battery charge rate instead.
|
|
- The PD revision shown may reflect the laptop side of the connection rather than the charger.
|
|
|
|
## License
|
|
|
|
MIT
|