I'm wondering if it can be hacked to be used as a power supply for homebrew projects. It would be really convenient give it can supply a couple amps at a variety of common voltages.
The big issue is you need a PPS capable supply(More and more seem to support it). With that you have full current and voltage control.
Without it you get 5v, 9v, maybe 12v(I think it's deprecated or removed, not sure if it still works on new stuff, sadly, because 12v is so common), 15v, and 20v. Plus the new high voltage modes.
You asked how does that work. Well, search for "usb-pd negotiation" and find out. Typically a source enumerates what it can do (lists some "power data objects", pdos) and a device files a request based on one, but I believe devices can & do ask for arbitrary things they want, especially if they dont find what they hope for, & them latter fall back to slower often 5v backup voltages if they can (or not). Thats the two sentance summary but theres a ton of info & its easy to learn more & you can download the spec & find out yourself if searching around still leaves you eith questions.