Skip to content

feat: expose the full v0.6.3.102 FFI surface - #56

Merged
TekuSP merged 1 commit into
masterfrom
update_submodule
Aug 30, 2026
Merged

feat: expose the full v0.6.3.102 FFI surface#56
TekuSP merged 1 commit into
masterfrom
update_submodule

Conversation

@TekuSP

@TekuSP TekuSP commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Sync framework-system-ffi-extensions v0.6.2.93 -> v0.6.3.102 (nested framework-system v0.6.4-3 -> v0.6.5-19) and wrap all 46 newly exported functions. The FFI grew from 44 to 90 entry points across two tranches: PD controller/charger/retimer info, GPIO, thermal thresholds and sensor names, Smart Battery, EC diagnostics (hello, sysinfo, protocol info, panic data, port 80 history, switches, AP throttle, ADC), hibernate delay, standalone mode, GPU serial, input controls, and nine handle-free HID/USB peripheral calls.

Group the new EC surface into facets on IFrameworkEcConnection rather than flattening ~65 members onto one interface: Diagnostics, Gpio, Thermal, Battery, PowerDelivery, Input and PowerManagement. Each facet borrows the connection's handle through an accessor, so every call runs the same ObjectDisposedException check as the existing members. The nine handle-free calls go on a new IFrameworkPeripherals/FrameworkPeripherals pair, mirroring IFrameworkSystem/FrameworkSystem so they stay mockable.

Handle FrameworkStatusCode.NotSupported (-9), added by this FFI release. It previously fell through to the default arm of the status mapping and surfaced as ArgumentOutOfRangeException; NVMe version readback on non-Linux hosts returns it, so it now maps to a dedicated FrameworkNotSupportedStatusException. Unlike DataUnavailable, it means the capability is not compiled in for the platform and is permanent.

Notable correctness details, verified against upstream framework_lib:

  • Port 80 history: writes is the next write slot, so the newest entry is at (writes - 1) % history_size. The native ABI comment states writes % history_size, which names the oldest entry once the ring has wrapped. Partially filled rings expose only the slots actually written.
  • Retimer version is four raw I2C register bytes, not text. It is exposed as bytes plus a hex-quad VersionString matching upstream's rendering, and gated to Framework 16, whose expansion-bay command backs it.
  • Smart Battery capacities switch to 10 mWh units when BatteryMode bit 15 is set, so they are surfaced as parallel ElectricCharge?/Energy? sets selected by IsCapacityReportedInEnergyUnits rather than as a single mistyped quantity.
  • Per-key RGB is gated to Framework Desktop, which is what upstream documents; the Framework 16 keyboard is not EC-controlled.
  • RemapCapsLockToControl hardcodes the Framework 12 matrix position, so it is documented as model-specific rather than universal.

Interface change: IFrameworkEcConnection gains seven facet properties. Existing members are untouched, so callers are unaffected, but external implementers of the interface must add them.

Also update the CLI demo with read-only panels for every new facet, keeping Smart Battery and the audio card version out of the refresh loop because both are too expensive to poll, and add 21 hardware tests covering the new surface plus a hardware-free Port 80 ordering regression test. 41/41 pass on Framework hardware.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
To commit it as-is (this stages everything, including the submodule pointer bump to 40f98e0):

git add -A && git commit -F - <<'EOF'
feat: expose the full v0.6.3.98 FFI surface

Sync framework-system-ffi-extensions v0.6.2.93 -> v0.6.3.98 (nested framework-system v0.6.4-3 -> v0.6.5-19) and wrap all 46 newly exported functions. The FFI grew from 44 to 90 entry points across two tranches: PD controller/charger/retimer info, GPIO, thermal thresholds and sensor names, Smart Battery, EC diagnostics (hello, sysinfo, protocol info, panic data, port 80 history, switches, AP throttle, ADC), hibernate delay, standalone mode, GPU serial, input controls, and nine handle-free HID/USB peripheral calls.

