-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commander core update #501
Commander core update #501
Conversation
I have test this on my Corsair H150i Elite Capellix with firmware v.2.10.219, it works but i'm not very confident about the few modifications of the unit tests. |
Fix looks good. Do you mind adding the flow to the protocol documentation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
On top of Parker's comment, please see the two notes I left.
tests/test_commander_core.py
Outdated
@@ -30,7 +30,7 @@ def __init__(self): | |||
self.sent = list() | |||
|
|||
self._last_write = bytes() | |||
self._modes = {} | |||
self._modes = [None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it seems that the issue is that
# In MockCommanderCoreDevice.write():
if self._modes[channel] is None:
should have always been
if self._modes.get(channel) is None:
What do you think, @ParkerMc?
Either way, initializing a dict with a list doesn't feel right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonasmalacofilho Thanks for your feedback you're right it seems to be a better solution to leave the dict empty. I tested with your suggestion to get the mode and it works.
.gitignore
Outdated
.DS_Store | ||
.vscode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a personal global gitignore file for editor files, given that they are a personal and therefore vary varied choice. See gitignore
for more information, especially the core.excludesFile
part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done.
Inside _send_command, read until response doesn't start by 0x00
223b11f
to
c951be9
Compare
@ParkerMc I updated the write function in test to ensure mode is not set whereas previous was not reset. I had to ensure device initially call a reset because of the command flow modification (reset is not the first command anymore) . I don't see any section in protocol documentation about the command flow but i can create a new one to document this changed for all new firmware versions from v2.10.219 |
c951be9
to
0cbcd2d
Compare
0cbcd2d
to
40d8430
Compare
Is that necessary? From my testing, reset is only needed after a write or read.
This is the proper use of the protocol so it applies to v1 and v2. I just had the flow wrong but it still worked. |
Rename functions Update protocol documentation.
@ParkerMc You're right, i remove this unnecessary call and update the protocol doc. |
@ParkerMc does everything here look good to you? |
Yeah, looks great. Sorry, I thought I had replied the other day. |
Great! Thank you both! |
Add support for the last Corsair Commander Core firmware v2.10.219.
I follow the explanation of ParkerMC to fix the issue, I changed the flow inside the _read_data and _write_data functions to follow the flow described by ParkerMC : set_mode > read / write > reset
I changed the read operation inside _send_command function to read until response starts with 0x00.
After changes to the command flow the tests failed with an "Key Error" at line 117 of file test_commander_core.py.
This is because when i delayed de reset command in read_data and when we start with a set_mode command the _modes array of the Mock device is empty. To prevent this i set in init a None value inside the _modes array.
Fixes: #464
Checklist:
liquidctl.8
Linux/Unix/Mac OS man pagedocs/*guide.md
device guidesNew CLI flag?
extra/completions/
New device?
extra/linux/71-liquidctl.rules
(instructions in the file header)en
)New driver?
docs/developer/protocol/