Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

west: bossac: handle stty from coreutils on macOS #62803

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/west_commands/runners/bossac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading