From 56f7ec2696a88ef3d9f8973817abb2ebc4c0e666 Mon Sep 17 00:00:00 2001 From: Grigor Kolev Date: Mon, 4 Mar 2024 14:26:48 +0200 Subject: [PATCH] Update sas.py BadCommandIsRunning will be raised as an error if the machine is responding too slowly or much faster than you --- sas.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sas.py b/sas.py index eb39b0a..dd38b44 100644 --- a/sas.py +++ b/sas.py @@ -190,19 +190,18 @@ def _send_command( except ValueError as e: self.log.critical("no sas response %s" % (str(buf_header[1:]))) return None + else: + if int(binascii.hexlify(response)[2:4], 16) != buf_header[1]: + raise BadCommandIsRunning('response %s run %s' % (binascii.hexlify(response), binascii.hexlify(bytearray(buf_header)))) response = Crc.validate(response) self.log.debug("sas response %s", binascii.hexlify(response)) return response - - except BadCRC as e: - raise e - + except Exception as e: self.log.critical(e, exc_info=True) - return None @deprecated("use utils.Crc validation fuction")