tools/
Collection and measurement tools. The Linux tools run on the device; the Windows tools were used to read the Windows baseline the research documents compare against.
- Output. The collecting tools write into the working copy, not into tracked files: summaries without
unit-specific values under
hw/, raw output (which can contain serial numbers, addresses and other unit-specific values) underprivate/, and built helper programs underout/. All three are ignored by git (.gitignore); the Windows collectors usehw\windowsandprivate\windows. None of these results are part of this repository; the reviewed device lists are indocs/reference/. Below, "locally" means one of these directories; each tool prints where it wrote. - Supporting files. Files that a tool in the table builds or calls sit next to it and are not listed:
baseline/(common.ps1,elevated.ps1,sampler.ps1,camera-sources.ps1,audio.py,hidlog.py,summarize.py,sp9probe.cs),perf/(counters.ps1,perfprobe.cs,etw-providers.txt,summarize.py),btetl/etldump.csandtypecover-probe.cs. - Running. PowerShell scripts:
powershell -ExecutionPolicy Bypass -File tools\windows\<script>.ps1. Python scripts on Windows:python -I -X utf8.
| Tool | What it does |
|---|---|
windows/collect-hwinfo.ps1 |
Collects hardware information on Windows (no administrator rights, about 30 seconds). Writes summaries and raw output locally |
windows/collect-admin.ps1 |
Checks that need administrator rights (BitLocker, TPM, Secure Boot, firmware boot entries, WinRE). Run through run-elevated.ps1 |
windows/run-elevated.ps1 |
Runs a script elevated and returns its output (assumes UAC is set not to prompt; used in place of Windows sudo). powershell -ExecutionPolicy Bypass -File tools\windows\run-elevated.ps1 <script.ps1> |
windows/dump-acpi.ps1 |
Dumps all ACPI tables of your own device (GetSystemFirmwareTable plus the DSDT and SSDTs from the registry, MSDM excluded) to a local directory and decompiles them into dsl/. iasl is built from the ACPICA sources in MSYS2. The dumps are not in this repository; the tables of this model are also in linux-surface/acpidumps (surface_pro_9_intel) |
windows/sam-events.ps1 |
Extracts from the Windows event log the SAM event registrations (TID/TC/IID), warnings of the Surface drivers, and the range of the SMF CPU power limit updates (no administrator rights) |
windows/collect-power.ps1 |
Saves the power baseline (powercfg /a, sleepstudy, systempowerreport, all power settings) locally. Run through run-elevated.ps1 |
vbt-extract.py |
Extracts the Intel VBT from a firmware image (for example a Surface UEFI capsule) and saves it with its sha256. Decode it with intel_vbt_decode. No VBT is in this repository |
windows/driver-map.ps1 |
Driver package per device (INF, DriverStore folder, file list), written locally as hw\windows\driver-packages.txt |
windows/hid-caps.ps1 |
Dumps the capabilities of each HID collection (link collections, button and value usages, logical and physical ranges, report IDs). -Filter takes a regular expression on the device path; Bluetooth addresses are masked |
linux/post-install-check.sh |
On Linux after installation: reads, without changing anything, every test item of the research documents that can be checked automatically, and collects the result in ~/sp9-check-<host>/ (no network; the root-only parts only under sudo). It compares the runtime VBT, the EDID and the DSDT with the hashes in docs/reference/firmware-hashes.tsv. When a tool is missing it reads sysfs or procfs instead, or records SKIP with the tool's name (it finds the NixOS profile paths by itself) |
public-scan.sh |
Read-only check of a tree for what must not be published: Hangul text, MAC and Bluetooth addresses, home paths, positional references into binaries, binary and oversized files, and names listed in a local, uncommitted pattern file |
linux/build-kernel.sh |
On an x86-64 Linux host: applies v7.3.4 + linux-surface + kernel/patches, verifies the configuration and builds Debian packages (default) or a tarball. Optional MOK signing (--sign-key, --sign-cert; --make-key creates a key pair; a key inside the repository directory is refused), --tarball, --prepare-only. Results in out/kernel/dist/. Never run to completion (docs/install-from-source.md) |
windows/baseline/baseline.ps1 |
Steps through the tests of docs/test-plan.md on Windows while collecting pen, touch, HID, Bluetooth ETW, audio, camera, sensor and power logs automatically, and records result rows locally in the same format as the Linux results. -List, -Test ID, -Area X, -DryRun |
windows/baseline/setup.ps1 |
Prepares the tool above: builds sp9probe.exe (.NET Framework csc → out/baseline/), a Python venv (hidapi, numpy, sounddevice), ffmpeg, the busiotools BluetoothStack.wprp |
windows/btetl/btetl.py |
Decodes the BTHPORT HCIRAW packets of a Bluetooth ETW trace (.etl) into an HCI and ATT timeline and a btsnoop file (builds etldump.cs with csc automatically). --markers and --rawinput overlay test steps and pen contact. Addresses are masked. Run with python -I -X utf8 |
windows/camera-controls.ps1 |
Lists, read-only, the standard and advanced Media Foundation controls of each camera and the GET results of the extension controls (id 0..63). Opens the camera briefly, so the LED may light. -Group limits it to one group |
windows/collect-display.ps1 |
Saves the display control state (Intel and monitor class keys, GraphicsDrivers configuration, the panel calibration UEFI variables, WMI brightness, display power settings, ETW providers) locally. Run through run-elevated.ps1 |
windows/dpcd-read.ps1 |
Reads, read-only, the DPCD of the internal panel through Intel IGCL ctlAUXAccess and prints it as hex per range (-Ranges 0x700:16). Run through run-elevated.ps1 |
sdc-blob.py |
Decodes the Surface panel's factory calibration UEFI variables (Type_1/Type_2, from a Windows dump or Linux efivarfs): prints the measurements, the brightness model, the TRC and the sRGB → panel matrix, and with --icc writes an ICC profile of the panel's native gamut. Used by the device helper's GenerateIcc |
windows/uefi-vars.ps1 |
Lists UEFI variable names, GUIDs, attributes and sizes; -Name filters, -Values (-MaxBytes) prints values as hex, -SaveTo writes a value to a local file. Run through run-elevated.ps1 |
windows/battery-state.ps1 |
The WMI root\wmi battery classes, Win32_Battery and the power state (serial masked). -Watch N follows them; -Report saves a batteryreport locally |
windows/input-trace.ps1 |
Records, locally, the HID SET/GET requests sent to the THC, the KIP and the buttons (ETW: IOCTL, report ID, process) and Feature snapshots during idle, display off (= Modern Standby), SetSuspendState (wake timer, -Standby), cover detach and backlight changes (-Manual), and summarises them with input-trace.py. Elevates itself |
windows/input-trace.py |
Decodes an input-trace.ps1 run: which HID requests went to which collection in which phase, the THC DMA writes, and how the Feature snapshots changed |
windows/typecover-probe.ps1 |
Read-only survey of the Type Cover (KIP). Default is automatic (elevated): collection caps and field bit positions, every Feature GET (and GET_INPUT of the Fn-state and backlight reports), the KIP PnP devices with their drivers and filters, and the PTP registry, written locally (layout.txt, features.txt, devices.txt, ptp-registry.txt). -Interactive opens a window with instructions and records Fn, the top row, the backlight, edge scrolling, gestures and special keys step by step, together with Raw Input, ReadFile, a wheel hook, Feature snapshots and ETW (letter keys are masked). -Auto N is a self-test, -Summarize runs the summary |
windows/typecover-summary.py |
Summarises the step records above per step (keys and usages, touchpad still periods against wheel and scroll, backlight polling, Feature changes, ETW requests) into summary.md. Run with python -I -X utf8 |
windows/perf-modes.ps1 |
Measures idle, load and cool-down for each power mode overlay (MSRs, counters, SMF ETW nodes, marks for standby periods). Changes only the overlay and restores it. Results locally. Run through run-elevated.ps1 |
windows/standby-trace.ps1 |
Traces Modern Standby entry and exit (logman ETW: Kernel-Power, Acpi, Pep, PDC, Intel PEP, the Surface drivers, plus capture state; entry by display off). Exit is by default a press of the power button by hand (after N minutes, waiting for event 507); -TryTimerWake is an experimental timer wake (standby-wake.ps1). Ends with a summary by standby-summary.py. -Minutes, -Cycles, -DryRun, -Summarize. Results locally. Run through run-elevated.ps1 |
windows/standby-summary.py |
Offline summary of a standby-trace run folder: decodes the ETL with etwdecode.cs and writes, as summary.md, which providers were captured, the 506/507 intervals, a timeline (Kernel-Power, ACPI _DSM and D-states, PEP, PDC, Surface), the PDC activators, the PEP constraints and the sleepstudy sessions (HW DRIPS %, blockers, energy). Run with python -I -X utf8 |
windows/standby-wake.ps1 |
Timed exit from Modern Standby for the two trace tools above: a demand-start service built from standby-wake.cs and a scheduled task for the logged-on user, both removed again when the run ends |
windows/etwdecode.cs |
Decodes an ETL through TDH into one TSV line per event (time, provider, id, task, event name, properties). Manifest and TraceLogging providers, GUID filter. Built with csc (standby-summary.py builds it into out/standby/ automatically) |
linux/s2idle-trace.sh |
Unattended repeated s2idle measurement on Linux: N cycles of rtcwake -m freeze; for each cycle the pmc_core residencies, low_power_idle_*_residency_us, suspend_stats, the wake source, dmesg (LPS0 _DSM, unmet constraints), ftrace (PM callbacks, ssam) and the battery energy (mW) go into summary.tsv. -n -s -a -t(pm_test) --turbostat. Settings it changes are restored. Run as root |
linux/perf-profiles.sh |
Applies the same CPU load (stress-ng) under each platform profile and then a long load under performance (test plan SAM-5, PWR-9). Every 5 seconds it takes turbostat (PkgWatt, PkgTmp, Bzy_MHz), the fan rpm, the package temperature, the surface_thermal maximum and temp9, and writes one line per run to summary.tsv. -l -c -s -o. The profile is restored at the end. Run as root. Counterpart of the Windows perf-modes.ps1 |
linux/kmod-dev.sh |
Module development loop on NixOS: inside nix develop .#kernel-dev it builds ~/.cache/sp9-kdev/src from the booted kernel derivation's src, patches and dev output (.config, Module.symvers) (prepare), builds only one directory with make M= (build), unloads the module together with its holders and insmods the new one (load), and exports commits as the next numbers in kernel/patches/ (patch). Described in docs/nixos.md, in the section on the module development loop |
linux/le-legacy-oob.py |
LE legacy OOB pairing through the kernel management socket: stores the 16 B Temporary Key of a peer (add-tk), pairs (pair) and removes the key (clear). Needs kernel patch 0023. c1 settles offline, from the Pairing Confirm of a trace, which byte order of the TK is right; selftest checks that computation against the Core Specification sample data. Used for the Slim Pen 2's cover coupling (pen-vendor-exchange.md section 2.5). Run as root |
linux/pen-bond-from-windows.py |
Reads the Slim Pen 2 bond Windows made through the cover (LTK, EDIV, Rand, IRK) from the Windows SYSTEM hive and writes it as a BlueZ info file. The Windows partition is mounted read-only for the copy and unmounted again. By default it only shows what it would write (keys masked); --install writes it. Run as root |
linux/cam-raw.sh |
Captures one raw Bayer frame straight from the IPU6 ISYS node, without libcamera (front or rear; exposure, gain, digital gain, focus, flips and size as arguments). It also leaves the pipeline formats set, so it is the set-up step for the two C tools below |
linux/cam-raw-stats.py |
Statistics of raw frames: the mean per Bayer position, the share of saturated pixels and sharpness (Tenengrad and Laplacian variance, divided by brightness). --columns lists columns and rows that differ from their neighbours (line defects in the raw data), --png writes a preview |
linux/cam-ctrl-delay.c |
Changes a sensor control (exposure, gain, vblank) while streaming and measures in which frame the change first shows. Used to settle the delays in libcamera's sensor properties. Build with cc -O2 |
linux/cam-focus-sweep.c |
Moves the lens (focus_absolute) up and down a range, prints the contrast of the raw frame at each position (the measure the libcamera patches use and a finer one) and saves the sharpest frame. Build with cc -O2 |
linux/cam-af-check.sh |
One rear focus check (15 s): runs the patched libcamera's autofocus and the sweep above on the same scene and prints the position autofocus chose next to the maximum of the sweep. The rear camera is held at the scene by hand. The saved frames show the room, so the output directory belongs under private/ |
windows/posture-trace.ps1 |
Compares snapshots (cover Features, KIP and PnP devices, tablet mode) before and after a change of the cover posture (such as folding the pen storage flap), and the ETW between them (the posture nodes of the Surface power tracker, SMF, ACPI, PnP). -Seconds, -Label. Run through run-elevated.ps1 |
repo-key.sh |
Creates, offline, the OpenPGP key that signs the apt and pacman repositories: a certify-only primary key and an expiring signing subkey; writes the public key for packaging/keyring/, the subkey for the CI secret and an offline backup, and prints the next steps (--renew-subkey adds a new subkey). Refuses a directory inside the repository (docs/releasing.md) |
labels-sync.sh |
Creates or updates the GitHub labels of the repository from .github/labels.tsv (labels not listed are left alone). tools/labels-sync.sh [OWNER/REPO], needs gh |