←back to thread

298 points croes | 1 comments | | HN request time: 0s | source
Show context
franky47 ◴[] No.45088822[source]
I own a Switch 1, and the other day I wanted to play on the train, but the battery was low. I figured "no problem, I can connect it to my laptop and let it charge off is battery".

Nope. The MacBook Pro started charging off the Switch instead.

replies(3): >>45088936 #>>45089070 #>>45089390 #
parhamn ◴[] No.45088936[source]
I've wondered how this works (and who wins).
replies(2): >>45088994 #>>45089013 #
scottapotamas ◴[] No.45088994[source]
For two DRP (dual role) devices connected to each other, I believe in a default case the one that happens to advertise as a source first just becomes one.

The standard allows for a role swap at any point while connected, and if that’s triggered will be dependent on the firmware/config on one or both ends.

There’s probably more nuance hiding in the real world hardware too.

replies(2): >>45089023 #>>45089443 #
unsnap_biceps ◴[] No.45089023[source]
According to https://superuser.com/a/1773195

> Any DRP port must have pull-down 5k1 resistors on CC wires (as a sink), AND 10-22-56k pull-ups (as provider), but not at the same time. The DRP then alternates the sink advertising (5k1 pull-downs) with pull-ups (source advertising) about 10 to 20 times per second.

> If another DRP is connected, they both will toggle their advertising until a correct (pull-up - pull-down) combination occurs. Then CC controller(s) will stop toggling, and the end that happens to be in provider mode will provide +5VSAFE VBUS. The process will end in one or other direction, which will happen at random (since frequencies of toggling are independent).

replies(1): >>45089396 #
franky47 ◴[] No.45089396[source]
A protocol designed on who wins an race condition? That's wild.
replies(3): >>45089606 #>>45090342 #>>45090354 #
1. toast0 ◴[] No.45089606{5}[source]
Ethernet has been doing this kind of thing for four decades. With only two nodes and short cables, you'll rapidly converge.