Twitter acquired Threader! Learn more

+ Your AuthorsArchive @Foone Hardware / software necromancer, collector of Weird Stuff, maker of Death Generators. (they/them) ko-fi: Oct. 13, 2021 11 min read

Male to male usb A cables are only illegal in the spec for one reason alone:

correction: in usb 3 (which these cables seem to be, given the coloring) they're now allowed:

Basically the reason why this cable is(/was) illegal:
USB Female/A ports (host ports) are not designed to have power fed into them. With a cable like this, you could connect to PCs (or other host devices) together, either intentionally or accidentally

because they're not designed to have power fed into them, and these cables aren't supposed to exist, they don't have to take electrical precautions to prevent you doing this, making the ports simpler and cheaper

But if you were to use one of these illegal-by-the-spec cables, you could in fact try to power a USB host port through the port, and depending on how that's wired and the power status of the two computers, you could damage it, the whole motherboard, or even both devices!

even in the case where both devices are powered on and therefore you wouldn't think there'd be any power flow in either direction, it's possible they exist at different ground levels, and therefore there'd be a current between them

it's also possible you're really lucky and have a USB port that DID take measures to avoid this problem and nothing at all bad happens, it just doesn't work.
But you're probably not going to know that until you plug it in and notice your computer not exploding

basically the spec banned these because they weren't an intended use and it made designing the host controller circuits simpler and easier, as you don't have to worry about the "what if someone tries to supply power through a USB-A female port?" case

and @matt_sieker pointed out the 3.0 spec that says they're legal now DOES also say that they need to have VBUS disconnected, so they can't send power back along the cable:

and for nearly all male-to-male cables, VBUS is going to be very connected, as that's usually the entire point

BASICALLY these cables end up existing because often when building USB devices it's cheaper and easier to use USB A ports when you should be using some other port. Laptop coolers, external hard drives, even some keyboards...

it's usually very cheap devices that exist on the margins

which is why, despite this cable being ILLEGAL BY THE SPEC, you probably have one in your USB cables box somewhere

although there are USB A male-to-male cables that are entirely legal and will not explode your computer.

These are usually called "USB transfer cables", and they don't work like a straight through cable.
The little box in the middle is actually a microcontroller, and it is going to appear as a serial port or network card, to each computer

basically each computer sees a separate network device appear, and they're on a "virtual" sort of network that only exists within the chip in that box.

importantly, this is legal because it's only taking power from one side of the connection, and it makes sure not to directly connect the two computers electrically.
There's some kind of isolation there

but yeah, you can basically think of it as a USB-to-ethernet adapter, a 1" ethernet cable, and another USB-to-ethernet adapter

and connecting two computers via ethernet doesn't cause these kinds of electrical connection issues because ethernet cards have magnetic isolation in them

Look at an old ethernet card, like this one.
See those black boxes on the right? One or more of those are magnetic isolation transformers

Magnetic isolation transformers are a type of transformer where there primary and secondary coils have no electrical connection. Electricity cannot flow from one to the other, as there's no path between them

but since the coils are placed so they can magnetically interact, an AC current on one side will create a magnetic field, which the other side will turn into an AC current.
Basically this means that power doesn't flow across them, but signals can be transmitted

so you can have two ethernet devices directly connected to each other with a cable, and not worry that one device will accidentally try to power the other.
All you can send across is signals.

fun fact: there's a reason I pulled up an old ethernet card.
Here's a more recent one.
Notice there's no big magnetics box on the card. Did they somehow remove the need for magnetic isolation?

They just put the magnetic isolation transformers INTO THE JACK ITSELF:

and the annotated cross section:

But yeah. Part of the reason why USB was able to win as the universal standard for connecting nearly all your devices together was that it was intentionally designed to be simple and cheap.

it's more expensive and complicated to build an ethernet card than a USB host or USB device, and that's why your keyboard probably doesn't plug in over ethernet.
(note to self: build one that does)

USB made some simplifying assumptions and quality-of-life decisions and therefore has some limitations, and one of those is "USB hosts will never have to deal with a USB male-to-male cable"

a design assumption that reality has proven to be entirely untrue, since people made those illegal cables anyway.

