Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Align dfu zigbee command with pc-ble-driver>=0.15.0
Browse files Browse the repository at this point in the history
The API of call_cmd method changed in pc-ble-driver-py 0.15.0. Previously, the CalledProcessError was raised when nrfjprog command failed. Since version 0.15.0, it is replaced by RuntimeError.
Because RuntimeError has no returncode attribute, there is no good way to check the reason why command failed (parsing command output is not recommended, cause it can be changed).
When requirements of nrfutil are updated, the old code can be removed.
  • Loading branch information
jangalda-nsc committed Jan 12, 2021
1 parent 333dba6 commit b437d98
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nordicsemi/zigbee/ota_flasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ def _fw_check(self, path_to_file):
'''Check if the path_to_file hexfile was flashed correctly'''
try:
result = self.verify(path_to_file)
except subprocess.CalledProcessError as e:
if (e.returncode == OTAFlasher.ERROR_CODE_VERIFY_ERROR):
except subprocess.CalledProcessError as e: # for pc-ble-driver <= 0.14.2, can be removed when requirements
# will be updated to >= 0.15.0
if e.returncode == OTAFlasher.ERROR_CODE_VERIFY_ERROR:
return False
else:
raise
except RuntimeError: # for pc-ble-driver >= 0.15.0
return False

return (re.search(b'^Verified OK.$', result, re.MULTILINE) is not None)

def fw_check(self):
Expand Down

0 comments on commit b437d98

Please sign in to comment.