Viewing information about USB-C power delivery in Linux

Does anyone know how to view information about USB-C power delviery (such as wattage delivered, voltage, etc.)?

I have a USB charger that suggests that it is working (all the lights come on as expected) but battery shows discharging, so I am curious to see if it is delivering any power or what is going on.

3 Likes

Search here for charging voltage. You’ll find something from Framework’s engineer talking about what current is required for charging.

I’ve read all that. I’m looking for how to see what the actual laptop is reporting from the charger.

Thanks for the tip.

This shows some data, it looks like it is the right kind of data, but it doesn’t include anything like charger wattage or voltage. But there are a number of fields missing, so possibly that data is not being reported.

I was hoping to find some info under /sys/class/typec, but no luck there either

1 Like

Pretty late to the party, but current_now, voltage_now and online from /sys/class/power_supply/ucsi-source-psy-USBC000:* seem to show something relevant.
Nice stable round numbers suggest that it’s negotiated values, not the actually measured ones, but hey, better than nothing.

2 Likes

I was looking for something like this also.
I.e. Something that dumps the CC1/CC2 messages and associated Voltage / Current levels.
The feedback I got was that USB PD chips don’t tend to capture those is a form helpful to debug problems. The only viable method appears to be using a usb-c breakout cable and use an external CC1/CC2 decoder.

To see actual voltage provided and current drawn, there are a bunch of inexpensive in-line usb meters on amazon etc. I recommend the RuiDeng TC66 for about $30 USD. They can’t reliably inspect/analyze the negotiation packets on the CC lines though.

The ChargerLab Power-Z KM003C ($70 ~ $100) is the best I’ve seen at detecting the protocol negotiation, but it’s still not quite 100% and it may not give all the details you want.

If you’re developing or debugging a USB-C product you may need something like the $190 Infineon CY4500 EZ-PD, available from Mouser and Digikey and the like, and requiring a lot more specialized skills to wrangle the available software and actually use. You can even try to make your own similar device (both based on an old google design that was open-sourced): GitHub - gregdavill/PD-sniffer: USB PD sniffer or GitHub - dojoe/Twonkie: A USB-PD sniffer/injector/sink based on Google's Twinkie, re-designed to be manufactured by mere mortals.

All that said, I recommend the $30 RuiDeng TC66

1 Like

That’s all nice and good but surely to debug any actual problem you would want to know what the laptop thinks it’s negotiating. Any issue would be due to discrepancies between what you see on the wire with such a snooping device and what the laptop is expecting. Just seeing one of the two is only going to give you half the picture. Worse of course it’s only giving you a third of the picture since you’re never going to know what the charger is thinking so it’s all the more important to know what the laptop is trying to do and what is actually on the wire.

Fwiw I really want to know some basic negotiation data. Like, what voltage is my laptop actually using to charge. I have to replace my framework charger – do I really need a 45W adapter? Do I need one with 20V or is my laptop actually using 15V to charge? Is it using PPS? I don’t know. This seems like basic stuff that shouldn’t be happening behind my back without any visibility.

For the basics, it really is helpful to just use a simple usb meter to see what it does with different chargers. I can tell you the FW13 does not use PPS, and it does use the 20V mode if available.

@James3 on the other hand has gone pretty far into custom EC firmware to manage the chip power levels and battery charging mode, mostly to fix stuttering on the FW16. I’m not sure if he’s done anything specifically about the low-level details or log of USB-PD negotiation there, probably not so much.

@pierce
I have done a little with USB-PD. :slight_smile:

1 Like