← writings

Computer autofellatio

I was sitting in a cafe today writing an essay about agents, and I had a USB-C cable on the table with nothing on the other end of it. My MacBook has two USB-C ports on the left side, right next to each other. And the thought that arrived, uninvited, was: what happens if I plug the laptop into the laptop?

I am aware this is a stupid question. I was also aware, before I did it, that this was going to be the most fun I'd have all afternoon. So I unplugged the MagSafe charger, held it in my other hand as a control group, and connected port one to port two.

A MacBook on a cafe table with a USB-C cable next to its two left-side ports, not yet connected. The MagSafe charger is held away from the laptop. The same USB-C cable now plugged into both left-side ports of the MacBook, connecting the laptop to itself. The MagSafe charger is still held in the other hand, disconnected.
Before and after. The MagSafe charger in my hand is not connected to anything. The only power source in this picture is the laptop.

Here is what happened. The little battery icon in the menu bar got a lightning bolt on it. The laptop announced, with total confidence, that it was charging.

The bolt appears. The laptop is plugged into nothing but itself.

I laughed for longer than I should have. My laptop, a machine that costs more than my first car, was sitting there sourcing energy to itself and reporting the result as a win. It's the electrical version of trying to lift yourself off the ground by pulling on your own shoelaces, and then telling everyone you're flying.

Why it thinks it's charging

It's not actually charging, obviously. You can't get energy from nowhere. The battery was very slowly draining the whole time, slightly faster than normal, because every conversion loses a bit as heat. But the interesting part isn't the physics. It's why the software believed it.

Every USB-C port on a modern MacBook can do two jobs. It can give power out, which is how it charges your phone or runs a hub, or it can take power in, which is how the laptop charges from a wall brick. The port doesn't know ahead of time which job it's going to do. So when you plug something in, there's a tiny negotiation over one of the wires in the cable. Each side says, roughly, "I can give power" or "I want power," and they settle on who's who. When you plug in a phone, the phone says "I want power" and the Mac says "sure," and the Mac becomes the source.

When you plug a Mac into itself, both ends of the cable are the same laptop, and both ports start the negotiation. Neither has been told what to be. So the ports do what the USB-C spec says to do in that situation: each one flips back and forth between "I'll give" and "I'll take" at slightly random intervals until, by chance, one is saying "give" at the moment the other is saying "take." At that instant they lock in. One port becomes the source, the other becomes the sink. It's a coin flip settled by timing, which is why it takes a beat before anything happens, and why the bolt sometimes shows up on a different side if you do it twice.

Now the sink port has five volts on it and a partner that says it's willing to deliver power. As far as that port is concerned, an adapter just got plugged in. It reports up to the little chip that manages power on the Mac, the one that decides what the battery icon shows, and that chip has a simple rule: if a port has negotiated incoming power, we're on external power. Show the bolt. It never asks where the power is coming from. It doesn't have a concept of "from me." The other port, meanwhile, is doing exactly what it does for your phone, happily pushing out a few watts to what it thinks is an accessory.

So you get two halves of the same computer, each doing its job perfectly, each completely unaware the other half is the same machine. The source port thinks it's charging a gadget. The sink port thinks it found a charger. The battery icon believes the sink port. And the battery itself, the only honest party in the whole arrangement, quietly loses a few percent an hour.

If you open the battery menu instead of just looking at the icon, you might catch it hedging. Depending on the Mac and what the source port decided to offer, it will sometimes say "Not Charging" next to the bolt, which is the system's way of saying "there's power coming in but not enough to actually gain on." The bolt only means "connected to power." It doesn't mean the number is going up. Which, in this case, is the truest thing on the screen.

Why I liked this

There's a version of this story where the punchline is "haha, dumb laptop." That's not really it. Every piece here did its job correctly. The ports followed the spec. The negotiation resolved. The power chip applied its rule. The bug, if you want to call it one, is that nobody designed for the case where the thing on the other end of the cable is you. Why would they? It's an absurd case. And yet a machine with no concept of "self" will confidently tell you it's feeding itself.

I spend a lot of my time these days thinking about agents that hold beliefs about their own state that quietly drift away from the truth. I wrote about it this morning, actually. Then I plugged my laptop into itself and watched the exact same thing happen in hardware, with a lightning bolt. Sometimes the universe is not subtle.

Anyway. Don't leave it like that, it makes the ports warm for no reason. But do try it once. It's a good laugh for a Tuesday.

← more writings