Skip to content

Commit bafb51a

Browse files
redzynixBastian-Krause
authored andcommitted
ykushcmd: Add string support to ykushcmd command
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>
1 parent d02396e commit bafb51a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

doc/configuration.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,16 @@ hub.
303303
304304
YKUSHPowerPort:
305305
serial: 'YK12345'
306-
index: 1
306+
index: '1'
307307
308308
The example describes port 1 on the YKUSH USB hub with the
309309
serial ``YK12345``.
310310
Use ``ykushcmd -l`` to get your serial number.
311311

312312
Arguments:
313313
- serial (str): serial number of the YKUSH hub
314-
- index (int): number of the port to switch
314+
- index (str): number of the port to switch, use ``a`` to control the whole hub as one logical
315+
port
315316

316317
Used by:
317318
- `YKUSHPowerDriver`_

labgrid/resource/ykushpowerport.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class YKUSHPowerPort(Resource):
1111
1212
Args:
1313
serial (str): serial of the YKUSH device
14-
index (int): port index"""
14+
index (str): port index"""
1515
serial = attr.ib(validator=attr.validators.instance_of(str))
16-
index = attr.ib(validator=attr.validators.instance_of(int),
17-
converter=int)
16+
index = attr.ib(validator=attr.validators.instance_of(str),
17+
converter=str)
1818

1919
@target_factory.reg_resource
2020
@attr.s(eq=False)
@@ -23,7 +23,7 @@ class NetworkYKUSHPowerPort(NetworkResource):
2323
2424
Args:
2525
serial (str): serial of the YKUSH device
26-
index (int): port index"""
26+
index (str): port index"""
2727
serial = attr.ib(validator=attr.validators.instance_of(str))
28-
index = attr.ib(validator=attr.validators.instance_of(int),
29-
converter=int)
28+
index = attr.ib(validator=attr.validators.instance_of(str),
29+
converter=str)

0 commit comments

Comments
 (0)