diff --git a/misc/acrn-config/launch_config/launch_item.py b/misc/acrn-config/launch_config/launch_item.py index 2c7a25f03..c73cc711a 100644 --- a/misc/acrn-config/launch_config/launch_item.py +++ b/misc/acrn-config/launch_config/launch_item.py @@ -141,6 +141,9 @@ class PthruSelected(): launch_cfg_lib.pt_devs_check(self.bdf["wifi"], self.vpid["wifi"], "wifi") launch_cfg_lib.pt_devs_check(self.bdf["bluetooth"], self.vpid["bluetooth"], "bluetooth") + # check connections between several pass-through devices + launch_cfg_lib.pt_devs_check_audio(self.bdf['audio'], self.bdf['audio_codec']) + class VirtioDeviceSelect(): diff --git a/misc/acrn-config/launch_config/pt.py b/misc/acrn-config/launch_config/pt.py index 44a8c066c..d07e78bea 100644 --- a/misc/acrn-config/launch_config/pt.py +++ b/misc/acrn-config/launch_config/pt.py @@ -192,10 +192,6 @@ def audio_pt(uos_type, sel, vmid, config): print("else", file=config) print(' boot_audio_option="-s {},virtio-audio"'.format(slot_audio), file=config) print("fi", file=config) - elif bdf_codec: - # only selected audio codec, then set error message - key = "audio/audio codec error:" - launch_cfg_lib.ERR_LIST[key] = "Audio codec device should be pass through together with Audio devcie" def media_pt(uos_type, sel, vmid, config): diff --git a/misc/acrn-config/library/launch_cfg_lib.py b/misc/acrn-config/library/launch_cfg_lib.py index 08fb8e2ce..88c545ef6 100644 --- a/misc/acrn-config/library/launch_cfg_lib.py +++ b/misc/acrn-config/library/launch_cfg_lib.py @@ -601,3 +601,19 @@ def get_vuart1_from_scenario(vmid): """Get the vmid's vuart1 base""" vuart1 = common.get_vuart_info_id(SCENARIO_INFO_FILE, 1) return vuart1[vmid]['base'] + + +def pt_devs_check_audio(audio_map, audio_codec_map): + """ + Check the connections about audio/audio_codec pass-through devices + If audio_codec is selected as pass-through device, the audio device + must to be chosen as pass-through device either. + :param audio_map: the dictionary contains vmid and bdf of audio device + :param audio_codec_map: the dictionary contains vmid and bdf of audio_codec device + """ + for vmid in list(audio_map.keys()): + bdf_audio = audio_map[vmid] + bdf_codec = audio_codec_map[vmid] + if not bdf_audio and bdf_codec: + key = "uos:id={},passthrough_devices,{}".format(vmid, 'audio_codec') + ERR_LIST[key] = "Audio codec device should be pass through together with Audio devcie!"