Documentation
¶
Overview ¶
Package usbccable models what a USB-C cable can and cannot carry.
USB-C standardises the connector shape, not the protocol running through it. Two physically identical cables can differ by a factor of forty in data rate and by more than three times in deliverable power, with nothing on the jacket to tell them apart.
Reference cable specifications used to validate this package are published at https://cairovolt.com/en/cables
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bottleneck ¶
Bottleneck names the component that limits a charger/cable/device combination: "cable", "charger" or "device".
Types ¶
type Cable ¶
type Cable struct {
// Amps is the current rating: 3 for a plain cable, 5 when e-marked.
Amps float64
// Data is the highest data protocol supported.
Data DataMode
// VideoAltMode reports whether DisplayPort Alt Mode is wired through.
VideoAltMode bool
// LengthMeters matters because passive cables lose signal integrity with length.
LengthMeters float64
}
Cable describes the capabilities a specific cable actually has.
func (Cable) MaxWatts ¶
MaxWatts returns the highest power this cable can carry, given that Extended Power Range voltages above 20 V require a 5 A e-marked cable.
func (Cable) PassiveLengthOK ¶
PassiveLengthOK reports whether a passive cable of this length can sustain its claimed data mode. Passive USB4 and 10 Gbps cables degrade past roughly 0.8 m and 1 m respectively; anything longer needs an active cable.
func (Cable) SupportsWatts ¶
SupportsWatts reports whether the cable can carry the requested wattage.