Skip to content

commander_core: fix set_fixed_speed/set_speed_profile for firmware 2.x#885

Open
indyfive11 wants to merge 1 commit into
liquidctl:mainfrom
indyfive11:fix/commander-core-fw2-endpoint-shift
Open

commander_core: fix set_fixed_speed/set_speed_profile for firmware 2.x#885
indyfive11 wants to merge 1 commit into
liquidctl:mainfrom
indyfive11:fix/commander-core-fw2-endpoint-shift

Conversation

@indyfive11
Copy link
Copy Markdown

Problem

On devices running firmware 2.x (confirmed: Commander ST 0x0c32, fw 2.0.19), every call to set_fixed_speed or set_speed_profile raises ExpectationNotMet('device returned incorrect data type'). This is the root cause of the failures tracked in #753.

Root cause

Corsair shifted the hardware-profile endpoint IDs by one position in firmware 2.x. The driver was opening the old fw 1.x IDs and always received a mismatched data type in the response:

Purpose fw 1.x endpoint fw 2.x endpoint Data type (unchanged)
Speed mode selector (0x60, 0x6d) (0x61, 0x6d) (0x03, 0x00)
Fixed % values (0x61, 0x6d) (0x62, 0x6d) (0x04, 0x00)
Speed curves (0x62, 0x6d) (0x64, 0x6d) (0x05, 0x00)

Data types and payload formats are identical between firmware versions — only the endpoint IDs differ. get_status and initialize are unaffected (they use different endpoints that did not shift).

This was determined by exhaustively probing all hardware-profile endpoints via raw USB HID while coolercontrold was stopped, then confirmed by live write tests: after writing 100% duty to the correct fw 2.x endpoints and sending SLEEP, fan 1 ramped from ~1100 RPM to ~2300 RPM (+1163 RPM).

Fix

  • Added _MODE_HW_SPEED_MODE_V2, _MODE_HW_FIXED_PERCENT_V2, and _MODE_HW_CURVE_PERCENT_V2 constants for the fw 2.x endpoint IDs.
  • The firmware major version is fetched and cached on first call to set_fixed_speed or set_speed_profile (via _ensure_fw_version()), or earlier if initialize() was called first.
  • set_fixed_speed and set_speed_profile select the appropriate endpoint tuple based on firmware major version. Devices on fw 1.x are unaffected.

Testing

All 12 existing tests continue to pass. Three new tests cover the fw 2.x paths:

  • test_set_fixed_speed_fan2_commander_core_fw2
  • test_set_fixed_speed_fans_commander_core_fw2
  • test_set_speed_profile_fans_commander_core_fw2

The fix has been confirmed working end-to-end on a live Commander ST (0x0c32, fw 2.0.19) under coolercontrold — no more 502 errors and fan profiles apply correctly.

Fixes #753

Corsair shifted the hardware-profile endpoint IDs by one position in
firmware 2.x.  The driver was opening the old (fw 1.x) IDs and always
received an unexpected data type in return, causing ExpectationNotMet
on every set_fixed_speed / set_speed_profile call (see liquidctl#753).

Verified by live USB-level probing of a Commander ST (0x0c32, fw 2.0.19):

  Purpose        fw 1.x endpoint  fw 2.x endpoint  data type (unchanged)
  Speed mode sel (0x60, 0x6d)     (0x61, 0x6d)     (0x03, 0x00)
  Fixed %        (0x61, 0x6d)     (0x62, 0x6d)     (0x04, 0x00)
  Speed curves   (0x62, 0x6d)     (0x64, 0x6d)     (0x05, 0x00)

Data types and payload formats are identical across both firmware versions.

The driver now fetches the firmware major version on first use of
set_fixed_speed or set_speed_profile (caching it after initialize()
if that was called first), and selects the appropriate endpoint tuple.
Devices on fw 1.x are unaffected.

Fixes liquidctl#753
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.

Corsair Commander Core/Core XT/ST firmware 2.0 issues

1 participant