Live data from Hacker News

A macOS terminal command that tells you if your USB-C cable is bad

kau.sh

31–40 of 197 posts

Re: A macOS terminal command that tells you if your USB-C cable is bad

#31

Two years ago, I wouldn’t have bothered with the rewrite, let alone creating the script in the first place. The friction was too high. Now, small utility scripts like this are almost free to build. This aligns with the hypothesis that we should see and lots lots of "personalized" or single purpose software if vibe coding works. This particular project is one example. Are there a ton more out there?

Absolutely. I can come home from a long day of video meetings, where normally I'd just want to wind down. But instead I spend some time instructing an AI how to make a quality of life improvement for myself.

Re: A macOS terminal command that tells you if your USB-C cable is bad

#32

Earlier quoted context omitted.

yeah sorry about that. I don't have access to a Linux/Windows machine. if I got a hold of the output and commands run, would gladly modify it.

Is it really vibe coding if you’re testing it on the target machine? ;)

Yes, I think? “Vibe coding” is more about whether you are reading/reviewing the generated code, or just going with it, afaik.

Re: A macOS terminal command that tells you if your USB-C cable is bad

#33
Vibe coding. Producing code without considering how we should approach the problem. Without thinking where exactly is the problem. This is like Electron, all over again.

Of course I don't have any problems with the author writing the tool, because everyone should write what the heck they want and how they want it. But seeing it gets popular tells me that people have no idea what's going on.

Re: A macOS terminal command that tells you if your USB-C cable is bad

#34
post #14
post #5

It's more complicated than "this cable is good/bad". I had a suspicion about one of my cables for months, but just last week I confirmed it with a device that shows the volts/amps/watts/total kwh passing through it: I have a USB-C cable with orientation. Plugged in one way it transfers about 5x more power than the other way, and in the lower orientation it's low enough for the earbud case I use it with to not charge.

Wait what. I thought half the point of usb c was to not rely on orientation. Is there any way to check this other than experiment? My "solution" so far has been to not buy cheap cables and just hope I get quality in return.

> I thought half the point of usb c was to not rely on orientation. > Is there any way to check this other than experiment?

Well sure, a standards-compliant cable will work in either orientation, but it's always possible for some but not all of the pins or wires to break.

Re: A macOS terminal command that tells you if your USB-C cable is bad

#35
post #14

Earlier quoted context omitted.

Wait what. I thought half the point of usb c was to not rely on orientation. Is there any way to check this other than experiment? My "solution" so far has been to not buy cheap cables and just hope I get quality in return.

I think that I have a specific cable-device-orientation that is broken. Meaning, I think a particular USB C cable won't charge my phone if it's plugged in 'backwards'. I always assumed that USB C cables use different pins depending on orientation, and that some pins on the cable wore down. Maybe that's what happened here?

My guess would be they used a one-sided pcb to connect the cable to and used half the wires. Some sockets internally link the power and ground pins, so it works both ways, but you get no resistor network and thus only standard 5v which gives you 500ma max (at best). With the resistors connected by the cable it's about 900ma to 3a which is probably what happens plugged in "correctly". Or some other magic happens on one side of the PCB to fool the charger into pushing the full 3A.

Re: A macOS terminal command that tells you if your USB-C cable is bad

#36
post #22
post #2

> The script parses macOS’s system_profiler SPUSBHostDataType2 command, which produces a dense, hard-to-scan raw output I couldn’t find source (the link in the article points to a GitHub repo of a user’s home directory. I hope for them it doesn’t contain secrets), but on my system, system_profiler -json produces json output. From that text, it doesn’t seem they used that.

Correct. But you didn't see that the source was one level up in the directory tree from the untrustworthy binary blob? * https://github.com/kaushikgopal/dotfiles/blob/master/bin/usb... Presumably there is a sensible way to do this in go by calling an API and getting the original machine-readable data rather than shelling out to run an entire sub-process for a command-line command and parsing its human-readable (even…

> But you didn't see that the source was one level up in the directory tree from the untrustworthy binary blob?

No, silly me. Shortly searched for a src directory, but of course, should have searched for a bin directory, as that’s where vibe coding stores sources /s.

Re: A macOS terminal command that tells you if your USB-C cable is bad

#40

Earlier quoted context omitted.

yeah sorry about that. I don't have access to a Linux/Windows machine. if I got a hold of the output and commands run, would gladly modify it.

fwiw, it would take 10 minutes to download a linux docker image and build it in go to test. The harder part is getting the information from a different API on Linux.

... and orders of magnite more time to properly access USB devices to some arcane VM not in your control
Post reply on HN