Skip to content

Barebox/UBoot/SmallUBootDriver: handle hex arguements properly #1623

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion labgrid/driver/bareboxdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ def _await_prompt(self):

elif index == 1:
# we need to interrupt autoboot
self.console.write(self.interrupt.encode('ASCII'))
interrupt = self.interrupt.encode('ASCII')
if self.interrupt.startswith('\\x'):
try:
interrupt = bytearray.fromhex(self.interrupt[2:])
except ValueError:
pass
self.console.write(interrupt)

elif index == 2:
# we need to enter the password
Expand Down
12 changes: 10 additions & 2 deletions labgrid/driver/smallubootdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,18 @@ def _await_prompt(self):

# wait for boot expression. Afterwards enter secret
self.console.expect(self.boot_expression, timeout=self.login_timeout)

secret = self.boot_secret.encode('ASCII')
if self.boot_secret.startswith('\\x'):
try:
secret = bytearray.fromhex(self.boot_secret[2:])
except ValueError:
pass

if self.boot_secret_nolf:
self.console.write(self.boot_secret.encode('ASCII'))
self.console.write(secret)
else:
self.console.sendline(self.boot_secret)
self.console.sendline(secret)
self._status = 1

# wait until UBoot has reached it's prompt
Expand Down
8 changes: 7 additions & 1 deletion labgrid/driver/ubootdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ def _await_prompt(self):
break

elif index == 1:
self.console.write(self.interrupt.encode('ASCII'))
interrupt = self.interrupt.encode('ASCII')
if self.interrupt.startswith('\\x'):
try:
interrupt = bytearray.fromhex(self.interrupt[2:])
except ValueError:
pass
self.console.write(interrupt)

elif index == 2:
if not self.password:
Expand Down