All About USB
Jun 17, 2023
Let’s be clear – it’s not enough to have USB-C to USB-C cables. There’s a lot of cables that we might want to acquire for our day-to-day use, perhaps, for a transition period while we still own some amount of devices not adorned with a USB-C connector. However, the USB-C specification only accounts for a limited amount of kinds of cables, explicitly or implicitly excluding a range of cables that you might want to buy or make.
It’s my firm belief that, as a hacker, you should be able to buy any USB-C contraption that you could ever need. Hackers don’t need restrictions driven by marketing – they need understanding of how a piece of tech can or cannot be used, based on how it operates internally. I would like you to provide with such understanding, so that you can make informed decisions.
On the other hand, USB-C is designed to be used by less-than-skilled people, even if it often fails at that. (Cable labelling, anyone?) Clear definitions of what complies to a standard can help enforce it. Here’s the notorious story of a USB-C cable that killed a Chromebook, and launched a career of explaining USB-C specifics online for [Benson Leung]. There’s many such failure stories, in fact. Today, we’ll go through USB-C contraptions which might or might not fail you, depending on how you use them.
USB-C extension cables are not USB-C-specification compliant. Or are they? Are they a problem in practice, even if they’re not compliant? Let’s look at a bad example of one. Let’s say, you want to extend the power port on a Raspberry Pi 4.
Here’s a Type-C extension cable that forwards VBUS and USB 2.0 data lines – but not CC pins. If you use this extension with a Raspberry Pi 4, the 5.1 kΩ resistors on the Raspberry Pi port are no longer accessible on the female end of the extension, and a Type-C power supply can no longer power the Raspberry Pi involved. Well, unless it’s the official Raspberry Pi “Type-C” power supply, which has no way to detect resistor presence – of course, violating the Type-C specification, but operating as a USB-A to USB-C cable for all intents and purposes, which makes the violation not that significant.
What if the extension were to forward a CC pin with a separate wire inside the cable? It could, indeed; some extensions do that. Sadly, this means they only work in one rotation, and whenever you plug a cable into such an extension, you might have to flip it before it works. Doubly so for F-F couplers – there, you will have to rotate the cable 50% of the time if you want the coupling to work
What about forwarding both CC pins, each one with a separate wire? That would indeed work, and these are sold online, too. In fact, that’s how USB-C expansion cards on the Framework laptop work – since the expansion card connector on the laptop is USB-C, those cards are just a really short USB-C extension that forwards pins one-to-one. Is that different from a cable extension? Yes.
What’s the problem with extensions? First off, there’s a conundrum where such cables aren’t compliant to the specification, and most reputable manufacturers don’t make them because they don’t want to fall out of favour with USB standards group – which means you often have to rely on the less-than-reputable manufacturers, with subpar quality control. Given everything that we use USB-C for, that can go awry somewhat quickly. Now, why wouldn’t it be spec-legal?
Say, you have a “pass every pin through” USB-C extension, that can only handle 3 A internally. If you ever try to charge your 100 W-capable device with a 5 A PSU and 5 A-capable cable with such an extension in series, the PSU would supply 5 A, being none the wiser, but you could find yourself in a dangerous situation where your cable insulation starts to melt. On the other hand, it’s my understanding that a Raspberry Pi 4 will never consume over 3 A, so in that use case, you can probably get away with it, but it’s on you.
When it comes to high-speed signals, there are more pitfalls. USB-C cables already have to be built to a certain standard to work for 40 Gbps data rates, as opposed to being limited to 20 Gbps. If you use an extension that forwards the high-speed wires in order to connect a high-speed peripheral, you might find that your device becomes more glitchy, reconnecting every now and then.
The USB-C specification probably could have solved these problems with extra e-marker logic, which would’ve created a way for USB-C extensions to coexist peacefully, but they decided not to bother. Framework USB-C expansion cards don’t bother anyone, because they are verified to work well in their use scenario and not cause signal issues. As a hacker, should you be able to buy a USB-C extension cable if you need one? Yes. Should you know about the pitfalls associated? Also yes. Let’s talk more about cable pitfalls.
Every cable is required to have at least a USB 2.0 pair. We do know about cases when that’s undesired, however – having seen malicious USB chargers, cables, and simply exploits that can wreck your phone when it’s connected to a PC. You might be reaching for the Aliexpress Buy Now button on a “data isolator” cable, and again, it helps if you know what’s the issue with such cables, so that you can make informed choices as a hacker… not that kind of hacker.
When connected to a USB-A port, the only way to negotiate power draw (specifically, current, and sometimes voltage) is to use the data lines. These charging cables are built to facilitate this, and they tend to short the data lines together – signalling the device that it can draw up to 1.5 A. However, as the data lines are disconnected from the charger port, the phone doesn’t know if the charger actually shorts these lines, signalling the 1.5 A supply ability. The overwhelming majority of ports can do 1.5 A, laptops and chargers alike. Some really old ports (or smartphone USB-OTG ports) only do 500 mA, and small portion of those ports don’t have overcurrent protections as the USB standard requires them to.
These situations are seriously rare. Nevertheless, this conundrum makes people online disappointed when it comes to existence of data blocker cables. Some chargers don’t bother with negotiation, but some of them do. This creates funny situations, like Sony PlayStation controllers not charging from certain chargers.
Anyway, I don’t know about you, but it’s clear as day to me, that the USB-C restriction on data-blocking cables is a plot by all the intelligence agencies of the world, working in unison with unseen levels of cooperation, and it’s your duty to stick it to them and buy data blocker cables anyway. On a more serious note, 500 mA-only ports are rare, 500 mA-only ports without overcurrent protections even more so, and you can certainly just consciously avoid such ports if you’re using a data blocker cable.
By the way, if your data blocker cable has a CC wire (as it should, if you want to have data transfer), remember that a multitude of USB-C controller chips allow firmware update over the CC connection, and they’ve been known to, ahem, not be perfectly secure about this. Which is to say, if you want to protect yourself, you might just want to speak softly and carry a big powerbank.
As a rule of thumb, most adapters with a female USB-C socket on them are non-compliant. It still won’t stop me from building a bunch of such cables and mailing them to my friends, and it shouldn’t stop you either. Again – what specifically makes such adapters non-compliant?
Here’s a USB-A male to USB-C female passive adapter, I used this one a lot after my laptop’s only USB-C port died of mechanical causes, but I still needed to use USB-C devices on the regular. Nowadays, I use this adapter to charge USB-C devices from my USB-A-only powerbank. Such an adapter is usually wired to USB 2.0 only – since high-speed signal dual orientation handling in USB-C requires active electronics, if you find such an adapter that actually works for USB 3.0, my money is that it will only work for USB 3.0 in one orientation of the USB-C plug, falling back to 2.0 in another.
Two of this adapter, or one adapter and a USB A-C cable, will also let you build a USB-A to USB-A male-male cable. You shouldn’t ever need to, but someone theoretically can do it, and the USB-C group really dislikes this possibility. If you plug two devices together with an A-A cable, it will cause a current fight between two 5 V supplies, which might result in unpredictable consequences – switch-mode power supplies dislike when you do such things with them, and protection chips for ports might not be able to handle such problems either.
The problem isn’t that a hacker will inevitably build an A-A cable and smoke their laptop. The problem is that a less-than-savvy user might do it. Making these adapters non-compliant is a discouragement for anyone looking to build these adapters, especially large manufacturers. Oh, and the adapter I’m showing, also has footprints for USB-C power-supply-side resistors (pullups), but doesn’t even bother to populate it. This is also quite uncouth. That said – this adapter is very useful.
Sometimes, you will see a barrel plug female to USB-C adapter being sold. I’m not talking about trigger boards here, where you plug a USB-C PSU into a board and it provides you with high voltages out of a barrel jack – I’m talking about adapters that you plug a barrel jack PSU into, and then connect it to a USB-C device. Obviously, there’s zero protection involved, and I’m not even talking about resistors anymore.
This adapter is equivalent to a USB-A to USB-C cable when used with a 5 V supply. There’s zero built-in guarantee that such an adapter would only ever be used with a 5 V supply. A hacker might never plug anything other than a 5 V supply into it, of course. With an average user, you really, really can’t rely on that being the case, and they will kill some device of theirs. And on some days, any hacker will eventually behave just like an average user; you can’t always be on your guard.
Not all devices require negotiation before they accept high voltages on their USB-C port, however. For instance, the Pinecil soldering iron does not. I built a female barrel jack to female Type-C adapter so that I could use nice silicone flexible cables with my Pinecil and a barrel jack 20 V power supply.
If you were to plug a Type-C cable from such an adapter into your laptop while 20 V is provided to it, the laptop would most likely die. There are multiple cases of laptops that are known to have died in this exact situation, in fact. Sometimes, USB-C ports provide protection from such situations, as some early USB-C power supplies could create such a situation alone – not switching back, and happily feeding 20 V to the next device plugged in. That said, we will talk about this later, too.
For now, I have written “DO NOT” on the cable plugs of the cable I use with this adapter, to make sure I never plug this cable into anything else. If you were hoping I have a better idea, I do, indeed. There are seemingly legitimate adapters like this, that are stated to be designed for use with laptops, and the Aliexpress keyword seems to be “USB PD Step Down”. (Props to @Ralimtek!) They only go up to 60 W, but they appear to do negotiation, and if it’s indeed the case that they actually only bring the voltage up to 20 V after that’s negotiated, they ought to work perfectly for charging your USB-C laptop from a barrel jack. I also fully intend to build my own adapter that does negotiation, perhaps even make it a 100 W one – honestly, I have way too many 20 V power supplies laying around and I want to put them to good use.
There’s a lot more to USB-C standards compliance. I would not be surprised if the venerable Type-C trigger boards were non-compliant because of some signalling that the trigger IC does not provide. We hackers use them in large quantities nevertheless, and we will only use more as time goes on. USB-C non-compliance doesn’t prevent us from having tons of fun building cool USB-C things.
Sometimes people argue that places like Amazon should take non-compliant electronics down. Indeed, the Chromebook-destroying cable has no business being sold, as it’s straight up a hostile design masquerading as an innocent one. The humble A-C male-female adapter, however, is undoubtedly worth keeping around, even if it shouldn’t really be sold in big box stores.
What’s your favourite non-standards-compliant device?