Group the new EC surface into facets on IFrameworkEcConnection rather than flattening ~65 members onto one interface: Diagnostics, Gpio, Thermal, Battery, PowerDelivery, Input and PowerManagement. Each facet borrows the connection's handle through an accessor, so every call runs the same ObjectDisposedException check as the existing members. The nine handle-free calls go on a new IFrameworkPeripherals/FrameworkPeripherals pair, mirroring IFrameworkSystem/FrameworkSystem so they stay mockable.

Handle FrameworkStatusCode.NotSupported (-9), added by this FFI release. It previously fell through to the default arm of the status mapping and surfaced as ArgumentOutOfRangeException; NVMe version readback on non-Linux hosts returns it, so it now maps to a dedicated FrameworkNotSupportedStatusException. Unlike DataUnavailable, it means the capability is not compiled in for the platform and is permanent.

Notable correctness details, verified against upstream framework_lib:

  • Port 80 history: writes is the next write slot, so the newest entry is at (writes - 1) % history_size. The native ABI comment states writes % history_size, which names the oldest entry once the ring has wrapped. Partially filled rings expose only the slots actually written.
  • Retimer version is four raw I2C register bytes, not text. It is exposed as bytes plus a hex-quad VersionString matching upstream's rendering, and gated to Framework 16, whose expansion-bay command backs it.
  • Smart Battery capacities switch to 10 mWh units when BatteryMode bit 15 is set, so they are surfaced as parallel ElectricCharge?/Energy? sets selected by IsCapacityReportedInEnergyUnits rather than as a single mistyped quantity.
  • Per-key RGB is gated to Framework Desktop, which is what upstream documents; the Framework 16 keyboard is not EC-controlled.
  • RemapCapsLockToControl hardcodes the Framework 12 matrix position, so it is documented as model-specific rather than universal.

Interface change: IFrameworkEcConnection gains seven facet properties. Existing members are untouched, so callers are unaffected, but external implementers of the interface must add them.

Also update the CLI demo with read-only panels for every new facet, keeping Smart Battery and the audio card version out of the refresh loop because both are too expensive to poll, and add 21 hardware tests covering the new surface plus a hardware-free Port 80 ordering regression test. 41/41 pass on Framework hardware.

Sync framework-system-ffi-extensions v0.6.2.93 -> v0.6.3.102 (nested
framework-system v0.6.4-3 -> v0.6.5-19) and wrap all 46 newly exported
functions. The FFI grew from 44 to 90 entry points across two tranches:
PD controller/charger/retimer info, GPIO, thermal thresholds and sensor
names, Smart Battery, EC diagnostics (hello, sysinfo, protocol info,
panic data, port 80 history, switches, AP throttle, ADC), hibernate
delay, standalone mode, GPU serial, input controls, and nine handle-free
HID/USB peripheral calls.

Group the new EC surface into facets on IFrameworkEcConnection rather
than flattening ~65 members onto one interface: Diagnostics, Gpio,
Thermal, Battery, PowerDelivery, Input and PowerManagement. Each facet
borrows the connection's handle through an accessor, so every call runs
the same ObjectDisposedException check as the existing members. The nine
handle-free calls go on a new IFrameworkPeripherals/FrameworkPeripherals
pair, mirroring IFrameworkSystem/FrameworkSystem so they stay mockable.

Handle FrameworkStatusCode.NotSupported (-9), added by this FFI release.
It previously fell through to the default arm of the status mapping and
surfaced as ArgumentOutOfRangeException; NVMe version readback on
non-Linux hosts returns it, so it now maps to a dedicated
FrameworkNotSupportedStatusException. Unlike DataUnavailable, it means
the capability is not compiled in for the platform and is permanent.

Notable correctness details, verified against upstream framework_lib:

- Port 80 history: `writes` is the *next* write slot, so the newest
  entry is at (writes - 1) % history_size. The native ABI comment states
  writes % history_size, which names the oldest entry once the ring has
  wrapped. Partially filled rings expose only the slots actually written.
- Retimer version is four raw I2C register bytes, not text. It is exposed
  as bytes plus a hex-quad VersionString matching upstream's rendering,
  and gated to Framework 16, whose expansion-bay command backs it.
