Skip to content

Commit 9c2ac11

Browse files
Merge pull request #1188 from nlabriet/ubootstrategy-initial-state
ubootstrategy: add support for initial state
2 parents 4ca2a60 + a537119 commit 9c2ac11

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

labgrid/strategy/ubootstrategy.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,16 @@ def transition(self, status):
5757
else:
5858
raise StrategyError(f"no transition found from {self.status} to {status}")
5959
self.status = status
60+
61+
def force(self, status):
62+
if not isinstance(status, Status):
63+
status = Status[status]
64+
if status == Status.off:
65+
self.target.activate(self.power)
66+
elif status == Status.uboot:
67+
self.target.activate(self.uboot)
68+
elif status == Status.shell:
69+
self.target.activate(self.shell)
70+
else:
71+
raise StrategyError("can not force state {}".format(status))
72+
self.status = status

0 commit comments

Comments
 (0)