diff --git a/doc/configuration.rst b/doc/configuration.rst index f6ebec307..1363d04ca 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -655,8 +655,10 @@ specific device from all connected supported devices use the Arguments: - driver (str): name of the sigrok driver to use - - channels (str): optional, channel mapping as described in the sigrok-cli - man page + - channels (str): optional, channel mapping as described in the + ``sigrok-cli`` man page + - channel_group (str): optional, channel group as described in the + ``sigrok-cli`` man page Used by: - `SigrokDriver`_ @@ -896,8 +898,10 @@ A :any:`SigrokUSBDevice` resource describes a *Sigrok* USB device. Arguments: - driver (str): name of the sigrok driver to use - - channels (str): optional, channel mapping as described in the sigrok-cli - man page + - channels (str): optional, channel mapping as described in the + ``sigrok-cli`` man page + - channel_group (str): optional, channel group as described in the + ``sigrok-cli`` man page - match (dict): key and value pairs for a udev match, see `udev Matching`_ Used by: @@ -926,6 +930,8 @@ Arguments: - driver (str): name of the sigrok driver to use - channels (str): optional, channel mapping as described in the ``sigrok-cli`` man page + - channel_group (str): optional, channel group as described in the + ``sigrok-cli`` man page - match (dict): key and value pairs for a udev match, see `udev Matching`_ Used by: diff --git a/labgrid/driver/sigrokdriver.py b/labgrid/driver/sigrokdriver.py index 747f3ac66..5be7b9aec 100644 --- a/labgrid/driver/sigrokdriver.py +++ b/labgrid/driver/sigrokdriver.py @@ -89,6 +89,8 @@ def _get_sigrok_prefix(self): prefix += ["-d", self.sigrok.driver] if self.sigrok.channels: prefix += ["-C", self.sigrok.channels] + if self.sigrok.channel_group: + prefix += ["-g", self.sigrok.channel_group] return self.sigrok.command_prefix + prefix @Driver.check_active @@ -109,6 +111,8 @@ def _call(self, *args): combined = self.sigrok.command_prefix + [self.tool] if self.sigrok.channels: combined += ["-C", self.sigrok.channels] + if self.sigrok.channel_group: + combined += ["-g", self.sigrok.channel_group] combined += list(args) self.logger.debug("Combined command: %s", combined) self._process = subprocess.Popen( diff --git a/labgrid/remote/exporter.py b/labgrid/remote/exporter.py index 8f0f77243..2045c1146 100755 --- a/labgrid/remote/exporter.py +++ b/labgrid/remote/exporter.py @@ -373,6 +373,7 @@ def _get_params(self): "model_id": self.local.model_id, "driver": self.local.driver, "channels": self.local.channels, + "channel_group": self.local.channel_group, } diff --git a/labgrid/resource/sigrok.py b/labgrid/resource/sigrok.py index bbe9356c1..7fa123365 100644 --- a/labgrid/resource/sigrok.py +++ b/labgrid/resource/sigrok.py @@ -6,15 +6,20 @@ @target_factory.reg_resource @attr.s(eq=False) class SigrokDevice(Resource): - """The SigrokDevice describes an attached sigrok device with driver and - channel mapping + """The SigrokDevice describes an attached sigrok device with driver, + channel mapping and channel group Args: driver (str): driver to use with sigrok channels (str): a sigrok channel mapping as described in the sigrok-cli man page + channel_group (str): a sigrok channel group as described in the sigrok-cli man page """ driver = attr.ib(default="demo") channels = attr.ib( default=None, validator=attr.validators.optional(attr.validators.instance_of(str)) ) + channel_group = attr.ib( + default=None, + validator=attr.validators.optional(attr.validators.instance_of(str)) + ) diff --git a/labgrid/resource/udev.py b/labgrid/resource/udev.py index 136aaf11b..4ac301bf5 100644 --- a/labgrid/resource/udev.py +++ b/labgrid/resource/udev.py @@ -396,6 +396,7 @@ class SigrokUSBDevice(USBResource): Args: driver (str): driver to use with sigrok channels (str): a sigrok channel mapping as described in the sigrok-cli man page + channel_group (str): a sigrok channel group as described in the sigrok-cli man page """ driver = attr.ib( default=None, @@ -406,6 +407,11 @@ class SigrokUSBDevice(USBResource): validator=attr.validators.optional(attr.validators.instance_of(str)) ) + channel_group = attr.ib( + default=None, + validator=attr.validators.optional(attr.validators.instance_of(str)) + ) + def __attrs_post_init__(self): self.match['@SUBSYSTEM'] = 'usb' super().__attrs_post_init__() @@ -421,6 +427,7 @@ class SigrokUSBSerialDevice(USBResource): Args: driver (str): driver to use with sigrok channels (str): a sigrok channel mapping as described in the sigrok-cli man page + channel_group (str): a sigrok channel group as described in the sigrok-cli man page """ driver = attr.ib( default=None, @@ -430,6 +437,10 @@ class SigrokUSBSerialDevice(USBResource): default=None, validator=attr.validators.optional(attr.validators.instance_of(str)) ) + channel_group = attr.ib( + default=None, + validator=attr.validators.optional(attr.validators.instance_of(str)) + ) def __attrs_post_init__(self): self.match['SUBSYSTEM'] = 'tty'