- Smart Battery capacities switch to 10 mWh units when BatteryMode bit 15
  is set, so they are surfaced as parallel ElectricCharge?/Energy? sets
  selected by IsCapacityReportedInEnergyUnits rather than as a single
  mistyped quantity.
- Per-key RGB is gated to Framework Desktop, which is what upstream
  documents; the Framework 16 keyboard is not EC-controlled.
- RemapCapsLockToControl hardcodes the Framework 12 matrix position, so
  it is documented as model-specific rather than universal.

Interface change: IFrameworkEcConnection gains seven facet properties.
Existing members are untouched, so callers are unaffected, but external
implementers of the interface must add them.

Also update the CLI demo with read-only panels for every new facet,
keeping Smart Battery and the audio card version out of the refresh loop
because both are too expensive to poll, and add 21 hardware tests
covering the new surface plus a hardware-free Port 80 ordering
regression test. 41/41 pass on Framework hardware.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
To commit it as-is (this stages everything, including the submodule pointer bump to 40f98e0):

git add -A && git commit -F - <<'EOF'
feat: expose the full v0.6.3.98 FFI surface

Sync framework-system-ffi-extensions v0.6.2.93 -> v0.6.3.98 (nested
framework-system v0.6.4-3 -> v0.6.5-19) and wrap all 46 newly exported
functions. The FFI grew from 44 to 90 entry points across two tranches:
PD controller/charger/retimer info, GPIO, thermal thresholds and sensor
names, Smart Battery, EC diagnostics (hello, sysinfo, protocol info,
panic data, port 80 history, switches, AP throttle, ADC), hibernate
delay, standalone mode, GPU serial, input controls, and nine handle-free
HID/USB peripheral calls.

Group the new EC surface into facets on IFrameworkEcConnection rather
than flattening ~65 members onto one interface: Diagnostics, Gpio,
Thermal, Battery, PowerDelivery, Input and PowerManagement. Each facet
borrows the connection's handle through an accessor, so every call runs
the same ObjectDisposedException check as the existing members. The nine
handle-free calls go on a new IFrameworkPeripherals/FrameworkPeripherals
pair, mirroring IFrameworkSystem/FrameworkSystem so they stay mockable.

Handle FrameworkStatusCode.NotSupported (-9), added by this FFI release.
It previously fell through to the default arm of the status mapping and
surfaced as ArgumentOutOfRangeException; NVMe version readback on
non-Linux hosts returns it, so it now maps to a dedicated
FrameworkNotSupportedStatusException. Unlike DataUnavailable, it means
the capability is not compiled in for the platform and is permanent.

Notable correctness details, verified against upstream framework_lib:

- Port 80 history: `writes` is the *next* write slot, so the newest
  entry is at (writes - 1) % history_size. The native ABI comment states
  writes % history_size, which names the oldest entry once the ring has
  wrapped. Partially filled rings expose only the slots actually written.
- Retimer version is four raw I2C register bytes, not text. It is exposed
  as bytes plus a hex-quad VersionString matching upstream's rendering,
  and gated to Framework 16, whose expansion-bay command backs it.
- Smart Battery capacities switch to 10 mWh units when BatteryMode bit 15
  is set, so they are surfaced as parallel ElectricCharge?/Energy? sets
  selected by IsCapacityReportedInEnergyUnits rather than as a single
  mistyped quantity.
- Per-key RGB is gated to Framework Desktop, which is what upstream
  documents; the Framework 16 keyboard is not EC-controlled.
- RemapCapsLockToControl hardcodes the Framework 12 matrix position, so
  it is documented as model-specific rather than universal.

Interface change: IFrameworkEcConnection gains seven facet properties.
Existing members are untouched, so callers are unaffected, but external
implementers of the interface must add them.

Also update the CLI demo with read-only panels for every new facet,
keeping Smart Battery and the audio card version out of the refresh loop
because both are too expensive to poll, and add 21 hardware tests
covering the new surface plus a hardware-free Port 80 ordering
regression test. 41/41 pass on Framework hardware.
@TekuSP
TekuSP merged commit d956688 into master Aug 30, 2026
21 checks passed
@TekuSP
TekuSP deleted the update_submodule branch August 30, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant