Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

/sys/class/extcon

FieldValue
Subsystemextcon (external connector) framework, drivers/extcon; implementation file not in cached tree
Config gatenot verifiable from the cached sources (cached tree has no Kconfig or driver files); class absent on the live host
ABI documentationDocumentation/ABI/testing/sysfs-class-extcon (6 What entries)
SinceFebruary 2012 (main entries); mutually_exclusive/ December 2011; no KernelVersion lines stated in the file
Live (5.10.134 host)class absent: not in live-sys/class-list.txt, no /sys/class/extcon
Ledger IDSYSC-extcon

What it represents

One directory per extcon object - a single external connector port such as a dock, cradle or accessory jack. One port can carry several cables at once (the ABI example is a 30-pin board port with HDMI and charger attached, or audio, video and USB). The class reports which cable states are attached and lets privileged userspace set the whole cable-state bitmask for testing or platform control.

Relationship to the device model

Each extcon directory is a class view of an extcon_dev registered by a driver (the name comes from extcon_dev_register). Cable identity is positional: cable numbers 0-31 map to per-cable cable.X directories, and the textual cable names appear in the aggregated state output. Mutually exclusive cable sets are declared by the driver in the mutually_exclusive array and mirrored as file names under the mutually_exclusive/ subdirectory - the ABI stresses the file names carry the information, not the file contents.

Attributes

AttributeR/WUnit/formatConditional?Source
.../nameROextcon object name; show_name callback can overridealwaysABI, February 2012
.../stateRWread: NAME=0/1 lines per cable; write: hex mask starting 0x setting the whole statealwaysABI, February 2012
.../cable.X/nameROcable name, X in 0-31cable presentABI, February 2012
.../cable.X/stateRW0 detached, 1 attachedcable presentABI, February 2012
.../mutually_exclusive/...ROfile per exclusive set, hex mask names (0x3, 0x5, …)driver declares exclusivityABI, December 2011

Safety and writes

The aggregated state write is the powerful one: it updates every cable state at once and is the ABI-recommended way to change states atomically; the per-cable cable.X/state write cannot update multiple cables simultaneously. All writes must satisfy the mutually exclusive sets the driver declared, otherwise they are rejected. Writing connector state on real hardware emulates or forces attachment (charger detection, dock switches), so it can fool power and USB subsystems; it is test/setup functionality, not routine configuration.

References

  • Documentation/ABI/testing/sysfs-class-extcon (cached copy; 6 What entries)
  • drivers/extcon/ implementation: not in cached tree
  • Sibling pages: mux, power_supply; coverage: ledger
  • Live check: /sys/class/extcon absent (kernel 5.10.134, read-only enumeration)