File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ """
4+ Simple demo showing how to get started with the tplgtool2.py parser.
5+
6+ Tip: try these commands interactively in "ipython3"; with TAB completion.
7+ """
8+
9+ import sys
10+ from tplgtool2 import TplgBinaryFormat , TplgType , DapmType
11+
12+ TPLG_FORMAT = TplgBinaryFormat ()
13+
14+
15+ def main ():
16+ "Main function"
17+
18+ parsed_tplg = TPLG_FORMAT .parse_file (sys .argv [1 ])
19+
20+ # pylint: disable=invalid-name
21+ DAPMs = [
22+ item for item in parsed_tplg if item .header .type == TplgType .DAPM_WIDGET .name
23+ ]
24+
25+ for dapm in DAPMs :
26+
27+ schedulers = [b for b in dapm .blocks if b .widget .id == DapmType .SCHEDULER .name ]
28+
29+ assert len (schedulers ) <= 1
30+
31+ sched = schedulers [0 ].widget .name if len (schedulers ) == 1 else "none"
32+
33+ print (f"\n --- SCHEDULER = { sched } ------- \n " )
34+
35+ for block in dapm .blocks :
36+ if block .widget .id == DapmType .SCHEDULER .name :
37+ continue
38+ print (f"{ block .widget .id } : { block .widget .name } " )
39+
40+
41+ if __name__ == "__main__" :
42+ main ()
You can’t perform that action at this time.
0 commit comments