Live data from Hacker News

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

kau.sh

141–150 of 197 posts

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

#141
post #121

Interesting. Is there a way to adapt this for Linux or Windows? Many users, not just Mac users, face issues with USB-C cables. Practical cross-platform tools could be very helpful.

Linux: lsusb -tv

Windows: There's an example in the WDK here: https://github.com/Microsoft/Windows-driver-samples/tree/mai...

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

#142
post #138

Earlier quoted context omitted.

yeah recently I needed a script to ingest individual json files into an sqlite db. I could have spent half the day writing, or asked an AI to write it and spend 10 minutes checking the data in the DB is correct. There are plenty of non critical aspects that can be drastically accelerated, but also plenty of places where I know I don't want to use today's models to do the work.

I worked with contractor for a contractor who had AI write a script to update a repository (essentially doing a git pull). But for some strange reason it was using the GitHub API instead of git. The best part is if the token wasn't set up properly it overwrote every file (including itself) with 404s. Ingesting json files into sqlite should only take half a day if you're doing it in C or Fortran for some reason (maybe…

regarding how long the ingestion should take to implement, I'm going to say: it depends!

It depends on how complex the models are, because now you need to parse your model before inserting them. Which means you need tables to be in the right format. And then you need your loops, for each file you might have to insert anywhere between 5 to nested 20 entities. And then you either have to use an ORM or write each SQL queries.

All of which I could do obviously, and isn't rocket science, just time consuming.

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

#143

Content wise a nice idea, but I also like the conclusion about how AI made this possible in the first place. The author itself mentions this motivation. AI is undoubtedly perfect for utilities, small (even company internal) tools for personal use where maintainability is secondary as you can ditch the tool or rebuild it quickly. > Two years ago, I wouldn’t have bothered with the rewrite, let alone creating the script…

Came here to say exactly this.

That all the naysayers are missing the tons of small wins that are happening every single day by people using AI to write code, that weren't possible before.

I specified in a thread a few weeks ago that we manage a small elixir-rust library, and I have never coded rust in my life. Sure, it's about 20 lines of rust, mostly mapping to the underlying rust lib, but so far I've used claude to just maintain it (fix deprecations, perform upgrades, etc).

This simply wasn't possible before.

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

#144
post #138

Earlier quoted context omitted.

I worked with contractor for a contractor who had AI write a script to update a repository (essentially doing a git pull). But for some strange reason it was using the GitHub API instead of git. The best part is if the token wasn't set up properly it overwrote every file (including itself) with 404s. Ingesting json files into sqlite should only take half a day if you're doing it in C or Fortran for some reason (maybe…

regarding how long the ingestion should take to implement, I'm going to say: it depends! It depends on how complex the models are, because now you need to parse your model before inserting them. Which means you need tables to be in the right format. And then you need your loops, for each file you might have to insert anywhere between 5 to nested 20 entities. And then you either have to use an ORM or write each SQL qu…

Sure, if the JSON is very complicated it makes sense that it could take a lot longer (but then I wouldn't really trust the AI to do it either...)

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

#145

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?

Yep! Nothing worth sharing/publishing from me, but quite a few mini projects that are specific to my position at a small non-tech company I work for. For example we send data to a client on a regular basis, and they send back an automated report with any data issues (missing fields, invalid entries, etc) in a human-unfriendly XML format. So I one-shotted a helper script to parse that data and append additional information from our environment to make it super easy for my coworkers to find and fix the data issues.

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

#146
post #117
post #92

Earlier quoted context omitted.

I'll take the minimal hassle of having to compile a go program over a complex shell script that only the author understands (if that) any day. Performance isn't everything; readability and maintainability matter too.

> Performance isn't everything; readability and maintainability matter too. Is that case for this vibe-coded thing? https://news.ycombinator.com/item?id=45513562

No idea, I haven't had a look at this code in particular.

I'm just saying that I've seen several "small tools that could have been shell scripts" in Go or another more structured language and never wished they were shell scripts instead.

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

#147
post #81

Earlier quoted context omitted.

Shouldn't a compliant USB-C DFP not supply Vbus without the resistor network, though, so there should be no charging at all? (Not that all DFPs necessarily do the correct thing, of course.)

Correct, which is probably why it won't even charge their earbuds in the broken orientation.

[deleted]

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

#148
post #56

lsusb will get you this info in Linux, but I like the idea of a little wrapper tool to make the output easier to parse. 480 vs. 5000 Mbps is a pernicious problem. It's very easy to plug in a USB drive and it looks like it works fine and is reasonable fast. Right until you try to copy a large file to it and are wondering why it is only copying 50MBytes/second. It doesn't help that the world is awash in crappy charging…

I remember hearing it’s even possible to plug in a USB-A plug too slowly, making the legacy pins make contact first, which results in a 480 Mbps connection – despite the cable, the host, and the device all supporting superspeed!

Destroy the whole standard. That's literally insane.

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

#149
post #78

Earlier quoted context omitted.

I believe USB C cables actually do have an orientation - it's just that the negotiation both ends do usually makes that orientation irrelevant. Maybe the negotiation can fail & the plugged in orientation is then the only one that works?

USB-C only has an "intrinsic" orientation because we call one set of pins "1" and the other "2". Electrically there should be no difference.

No, there really is an intrinsic orientation, at least once a cable is plugged in.

The receptacles are symmetric, but a full connection is not. The cable only connects CC through end-to-end on one of A5 or B5, but not both, which lets the DFP detect which of A5 or B5 should be CC. The one not used for CC is then used to power the e-marker in the cable, if any.

This is also true for legacy adapters; for example, for C-to-A USB 3 adapters, the host needs to know which of the two high-speed pairs to use (as USB 3 over A/B connectors only supports one lane, while C supports two).

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

#150
post #96

Fun fact: this information is already available in the System Information app on your Mac. Hardware -> USB I also use the app to check what wattage my cables are when charging my MacBook (Hardware -> Power)

This only shows you the minimum of what the cable and adapter support together, though. I believe this is a fundamental limitation of the protocol; the source won't tell you about voltage/current combinations not supportable by the cable.
Post reply on HN