File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -27,3 +27,31 @@ def get_globals(command):
2727 assert isinstance (command , BareboxDriver )
2828 out = command .run_check ("global" )
2929 return split_to_dict (out , delimiter = ":" , strip_chars = "* " )
30+
31+ def devinfo (command , device ):
32+ """Returns the devinfo as dict
33+ Args:
34+ command (BareboxDriver): An instance of the BareboxDriver
35+ device (string): device to call devinfo on
36+ Returns:
37+ dict: parameters
38+ """
39+ assert isinstance (command , BareboxDriver )
40+ stdout = command .run_check ("devinfo {}" .format (device ))
41+
42+ results = {}
43+ state = '\n ' .join (stdout )
44+ for line in state .splitlines ():
45+ line = line .strip ()
46+ if not line :
47+ continue
48+ k , v = line .split (':' , 1 )
49+ v = v .strip ()
50+ if ' ' in v :
51+ v , _ = v .split (' ' , 1 )
52+ if not k or not v :
53+ continue
54+ v = v .strip ()
55+ results [k ] = v
56+
57+ return results
You can’t perform that action at this time.
0 commit comments