Show HN: WhatCable,一个用于检查 USB-C 线缆的微型菜单栏应用
Show HN: WhatCable, a tiny menu bar app for inspecting USB-C cables

原始链接: https://github.com/darrylmorley/whatcable

## WhatCable:了解你的 USB-C 数据线 WhatCable 是一款免费的 macOS 应用程序,旨在明确你的 USB-C 数据线的功能。它解决了由外观相同的电缆却提供截然不同的性能所造成的困惑——从简单的充电到高速 Thunderbolt 4。 该应用程序利用 macOS 现有的系统信息 (IOKit) 以清晰易懂的方式显示每个连接的电缆可以做什么。它显示电缆是否支持 Thunderbolt/USB4,仅用于充电,或是一个较慢的 USB 版本。重要的是,它可以诊断充电问题,识别瓶颈,例如电缆限制或 Mac 请求的功率较低。 WhatCable 提供详细信息,包括电缆速度、电流额定值、充电器电压曲线以及连接设备识别。对于任何想要确保使用正确电缆以获得最佳性能的人来说,它都是一个有价值的工具,可以直接从开发者处下载——由于沙盒限制,没有在 App Store 上架。需要 macOS 14 (Sonoma) 或更高版本。

## WhatCable:Mac USB-C 线缆检测工具 一款名为 **WhatCable** 的全新、免费且开源的 Mac 菜单栏应用,帮助用户识别其 USB-C 线缆的功能。它使用 Swift/SwiftUI 开发,利用 macOS 已经可用的数据来以简单易懂的语言显示线缆的充电功率、数据传输速度、显示支持以及 Thunderbolt 兼容性。 这解决了常见的问题,即难以区分的 USB-C 线缆性能差异巨大。该应用可在 GitHub 上找到 ([https://github.com/darrylmorley/whatcable](https://github.com/darrylmorley/whatcable))。 一位用户指出 USB 端口设备报告存在问题,另一位用户询问是否有 Linux 对应的工具,并提到 `lsucpd` 可能是解决方案。该帖子还提醒大家 Y Combinator 2026 夏季项目正在接受申请。
相关文章

原文

What can this USB-C cable actually do?

A small macOS menu bar app that tells you, in plain English, what each USB-C cable plugged into your Mac can actually do, and why your Mac might be charging slowly.

USB-C hides a lot under one connector. Anything from a USB 2.0 charge-only cable to a 240W / 40 Gbps Thunderbolt 4 cable, all looking identical in your drawer. macOS already exposes the relevant info via IOKit; WhatCable surfaces it as a friendly menu bar popover.

Latest release Platform License: MIT

WhatCable popover

Per port, in plain English:

  • At-a-glance headline — Thunderbolt / USB4, USB device, Charging only, Slow USB / charge-only cable, Nothing connected
  • Charging diagnostic — when something's plugged in, a banner identifies the bottleneck:
    • "Cable is limiting charging speed" (cable rated below the charger)
    • "Charging at 30W (charger can do up to 96W)" (Mac is asking for less, e.g. battery near full)
    • "Charging well at 96W" (everything matches)
  • Cable e-marker info — the cable's actual speed (USB 2.0, 5 / 10 / 20 / 40 / 80 Gbps), current rating (3 A / 5 A → up to 60W / 100W / 240W), and the chip's vendor
  • Charger PDO list — every voltage profile the charger advertises (5V / 9V / 12V / 15V / 20V…) with the currently negotiated profile highlighted in real time
  • Connected device identity — vendor name and product type, decoded from the PD Discover Identity response
  • Active transports — USB 2 / USB 3 / Thunderbolt / DisplayPort
  • "Show technical details" toggle revealing the underlying IOKit properties for engineers

Right-click the menu bar icon for Refresh, a Keep window open toggle (handy for screenshots and demos), About, and Quit.

Download the latest WhatCable.zip from the Releases page, unzip, and drag WhatCable.app to /Applications.

The app is universal (Apple silicon + Intel), signed with a Developer ID, and notarised by Apple — no Gatekeeper warnings.

Requires macOS 14 (Sonoma) or later.

WhatCable reads three families of IOKit services. No entitlements, no private APIs, no helper daemons:

Service What it gives us
AppleHPMInterfaceType10/11 Per-port state: connection, transports, plug orientation, e-marker presence
IOPortFeaturePowerSource Full PDO list from the connected source, with the live "winning" PDO
IOPortTransportComponentCCUSBPDSOP PD Discover Identity VDOs for SOP (port partner) and SOP' (cable e-marker)

Cable speed and power decoding follow the USB Power Delivery 3.x spec.

Requires Swift 5.9 (Xcode 15+).

Build a distributable .app

Produces a universal dist/WhatCable.app (arm64 + x86_64) and dist/WhatCable.zip.

Modes:

Configuration Result
No .env Ad-hoc signed. Works locally; Gatekeeper warns on other Macs.
.env with DEVELOPER_ID Developer ID signed + hardened runtime.
.env with DEVELOPER_ID + NOTARY_PROFILE Full notarisation + stapled ticket. Gatekeeper-clean for everyone.

One-time setup for full notarisation:

# 1. Find your signing identity
security find-identity -v -p codesigning

# 2. Store notarytool credentials in the keychain
xcrun notarytool store-credentials "WhatCable-notary" \
    --apple-id "[email protected]" \
    --team-id "ABCDE12345" \
    --password "<app-specific-password>"   # generate at appleid.apple.com

# 3. Create your .env from the template
cp .env.example .env
# ...and fill in DEVELOPER_ID
  • Cable e-marker info only appears for cables that carry one. Most USB-C cables under 60 W are unmarked. Any Thunderbolt / USB4 cable, any 5 A / 100 W+ cable, and most quality data cables will be e-marked.
  • PD spec coverage: the decoder targets PD 3.0 / 3.1. PD 3.2 EPR variants may need tweaks once we see real data.
  • Vendor name lookup is bundled but not exhaustive — common cable, charger, hub, dock, and storage vendors are recognised; others fall back to the hex VID.
  • macOS only. iOS sandboxing makes USB-C e-marker access much harder.
  • Not on the App Store. App Sandbox blocks the IOKit reads we depend on.

Issues and PRs welcome. The code is small and tries to stay readable — start at Sources/CableTest/ContentView.swift for the UI, PortSummary.swift for the plain-English logic, or PDVDO.swift for the bit-twiddling.

Built by Darryl Morley.

Inspired by every time someone has asked "is this cable any good?".

联系我们 contact @ memedata.com