Re: [PATCH v2] config_tools: format vitio input in configurator

Junjie Mao

Kunhui-Li <> writes:

This patch formats virtio input entry as "Device name: xxx, Device physical path: xxx".

use XPATH instead of the specific python code to parse virtio input data.

Tracked-On: #6691
Signed-off-by: Kunhui-Li <>
misc/config_tools/configurator/pyodide/ | 6 +++++-
misc/config_tools/schema/VMtypes.xsd | 4 +++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/misc/config_tools/configurator/pyodide/ b/misc/config_tools/configurator/pyodide/
index 48bb02715..dc44ad7fe 100644
--- a/misc/config_tools/configurator/pyodide/
+++ b/misc/config_tools/configurator/pyodide/
@@ -2,6 +2,7 @@
__package__ = 'configurator.pyodide'

import json
+import logging
from copy import deepcopy

import elementpath
@@ -42,7 +43,10 @@ def get_dynamic_scenario(board):
# get enum data
enum = function(source, selector, obj_type)
if sorted_func:
- enum = sorted(enum, key=eval(sorted_func))
+ try:
+ enum = sorted(enum, key=eval(sorted_func))
+ except IndexError as e:
+ logging.warning(e)
Recommend to get rid of this because the logging module is not
initialized in pyodide for now.

return enum

def dynamic_enum_apply(obj):
diff --git a/misc/config_tools/schema/VMtypes.xsd b/misc/config_tools/schema/VMtypes.xsd
index 302e152b6..d7b1985e2 100644
--- a/misc/config_tools/schema/VMtypes.xsd
+++ b/misc/config_tools/schema/VMtypes.xsd
@@ -395,7 +395,9 @@ device file when user config it as virtio serial port, which can be read and wri
<xs:complexType name="VirtioInputConfiguration">
<xs:element name="backend_device_file" type="xs:string" minOccurs="0">
- <xs:annotation acrn:title="Backend device file" acrn:widget-options="'placeholder': '/dev/input/eventX'">
+ <xs:annotation acrn:title="Backend device file" acrn:widget-options="'placeholder': '/dev/input/eventX'"
+ acrn:options="for $input in //inputs/input return concat('Device name: ', $input/name/text(), ', Device physical path: ', $input/phys/text())"
+ acrn:options-sorted-by="lambda s: (s.split('Device name: ')[1].split(', Device physical path')[0], s.split('Device physical path: ')[1])">
How is this sorting function different from sorting by `s` itself?

Best Regards
Junjie Mao

<xs:documentation>Specifying backend device in service vm with device description.</xs:documentation>

Join { to automatically receive all group messages.