From 47b5b4c1a7a1050c6a9dd0c93a26a59588cb6e34 Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Fri, 13 Dec 2019 14:08:30 +0800 Subject: [PATCH 1/2] toos: sof-dump-status: refine to get the card short name correctly Sometimes card short name has blank space inside it. This will cause sof-dump-status.py get the wrong short name. This patch uses ' - ' as the splitter. This patch requires the card short name doesn't include ' - '. Signed-off-by: Libin Yang --- tools/sof-dump-status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sof-dump-status.py b/tools/sof-dump-status.py index 93062eb6..57d23fef 100755 --- a/tools/sof-dump-status.py +++ b/tools/sof-dump-status.py @@ -98,7 +98,7 @@ def _loadACard(self): for idx in range(0, len(output), 2): card_info={} card_info['id'] = output[idx].strip().split(' ')[0] - card_info['short'] = output[idx].split(' ')[-1].strip() + card_info['short'] = output[idx].split(' - ')[-1].strip() card_info['type']=output[idx].strip().split()[1][1:] card_info['desc']=output[idx + 1].strip() card_info['codec']=[] From b58f2ed25f23d5528f6682f833c3b7c1ff995523 Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Fri, 13 Dec 2019 14:28:39 +0800 Subject: [PATCH 2/2] tools: sof-dump-status: add the card long name dump support This patch adds the card long name dump support. Signed-off-by: Libin Yang --- tools/sof-dump-status.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/sof-dump-status.py b/tools/sof-dump-status.py index 57d23fef..c30cd714 100755 --- a/tools/sof-dump-status.py +++ b/tools/sof-dump-status.py @@ -100,7 +100,7 @@ def _loadACard(self): card_info['id'] = output[idx].strip().split(' ')[0] card_info['short'] = output[idx].split(' - ')[-1].strip() card_info['type']=output[idx].strip().split()[1][1:] - card_info['desc']=output[idx + 1].strip() + card_info['longname']=output[idx + 1].strip() card_info['codec']=[] card_info['pcm']=[] self.proc_card[card_info['id']] = card_info @@ -204,7 +204,7 @@ def dump_proc_sound(proc_card): print("Card ID:\t\t" + card_info['id']) print("\tType:\t\t" + card_info['type']) print("\tShort name:\t" + card_info['short']) - print("\tDesc:\t\t" + card_info['desc']) + print("\tLong name:\t\t" + card_info['longname']) if len(card_info['codec']) == 0: print("\tCodec:\t\tNOCODEC") else: @@ -298,6 +298,7 @@ def _covertType(type_lst): parser.add_argument('-w', '--power', action='store_true', help='just dump power status value') parser.add_argument('-i', '--id', type=int, help='just dump the pcm infomation of target id sound card') parser.add_argument('-s', '--short', type=int, help='just dump the short name of target id sound card') + parser.add_argument('-l', '--longname', type=int, help='just dump the longname name of target id sound card') parser.add_argument('--version', action='version', version='%(prog)s 1.0') ret_args = vars(parser.parse_args()) @@ -331,6 +332,14 @@ def _covertType(type_lst): print(card_info['short']) exit(0) + if ret_args.get('longname') is not None: + sysinfo.loadProcSound() + card_info = sysinfo.proc_card.get(str(ret_args['longname'])) + if card_info is None: + exit(0) + print(card_info['longname']) + exit(0) + sysinfo.loadDMI() sysinfo.loadPCI() sysinfo.loadProcSound()