From 0b04ffcc443f27424146905a0525491f90cd084c Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Wed, 4 Oct 2017 17:12:27 +0100 Subject: [PATCH 1/3] acmecape: Fix default iio-capture binary name --- devlib/instrument/acmecape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index 1053c9d..5300343 100644 --- a/devlib/instrument/acmecape.py +++ b/devlib/instrument/acmecape.py @@ -37,7 +37,7 @@ class AcmeCapeInstrument(Instrument): mode = CONTINUOUS def __init__(self, target, - iio_capture=which('iio_capture'), + iio_capture=which('iio-capture'), host='baylibre-acme.local', iio_device='iio:device0', buffer_size=256): From dbe568f51be54c4cb2db9540489c8a0de5c6a19b Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Wed, 4 Oct 2017 17:32:32 +0100 Subject: [PATCH 2/3] acmecape: Add check for nonzero return code from iio-capture --- devlib/instrument/acmecape.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index 5300343..0b10d08 100644 --- a/devlib/instrument/acmecape.py +++ b/devlib/instrument/acmecape.py @@ -77,17 +77,22 @@ class AcmeCapeInstrument(Instrument): def stop(self): self.process.terminate() timeout_secs = 10 + output = '' for _ in xrange(timeout_secs): if self.process.poll() is not None: break time.sleep(1) else: - output = _read_nonblock(self.process.stdout) + output += _read_nonblock(self.process.stdout) self.process.kill() self.logger.error('iio-capture did not terminate gracefully') if self.process.poll() is None: msg = 'Could not terminate iio-capture:\n{}' raise HostError(msg.format(output)) + if self.process.returncode != 15: # iio-capture exits with 15 when killed + output += self.process.stdout.read() + raise HostError('iio-capture exited with an error ({}), output:\n{}' + .format(self.process.returncode, output)) if not os.path.isfile(self.raw_data_file): raise HostError('Output CSV not generated.') From 7dd781135546cc081f84bc2acd6d3c44afd5c785 Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Mon, 9 Oct 2017 15:28:57 +0100 Subject: [PATCH 3/3] acmecape: Add note on how to reboot ACME The ACME firmware sometimes benefits from turning-it-off-and-on-again. --- devlib/instrument/acmecape.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index 0b10d08..818094f 100644 --- a/devlib/instrument/acmecape.py +++ b/devlib/instrument/acmecape.py @@ -91,6 +91,9 @@ class AcmeCapeInstrument(Instrument): raise HostError(msg.format(output)) if self.process.returncode != 15: # iio-capture exits with 15 when killed output += self.process.stdout.read() + self.logger.info('ACME instrument encountered an error, ' + 'you may want to try rebooting the ACME device:\n' + ' ssh root@{} reboot'.format(self.host)) raise HostError('iio-capture exited with an error ({}), output:\n{}' .format(self.process.returncode, output)) if not os.path.isfile(self.raw_data_file):