-
-
Notifications
You must be signed in to change notification settings - Fork 238
ykushcmd: Add string support to ykushcmd command #1272
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
ykushcmd: Add string support to ykushcmd command #1272
Conversation
de62b3a to
af7f668
Compare
|
I don't see how this change would be useful in the context of labgrid. As far as I understand, this would allow exporting a YEPKIT Switchable USB Hub as a single resource. I cannot imagine a case where that would be useful. Could you please elaborate why it is? |
|
Are you still interested in this PR? |
We are still interested in this functionality mainly our scenario focus on controlling the power to individual all ports on a ykush machine to power on/off a single device connected to a ykush multiple times over having to power on/off all devices at once. This change would preserve the individual functionality as it works now but allowing for a string would enable the 'a' command to power cycle all ports on the device. |
|
@cgturner1 Can you explain your board setup a bit more? I can't really see how this would be useful. |
@Bastian-Krause sorry for keeping you waiting that long, so basically changing "int" to "str" allows ykushcmd to affect the whole board instead of just one power port when needed. https://www.learn.yepkit.com/reference/ykushcmd-reference-ykush/1/2 |
@Bastian-Krause @jluebbe @Emantor I don't really understand why this change wasn't implemented from the beginning. It's one of the basic functionalities of ykush. |
I think it was not implemented because it does not really match the concept of a YKUSHPowerPort when you actually work on multiple ports. What happens when querying the power state for "a"? @jluebbe What do you think about this? |
error, because "a" it's not a int. this is small change for You, but big change for us. |
No, I meant with this PR applied (e.g. |
By doing a static analysis of this function it will fail due to different port numbers. 'a' != 15 By running ykushcmd -g a ykushcmd returns the port number of the USB that supplies the board with power, at least in my configuration.
|
By default ykushcmd command supports option to [on, off, cycle] whole ykush yepkit. > ykushcmd -u a # 'a' stands for all ports > ykushcmd -d a # 'a' stands for all ports In current build only int is supported for port number, changing it to string allows to control power on all ports with one command instead of 3 if there are 3 ports. Signed-off-by: Redzynia, MateuszX <mateuszx.redzynia@intel.com> [bst: adjusted docs accordingly] Signed-off-by: Bastian Krause <bst@pengutronix.de>
af7f668 to
bafb51a
Compare
Bastian-Krause
left a comment
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.
Okay, since multiple people seem to be interested in this, I've added documentation for the use case and I think we can merge this.
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.
Pull request overview
This PR extends the YKUSHPowerPort resource to support string values for the port index parameter, enabling users to specify 'a' to control all ports on a YKUSH USB hub simultaneously instead of controlling each port individually.
Changes:
- Modified YKUSHPowerPort and NetworkYKUSHPowerPort to accept string index values instead of integers
- Updated documentation to reflect the string type and document the 'a' option for controlling all ports
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| labgrid/resource/ykushpowerport.py | Changed index parameter from int to str type with string validator and converter for both YKUSHPowerPort and NetworkYKUSHPowerPort classes |
| doc/configuration.rst | Updated YKUSHPowerPort documentation example to use quoted string for index and added documentation for using 'a' to control all ports |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1272 +/- ##
======================================
Coverage 45.1% 45.1%
======================================
Files 173 173
Lines 13712 13712
======================================
Hits 6188 6188
Misses 7524 7524
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |

Description
By default ykushcmd command supports option to [on, off, cycle] whole ykush yepkit.
In current build only int is supported for port number, changing it to string allows to control power on all ports with one command instead of 3 if there are 3 ports.
Tested locally.
Checklist