diff --git a/scripts/west_commands/runners/bossac.py b/scripts/west_commands/runners/bossac.py index ab214210c785ec6..fcbd6fdf92be4e1 100644 --- a/scripts/west_commands/runners/bossac.py +++ b/scripts/west_commands/runners/bossac.py @@ -149,12 +149,19 @@ def get_image_offset(self, supports_offset): return None + def is_gnu_coreutils_stty(self): + try: + result = subprocess.run(['stty', '--version'], capture_output=True, text=True, check=True) + return 'coreutils' in result.stdout + except subprocess.CalledProcessError: + return False + def set_serial_config(self): if platform.system() == 'Linux' or platform.system() == 'Darwin': self.require('stty') # GNU coreutils uses a capital F flag for 'file' - flag = '-F' if platform.system() == 'Linux' else '-f' + flag = '-F' if self.is_gnu_coreutils_stty() else '-f' if self.is_extended_samba_protocol(): self.speed = '1200'