[Upstream] crossensors empty EC motion-sensor slot: root cause, ready-to-merge PR, and the re-signing request

TL;DR

The Chromebook EC Sensor Hub Code 10 on boards with a gap in the EC motion-sensor table is now pinned down in upstream source, and there is a ready-to-merge fix PR. What is still missing is a re-signed release.

Root cause (confirmed in source, not guessed)

crossensors/crossensors.cpp, OnPrepareHardware():

pDevice->SensorCount = resp.dump.sensor_count;
for (int i = 0; i < pDevice->SensorCount; i++) {
    params.cmd = MOTIONSENSE_CMD_INFO;
    params.info.sensor_num = i;
    status = send_ec_command(...);
    if (!NT_SUCCESS(status)) {
        return status;   // <-- aborts the whole device
    }
    ...
}
return status;

Chrome EC motion-sensor tables are allowed to contain reserved/empty slots, which legitimately answer EC_RES_INVALID_PARAM. On Google Redrix (MrChromebox 2609.3 / redrix_14505.67.0, Windows 11 22621) the EC reports sensor_count = 5 and slot 3 is empty:

slot 0  bma422    accel (lid)    OK
slot 1  lsm6dsm   accel (base)   OK
slot 2  lsm6dsm   gyro  (base)   OK
slot 3  (empty)   MOTIONSENSE_CMD_INFO -> EC result 3 (INVALID_PARAM)
slot 4  tcs3400   rgb light       OK

Enumeration reaches slot 3, returns failure, and slot 4 is never visited. WDF then fails EvtDevicePrepareHardware, so ACPI\GOOG0006\1 ends up with Code 10 / 0xC00000E5, Windows never gets a Simple Device Orientation Sensor (SensorPresent=0), and native auto-rotation / convertible slate sensing is unavailable. This is not Redrix-specific: any board whose sensor table has a gap hits the same path.

The fix (PR #2)

Two lines, both in OnPrepareHardware():

  1. return status → continue inside the loop, so an empty slot is skipped.
  2. return status → return STATUS_SUCCESS after the loop, otherwise a failure status left over from the last skipped slot would still fail device start.

No new “lid accelerometer required” check: SensorWorkItem() already guards on pDevice->LidSensor != -1, so boards without one keep their existing behaviour.

Why a local binary patch is not a solution

The released crossensors.sys 1.0.1.0 is WHQL-signed (issuer Microsoft Windows Hardware Compatibility Publisher). A 2-byte binary workaround (file offset 0x1978: 78 18 → 90 90) confirms the diagnosis - with it the Sensor Hub starts, the Simple Device Orientation Sensor appears and native auto-rotation works. But any locally modified copy has to be self-signed, which on Windows 11 means keeping testsigning on permanently (kernel drivers must be Microsoft-signed since 1607, and all cross-signing certs expired in 2021):

  • turning test mode off → Code 52 / 0xC0000428
  • importing the self-signed CA into the trusted root with Secure Boot off → still rejected
  • Windows/driver updates silently revert the patch

So the fix has to arrive through a re-signed upstream release (WHQL / attestation), not from a patched binary sitting on one machine.

How you can help

  • If your board also has an empty sensor slot, please add your model / ectool motionsense info output to issue #1 - more affected boards makes it easier to prioritise.
  • If you have a channel to reach CoolStar, a pointer to PR #2 would help.
  • I can test any new build on this Redrix and report back here.

中文摘要:Redrix 等机型「Chromebook EC Sensor Hub」报 Code 10 的根因已在上游源码中定位——OnPrepareHardware() 枚举传感器时遇到空槽就直接中止。已提交可直接合并的两行修复 PR,但原厂驱动是 WHQL 签名,本地自签补丁必须常开测试模式,因此仍需官方重签发布才能彻底解决。详见上面三个 GitHub 链接。

Update: this is now fully solved - and no test signing is required.

MrChromebox responded to our upstream request and built a test Full ROM with a modified ECRW: the empty EC motion-sensor slot now returns a benign placeholder MOTIONSENSE_CMD_INFO response (Type: unknown) instead of EC_RES_INVALID_PARAM. I flashed it, restored the original WHQL-signed crossensors.sys 1.0.1.0, and have been running it for a full night plus several reboots. Everything works:

  • ACPI\GOOG0006\1 → OK / ProblemCode 0; ectool motionsense info 0..4 now succeeds on all five slots. EC RO redrix_14505.67.0 is untouched, RW redrix_16238.2+tbt5 synced correctly via EC Software Sync.
  • Native auto-rotation is fully working - Simple Device Orientation Sensor + HID sensor collection V2 OK, SensorService running, AutoRotation Enable/SensorPresent/SlateEnable = 1.
  • Tablet mode is perfectly fixed - ConvertibleSlateMode now flips 1 → 0 → 1 when folding, and the platform natively disables the physical keyboard in tablet posture. I was able to retire both the userland ectool rotation bridge and the keyboard-guard workaround entirely.
  • Fingerprint, S0/S4 sleep and hibernate (12 h overnight S4, ~9.7 mW drain), and all other peripherals are healthy. Zero devices with an error code in Device Manager.
  • testsigning OFF, no watermark, no self-signed driver, no test certificate.

Links:

Huge thanks to MrChromebox for turning this around so quickly, and to everyone who looked into the original case. I have asked him to carry the ECRW change into a regular firmware release so that a normal firmware update does not revert it.

Until that lands, please treat the attached ROM as an untested build and do not flash without a SuzyQ (his words). If you are hitting the same Code 10 / Code 52 on Redrix or another brya board, the issue linked above has the full root-cause analysis and the ectool motionsense info 0..4 repro.

Happy to share logs or answer questions.