diff options
author | setrofim <setrofim@gmail.com> | 2017-10-10 08:33:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-10 08:33:56 +0100 |
commit | 34e7e4c89534235ec30b8ba217d4fbf1bfaf724e (patch) | |
tree | a5dcd35d6f84edfdbaf052f1f1ff57ba939a4f57 | |
parent | 535fc7ea63c233c061b99f1c99e480ccfb3d6730 (diff) | |
parent | 7dd781135546cc081f84bc2acd6d3c44afd5c785 (diff) | |
download | devlib-34e7e4c89534235ec30b8ba217d4fbf1bfaf724e.tar.gz |
Merge pull request #186 from bjackman/acmecape-improvements
Acmecape improvements
-rw-r--r-- | devlib/instrument/acmecape.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index 1053c9d..818094f 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): @@ -77,17 +77,25 @@ 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() + 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): raise HostError('Output CSV not generated.') |