misc: configurator: Config usb mediator devices in dropdown list

Support detecting connected usb devices in board_inspector and list them
in the usb mediator configuration menu.

Tracked-On: #7424
Signed-off-by: Calvin Zhang <calvinzhang.cool@gmail.com>
This commit is contained in:
Calvin Zhang
2022-05-06 15:19:15 +08:00
committed by acrnsi-robot
parent 2d66ba4d40
commit e36b615fe1
4 changed files with 49 additions and 11 deletions

View File

@@ -267,8 +267,9 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id
script.add_virtual_device("uart", options="vuart_idx:{idx}")
# Mediated PCI devices, including virtio
for usb_xhci in eval_xpath_all(vm_scenario_etree, ".//usb_xhci[text() != '']/text()"):
script.add_virtual_device("xhci", options=usb_xhci)
for usb_xhci in eval_xpath_all(vm_scenario_etree, ".//usb_xhci/usb_dev[text() != '']/text()"):
bus_port = usb_xhci.split(' ')[0]
script.add_virtual_device("xhci", options=bus_port)
for virtio_input_etree in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/input"):
backend_device_file = eval_xpath(virtio_input_etree, "./backend_device_file[text() != '']/text()")