How to use the labgrid.util.helper.processwrapper function in labgrid

To help you get started, we’ve selected a few labgrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github labgrid-project / labgrid / labgrid / driver / power / apc.py View on Github external
def _snmp_set(host, oid, value):
    try:
        processwrapper.check_output(
            "snmpset -v1 -c private {} {} {}".format(host, oid, value).split()
        )
    except Exception as e:
        raise ExecutionError("failed to set SNMP value") from e
github labgrid-project / labgrid / labgrid / driver / power / sentry.py View on Github external
def _snmp_get(host, oid):
    out = processwrapper.check_output(
        "snmpget -v1 -c private -O qn {} {}".format(host, oid).split()
    ).decode('ascii')
    out_oid, value = out.strip().split(' ', 1)
    assert oid == out_oid
    if value == "3" or value == "5":
        return True
    if value == "4":
        return False
github labgrid-project / labgrid / labgrid / driver / powerdriver.py View on Github external
def cycle(self):
        if self.cmd_cycle is not None:
            cmd = shlex.split(self.cmd_cycle)
            processwrapper.check_output(cmd)
        else:
            self.off()
            time.sleep(self.delay)
            self.on()
github labgrid-project / labgrid / labgrid / driver / usbstoragedriver.py View on Github external
def get_size(self):
        args = ["cat", "/sys/class/block/{}/size".format(self.storage.path[5:])]
        size = processwrapper.check_output(self.storage.command_prefix + args)
        return int(size)
github labgrid-project / labgrid / labgrid / driver / flashromdriver.py View on Github external
def __call__(self, *args):
        arg_list = list(args)
        arg_list.append('-p')
        arg_list.append('{}'.format(self.flashrom_resource.programmer))
        self.logger.debug('Call: %s with args: %s', self.tool, arg_list)
        processwrapper.check_output(self._get_flashrom_prefix() + arg_list)
github labgrid-project / labgrid / labgrid / driver / quartushpsdriver.py View on Github external
def flash(self, filename=None, address=0x0):
        if filename is None and self.image is not None:
            filename = self.target.env.config.get_image_path(self.image)
        mf = ManagedFile(filename, self.interface)
        mf.sync_to_resource()

        assert isinstance(address, int)

        cable_number = self._get_cable_number()
        cmd = self.interface.command_prefix + [self.tool]
        cmd += [
            "--cable={}".format(cable_number),
            "--addr=0x{:X}".format(address),
            "--operation=P {}".format(mf.get_remote_path()),
        ]
        processwrapper.check_output(cmd)
github labgrid-project / labgrid / labgrid / driver / fastbootdriver.py View on Github external
def oem_getenv(self, var):
        """Return barebox environment variable value via 'fastboot oem getenv <var>'."""
        cmd = ['oem', 'getenv', var]
        output = processwrapper.check_output(self._get_fastboot_prefix() + cmd)
        values = AndroidFastbootDriver._filter_fastboot_output(output)
        assert len(values) == 1, 'fastboot did not return exactly one line'
        return values[0]
</var>
github labgrid-project / labgrid / labgrid / driver / usbsdmuxdriver.py View on Github external
def set_mode(self, mode):
        if not mode.lower() in ['dut', 'host', 'off', 'client']:
            raise ExecutionError("Setting mode '%s' not supported by USBSDMuxDriver" % mode)
        cmd = self.mux.command_prefix + [
            self.tool,
            "-c",
            self.mux.control_path,
            mode.lower()
        ]
        processwrapper.check_output(cmd)
github labgrid-project / labgrid / labgrid / driver / openocddriver.py View on Github external
managed_configs = []
        for config in self.config:
            mconfig = ManagedFile(config, self.interface)
            mconfig.sync_to_resource()
            managed_configs.append(mconfig)

        cmd = self.interface.command_prefix+[self.tool]
        cmd += chain.from_iterable(("--search", path) for path in self.search)
        cmd += self._get_usb_path_cmd()

        for mconfig in managed_configs:
            cmd.append("--file")
            cmd.append(mconfig.get_remote_path())

        cmd += chain.from_iterable(("--command", "'{}'".format(command)) for command in commands)
        processwrapper.check_output(cmd)
github labgrid-project / labgrid / labgrid / driver / fastbootdriver.py View on Github external
def __call__(self, *args):
        processwrapper.check_output(self._get_fastboot_prefix() + list(args))