10000 Fix 'wings' mode in SmartDevice by pferreir · Pull Request #769 · liquidctl/liquidctl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix 'wings' mode in SmartDevice #769

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pferreir
Copy link
@pferreir pferreir commented Mar 2, 2025

Using wings mode currently fails with an IndexError. I didn't run the automated tests since it's just two lines and it's broken in its current state anyway.


Checklist:

New CLI flag?

  • Adjust the completion scripts in extra/completions/

New device?

  • Regenerate extra/linux/71-liquidctl.rules (instructions in the file header)
  • Add entry to the README's supported device list with applicable notes and git MRLV

New driver?

  • Document the protocol in docs/developer/protocol/

It would fail with an IndexError otherwise
Copy link
Member
@jonasmalacofilho jonasmalacofilho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check if the two changes I suggested still work on the real hardware?

If they do, could you also please try to add a minimal test case so that we don't break this mode again in the future?


Oh, and please ignore the style check error on 3379ac6. That's from an unrelated change in the formatter, and I already fixed the offending docstring in main.

@@ -643,7 +643,7 @@ def _write_colors(self, cid, mode, colors, sval, direction='forward',):
for [g, r, b] in colors:
self._write([0x22, 0x10, cid]) # clear out all independent LEDs
self._write([0x22, 0x11, cid]) # clear out all independent LEDs
color_lists = [] * 3
color_lists = [0] * 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking back into how the broken line of coded ended up here (mea culpa), it seems that the intention was to create a list of four empty lists:

Suggested change
color_lists = [0] * 3
color_lists = [[]] * 4

The first three lists would be filled in, but the forth would be left empty.

@@ -653,7 +653,7 @@ def _write_colors(self, cid, mode, colors, sval, direction='forward',):
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x05, 0x85, 0x05, 0x85, 0x05, 0x85, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00])
self._write(msg + color_lists[i % 4])
self._write(msg + color_lists[i % 3])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reasons unknown to me (don't have this particular device), it seems that the modulo 4 indexing was intentional, and that some writes should send an empty color list.

Suggested change
self._write(msg + color_lists[i % 3])
self._write(msg + color_lists[i % 4])

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.

2 participants
0