Commit 3f1e8ef4 authored by chrissi^'s avatar chrissi^
Browse files

sandbox: update uboot.py

parent f36c6dfe
#! /usr/bin/env python3
from labgrid import Environment
from labgrid.driver import SmallUBootDriver, GpioDigitalOutputDriver
from labgrid.driver import SmallUBootDriver, GpioDigitalOutputDriver, ShellDriver
import time
from labgrid.protocol import PowerProtocol
import os
......@@ -17,6 +17,7 @@ logging.basicConfig(level=logging.DEBUG)
from labgrid.consoleloggingreporter import ConsoleLoggingReporter
ConsoleLoggingReporter.start(".")
#def run_and_print(what, command):
# print("=========== Running '{}' =============".format(command))
# result, _, _ = what.run(command)
......@@ -32,24 +33,32 @@ ConsoleLoggingReporter.start(".")
#except Exception as e:
# pytest.exit("Failed to copy known-good firmware to tftp-server:"+str(e))
env = Environment("remote.yaml")
env = Environment("parker.yaml")
t = env.get_target("main")
pdr = t.get_driver(PowerProtocol)
t.activate(pdr)
#pdr = t.get_driver(PowerProtocol)
#t.activate(pdr)
st = t.get_driver("SmallUBootStrategy")
st.transition("good_config")
sh = t.get_driver("ShellDriver")
start = time.time()
for _ in range(120):
stdout, _, _ = sh.run("ps")
print(stdout)
if not "/usr/bin/gluon-reconfigure" in " ".join(stdout):
break
time.sleep(5)
else:
raise Exception("gluon-reconfigure took too long!")
print("gluon-reconfigure took {}s".format(time.time() - start))
pdr.off()
print("Device is off")
time.sleep(1)
reset = t.get_driver(GpioDigitalOutputDriver)
#t.activate(reset)
print(reset.get())
reset.set(True)
print(reset.get())
reset.set(False)
print(reset.get())
#pdr.off()
#print("Device is off")
#time.sleep(1)
#
#reset = t.get_driver(GpioDigitalOutputDriver)
#print(reset.get())
#st.transition("uboot")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment