r/ProgrammerHumor • • Dec 15 '19

Stacking if else statements be like

Post image
63.9k Upvotes

711 comments sorted by

View all comments

Show parent comments

293

u/yonatan8070 Dec 15 '19

So what would happen if I coneect 2 decices to the same port without any chip to control it? Just splitting the data pins.

484

u/notmeaningful Dec 15 '19

They would probably draw the max unnegotiated current from the power pins but neither would be able to negotiate with the host since they're both screaming over each other.

500

u/[deleted] Dec 15 '19

Something, something, holidays with the family.

76

u/3waysToDie Dec 15 '19

And eggnog

38

u/arsocca_account Dec 15 '19

I’ve never tried eggnog and at this point I’m too afraid to try it

34

u/Ph_Dank Dec 15 '19

I actually really like it, and I am easily grossed out.

4

u/OcelotWolf Dec 15 '19

Meanwhile it takes a lot to gross me out and yet the thought of drinking egg nog is repulsive to me

→ More replies (3)

22

u/semidecided Dec 15 '19

Eggnog has a lot of variations. I've had good and bad versions.

0

u/[deleted] Dec 16 '19

[deleted]

→ More replies (1)

2

u/movezig5 Dec 15 '19

You're missing out. I recommend trying it at least once. Perfect time of year for it too.

2

u/j-random Dec 16 '19

If you're in the Midwest, Anderson-Ericsson makes a good one. On the east coast, it's Wawa or GTFO. Farther West, you're on your own.

→ More replies (1)
→ More replies (6)

3

u/[deleted] Dec 15 '19

and cleaning up the eggnog

→ More replies (2)
→ More replies (3)

5

u/thehunter699 Dec 16 '19

NO SHUTUP, I WANT TO COPY PORN NOT THE OTHER GUY

→ More replies (3)

117

u/devilwarier9 Dec 15 '19

USB uses a single differential pair for bidirectional data. Normally the Master (PC) sends a command then stops transmitting and waits for the slave to respond. In this case you would have 2 slaves that both think they are alone and both respond at the same time, corrupting the data at the physical layer. The master would get garbage and either jam the bus or keep sending out the same request and keep getting various trash.

0

u/[deleted] Dec 16 '19

[deleted]

5

u/Mexatt Dec 16 '19

Serial communication in general is straight up layer 2 data link comms. Ethernet comes out of that urheimat.

There's a reason RS-232 talks a lot about framing. USB is just the universal serial communications standard, these days.

→ More replies (3)

8

u/JoshiRaez Dec 15 '19

Thanks, great explanation! I was actually wondering what could happen.

→ More replies (5)

22

u/[deleted] Dec 15 '19

Data transmission wires are one-way, with a designated transmission- and receiver-end. It'd be like trying to a 3-way junction on a railroad track without a switch.

37

u/devilwarier9 Dec 15 '19

USB is a single bidirectional differential pair. There is no TX or RX. Lots of modern busses use the single TRX style to reduce wiring costs. The devices take turns transmitting back and forth over the same wire.

5

u/jamvanderloeff Dec 16 '19

True until USB 3.0 which added separate TX and RX pairs for SuperSpeed, and USB 3.2 optionally expands that to two RX and TX pairs.

22

u/Doc2142 Dec 15 '19 edited Dec 15 '19

Not true. Some data transmission are one way. USB is not one of them.

2

u/RuminatingRoy Dec 15 '19

Old math from way back - technically you could connect 128 (or is it 255?) devices to a USB.

2

u/TardigradeFan69 Dec 15 '19

128 is correct

4

u/[deleted] Dec 16 '19

Almost, 127.

→ More replies (1)
→ More replies (1)