
Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com> --- libxkutil/device_parsing.c | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index c4e4ef7..15f9d99 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -1306,14 +1306,39 @@ static int parse_input_device(xmlNode *node, struct virt_device **vdevs) struct input_device *idev = NULL; int ret; + CU_DEBUG("Enter parse_input_device()."); + vdev = calloc(1, sizeof(*vdev)); - if (vdev == NULL) + if (vdev == NULL) { + CU_DEBUG("calloc failed."); goto err; + } idev = &(vdev->dev.input); - idev->type = get_attr_value(node, "type"); - idev->bus = get_attr_value(node, "bus"); + idev->others = parse_data_to_others(node, BAD_CAST "devices"); + + if (idev->others == NULL) { + CU_DEBUG("parse data to others failed."); + goto err; + } + + /* fetch out <input> tag from others. It will be removed + * after others management finished. */ + fetch_from_others(&idev->others, + "input", + TYPE_NODE, + "devices"); + + idev->type = fetch_from_others(&idev->others, + "type", + TYPE_PROP, + (char *)node->name); + + idev->bus = fetch_from_others(&idev->others, + "bus", + TYPE_PROP, + (char *)node->name); if ((idev->type == NULL) || (idev->bus == NULL)) goto err; -- 1.7.1