commander_core: fix set_fixed_speed/set_speed_profile for firmware 2.x#885
Open
indyfive11 wants to merge 1 commit into
Open
commander_core: fix set_fixed_speed/set_speed_profile for firmware 2.x#885indyfive11 wants to merge 1 commit into
indyfive11 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On devices running firmware 2.x (confirmed: Commander ST 0x0c32, fw 2.0.19), every call to
set_fixed_speedorset_speed_profileraisesExpectationNotMet('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:
(0x60, 0x6d)(0x61, 0x6d)(0x03, 0x00)(0x61, 0x6d)(0x62, 0x6d)(0x04, 0x00)(0x62, 0x6d)(0x64, 0x6d)(0x05, 0x00)Data types and payload formats are identical between firmware versions — only the endpoint IDs differ.
get_statusandinitializeare 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
_MODE_HW_SPEED_MODE_V2,_MODE_HW_FIXED_PERCENT_V2, and_MODE_HW_CURVE_PERCENT_V2constants for the fw 2.x endpoint IDs.set_fixed_speedorset_speed_profile(via_ensure_fw_version()), or earlier ifinitialize()was called first.set_fixed_speedandset_speed_profileselect 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_fw2test_set_fixed_speed_fans_commander_core_fw2test_set_speed_profile_fans_commander_core_fw2The 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