mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 10:10:46 +00:00
Merge pull request #192 from derkling/acme_fix_iio-capture_release
Instrument/Acmecape: ensure iio-capture termination
This commit is contained in:
commit
16d5e0b6a7
@ -58,6 +58,12 @@ class AcmeCapeInstrument(Instrument):
|
|||||||
self.add_channel('device', 'current')
|
self.add_channel('device', 'current')
|
||||||
self.add_channel('timestamp', 'time_ms')
|
self.add_channel('timestamp', 'time_ms')
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
if self.process and self.process.pid:
|
||||||
|
self.logger.warning('killing iio-capture process [%d]...',
|
||||||
|
self.process.pid)
|
||||||
|
self.process.kill()
|
||||||
|
|
||||||
def reset(self, sites=None, kinds=None, channels=None):
|
def reset(self, sites=None, kinds=None, channels=None):
|
||||||
super(AcmeCapeInstrument, self).reset(sites, kinds, channels)
|
super(AcmeCapeInstrument, self).reset(sites, kinds, channels)
|
||||||
self.raw_data_file = tempfile.mkstemp('.csv')[1]
|
self.raw_data_file = tempfile.mkstemp('.csv')[1]
|
||||||
@ -98,6 +104,7 @@ class AcmeCapeInstrument(Instrument):
|
|||||||
.format(self.process.returncode, output))
|
.format(self.process.returncode, output))
|
||||||
if not os.path.isfile(self.raw_data_file):
|
if not os.path.isfile(self.raw_data_file):
|
||||||
raise HostError('Output CSV not generated.')
|
raise HostError('Output CSV not generated.')
|
||||||
|
self.process = None
|
||||||
|
|
||||||
def get_data(self, outfile):
|
def get_data(self, outfile):
|
||||||
if os.stat(self.raw_data_file).st_size == 0:
|
if os.stat(self.raw_data_file).st_size == 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user