Live data from Hacker News

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

kau.sh

21–30 of 197 posts

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

#21
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?

I think a more distressing thought is that it’s quite possible that your cable won’t charge your phone if it’s plugged in forwards.

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

#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 JSON) output. Especially as it turns out that the command-line command itself runs another command-line command in its turn. StackExchange hints at looking to see what API the reporter tool under /System/Library/SystemProfiler actually queries.

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

#23
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.

[deleted]

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

#24

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.

This post is 12 minutes old. Have you finished yet?

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

#27
post #9

Please update the title to mention that this is MacOS only; I got excited to try this out, but I only have laptops running Linux and Windows.

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? ;)

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

#28

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?

Definitely.... I just bought a new NAS and after moving stuff over, and downloading some new movies and series, "Vibe coding" a handful of scripts which check completeness of episodes against some database, or the difference between the filesystem and what plex recognized, is super helpful. I noticed one movie which was obviously compressed from 16:9 to 4:3, and two minutes later, I had a script which can check my entire collection for PAR/DAR oddities and provides a way to correct them using ffmpeg.

These are all things I could do myself but the trade off typically is not worth it. I would spend too much time learning details and messing about getting it to work smoothly. Now it is just a prompt or two away.

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

#29
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.

It happens. More often than not, it can be physical damage or manufacturing defect for one of the contacts and/or wires.
Post reply on HN