Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

cablebench

Sort the cable drawer: classify every USB cable by what link speed it actually negotiates, using gear you already own. No sudo, stdlib Python only.

Why this works

A cable's wiring class is revealed the moment a device enumerates. macOS reports the negotiated link speed in ioreg (UsbLinkSpeed). With a known-10Gbps device on a known-10Gbps port, the negotiated speed IS the cable:

negotiated cable class real-world sticker
nothing enumerates charge-only / dead 0 PWR ONLY
480 Mb/s USB 2.0 wiring ("charge & sync") ~35–42 MB/s USB2
5 Gb/s USB 3.x Gen 1 ~400–450 MB/s 5G
10 Gb/s USB 3.x Gen 2 ~900–1000 MB/s 10G

This is exactly the failure mode that throttled the Media drive to 40 MB/s before 2026-07-01: a USB2-class cable on a 10G enclosure.

The rig

  • Test device: one of the RTL9210B NVMe enclosures (10 Gbps capable). Prefer the TimeMachine one for the session — Media and Standby serve live containers. The script cleanly unmounts before each unplug.
  • Test port: front USB-C (10 Gb/s) or rear TB4 port, plugged DIRECTLY. Never test through the VIA hub — it is USB2-only and caps everything at 480 Mb/s (the script detects and warns about this).

Usage

python3 ~/cable-bench/cablebench.py scan            # what's on the bus right now
python3 ~/cable-bench/cablebench.py test            # cable-sorting session
python3 ~/cable-bench/cablebench.py test --io auto  # + real read/write MB/s
python3 ~/cable-bench/cablebench.py watch           # live attach/detach (flaky cables)
python3 ~/cable-bench/cablebench.py log             # results table (cables.csv)

test loops: name the cable (auto C01, C02, …) → plug in → it classifies → it unmounts the disk → unplug → next cable. Results append to cables.csv. Put a painter's-tape flag on each cable with the sticker text (e.g. C03 · 10G).

Caveats

  • USB-A cables: the mini has no USB-A ports and the external hub is USB2-only, so A-to-something cables can't be classified here beyond "2.0". Use a USB-A 3.x female→C adapter, or test them on the Windows PC.
  • Thunderbolt cables: a TB3/TB4/USB4 cable shows as 10G with a USB3 device — correct but understated; distinguishing 40G needs a TB device.
  • Power delivery (wattage) is not tested — that needs a USB PD tester.
  • A cable that trains at 10G but is marginal shows up in watch mode as repeated detach/attach (link retraining). Suspect the cable or the port seat.

About

Classifies USB cables by the USB link speed they actually negotiate (macOS ioreg).

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages