←back to thread

298 points croes | 1 comments | | HN request time: 0.232s | 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 #
1. stephen_g ◴[] No.45089443[source]
They can also prefer one role, with a mechanism called Try.SNK and Try.SRC (‘try sink’ / ‘try source’).

Basically DRPs toggle back and forth between sink and source until they happen to match up (one side has switched to source and one to sink). If it doesn’t prefer to do the role it’s resolved to randomly, it can switch to the other way and wait a bit - if the other side is fine with it then it will switch too and everyone is happy, if not you can switch back.

We use this for a device that can on-charge a device when it has external power plugged in (in which case we prefer source role) but not when running on battery (in which case we prefer sink but don’t actually pull any power because it’s self powered).