Skip to content

Commit

Permalink
Merge pull request #17 from SalDaniele/fix_get_mode
Browse files Browse the repository at this point in the history
fix get_mode
  • Loading branch information
bn222 authored Oct 3, 2023
2 parents 0b95035 + 09d00d8 commit 157af62
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions get_mode
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def main():
parser.add_argument('-v', '--verbose', dest='verbose',
default=False, action='store', type=bool,
help='Enable verbose output. This will show the settings')
parser.add_argument('-n', '--next_boot', action='store_true',
help='Get the next_boot mode of the BF')
args = parser.parse_args()

bf = common_bf.find_bf_pci_addresses_or_quit(args.id)
Expand All @@ -21,7 +23,7 @@ def main():
"INTERNAL_CPU_OFFLOAD_ENGINE"
]
all_cfg = " ".join(cfg)
ret = common_bf.run(f"mstconfig -d {bf} q {all_cfg}").out
ret = common_bf.run(f"mstconfig -e -d {bf} q {all_cfg}").out

save_next = False
settings = {}
Expand All @@ -31,8 +33,12 @@ def main():
if e.startswith("Configurations:"):
save_next = True
elif save_next:
k, v = e.split()
settings[k] = v.split("(")[1].split(")")[0]
if "different from default/current" in e:
save_next = False
continue
k, default, current, next_boot = e.lstrip('*').split()
config = next_boot if args.next_boot else current
settings[k] = config.split("(")[1].split(")")[0]

dpu_mode = {
'INTERNAL_CPU_MODEL': '1',
Expand Down

0 comments on commit 157af62

Please sign in to comment.