the quality-of-life thing I mentioned is that USB cables intentionally DO provide power. Ethernet does not (well, usually, I'll get into that).
Every device on an ethernet network has to provide their own power

your computer being able to power your keyboard and your mouse and your webcam is very useful, wouldn't you say?

It wasn't always the case!
Like, I have one mouse, an early Mouse Systems mouse, which has to have a separate power supply plugged in to work:

but the fact that your wired devices can mostly just plug right into your PC without needing power connected too is really helpful. It cuts down on the number of wires on your desk by a lot.

and that's a problem with an electrically isolated network like ethernet. You're setting it up to not let power flow from one device to another, so that there won't be any risk of damage...
But what if you WANT power to flow from one device to another?

There's ways USB could have been designed which would let it power USB devices and not have to worry about being back-fed power into the port, but they would have complicated the design. The hosts and maybe the devices would need more components

and now the cost-per-device has gone up, and maybe USB doesn't get adopted because of that.
So it made sense to make a simplifying assumption and just disallow that possibility, allowing the devices to be simpler and cheaper

But like I said earlier, ethernet doesn't carry power from device to device... USUALLY.

There is Power Over Ethernet, or PoE.
This is a (couple of) standards that allow you to include power in your ethernet network.

You usually see this used in things like IP phones, security cameras, and wireless access points. Basically anywhere that running more than one cable would be hard or inconvenient.

for example, the wireless account point right outside my room. just one cable, because it's powered and networked down the same cable.

Basically the way it works is by (ab)using the fact that uses twisted-pair cables with differential signaling.
Inside a cable you have pairs of cables, which twist around each other, thus "twisted pair"

the twisted nature of the pairs means that there's less electromagnetic leakage from the wires, less cross-talk between pairs, and less interference from external sources.

basically by twisting them around each other, they can counter out each other's electromagnetic emissions, and since any external source of noise affects both pairs roughly equally, it can be subtracted out

And differential signaling means that when you have two wires, you're transmitting the same signal down both but with opposite polarity.
This means the overall magnetic field should cancel itself out, and also you're less susceptible to external noise.

this is an entirely inaccurate oversimplification:
imagine you've got two cables and you want to send a signal down them. You do it by connecting and disconnecting a 5V power source. So it's either "no power" or "5V".

well, with differential signalling, you do that by sending +5V down the cable, and -5V down the other cable.
So the other end knows to look at the difference between the two sides, and it's either +5 and -5, or it's 0 and 0

but now say this cable is near some interference and it's effectively always at +5v.
Well, the interference is going to make both halves +5v

and now the other end sees either +5v and +5v, and +10v or 0v.
Since it's only looking at the differences, not the values, this is fine. it can still get the signal out.

(dear electronics geeks: I know this explanation technically makes no sense, I'm sorry)

and ethernet uses differential signaling like this because it means if your ethernet cable happens to go too close to a power cable or an AC fan or whatever, the electrical noise introduced onto the cable shouldn't degrade its ability to transmit signals back and forth

BUT this also means that if we wanted to intentionally send DC power down the cables, it shouldn't really care.

and that's exactly what PoE does (usually. Sometimes you separate them for troubleshooting reasons)

You make some of the pairs have a negative voltage, and some have a positive voltage

because ethernet uses differential signaling, it ignores that DC voltage on the line, and the magnetic isolation transformers mean power can't flow into an ethernet card and damage it

so if you have a PoE-enabled switch and plug in a non-PoE network card, it won't notice or explode.

and PoE enabled devices can make use of that DC current being provided on different differential pairs by just tapping the connector before the magnetics and applying some smoothing to turn it into whatever voltage they need to power themselves

and technically speaking there's no reason you couldn't have done all this with USB, and just used PoE ethernet to connect your keyboard and your mouse and webcam

except all this is complicated and therefore expensive.
You can buy a mouse or keyboard for under 20$, and that's partially because USB is a very simple protocol which a simple 8-bit microcontroller (the blessed 8051) can talk, and can be easily powered over

(also, PoE wasn't actually standardized until 2003, and work on USB started in 1994, with the first spec coming out in 1996)

BTW, USB uses differential signaling as well.
This is why it's a 4-wire standard.
You've got +5v, ground, and a differential pair of D+ and D-

So your USB cable doesn't start losing data because your cable gets too close to your monitor's power supply or whatever

ANYWAY part of the reason you can have USB type-C cables that are male to male and that's totally fine is that it's a different standard and a different connector.

basically for USB-C they decided it was worth requiring the extra components to make sure it wouldn't explode if you plugged two computers together, and included in the specification how to make it work properly.

This is also why sometimes you'll plug a USB-C device into another USB-C device and they'll do somewhat silly things like trying to charge the wrong way, because they can

like you plug your phone into your laptop and the laptop is like "OK CHARGING!" and you have to go WAIT NO

USB 1.0 is like "there are 4 wires and you can only connect from HOSTS to DEVICES" and USB type-C is like "that's hilarious hold my beer"

BTW, looking at that connector, you can easily see how USB-C can be connected either way up

They simply duplicated the whole connector on both sides

it's a 24 pin connector but 12 of them are the same as the other 12, just upside down.
Basically USB-C is two USB-A cables glued together with opposite polarity, so it just works no matter how you flip it

well, two USB-A cables plus a bunch of other pins that are needed for USB-3 support. USB has gotten complicated

also, cursed fact: you can make devices that work different depending on the orientation of your USB-C cable.

anyway I'm gonna stop now because I get tempted to spend my entire day ranting about USB cables

go check out my list of twitter threads if you want to read more about how things like how keyboards and mice work: 

ANYWAY one last thing:
if you have a device that requires the male-to-male cables, my suggestion is that you just make sure to keep it with the device.
zip-tie it onto it or something. Pretend the cable is permanently attached

You can follow @Foone.


Tip: mention @threader on a Twitter thread with the keyword “compile” to get a link to it.

Follow Threader