
KR> +static int parse_input_device(xmlNode *node, struct virt_device **vdevs) KR> +{ KR> + struct virt_device *vdev = NULL; KR> + struct input_device *idev = NULL; KR> + char *id; KR> + int ret; KR> + KR> + vdev = calloc(1, sizeof(*vdev)); KR> + if (vdev == NULL) KR> + goto err; KR> + KR> + idev = &(vdev->dev.input); KR> + KR> + idev->type = get_attr_value(node, "type"); KR> + idev->bus = get_attr_value(node, "bus"); KR> + KR> + if ((idev->type == NULL) || (idev->bus == NULL)) KR> + goto err; KR> + KR> + vdev->type = CIM_RES_TYPE_INPUT; KR> + KR> + ret = asprintf(&id, "%s:%s", idev->type, idev->bus); KR> + if (ret == -1) { KR> + CU_DEBUG("Failed to create input id string"); KR> + free(id); KR> + goto err; KR> + } KR> + KR> + vdev->id = strdup(id); KR> + free(id); Just asprintf() into vdev->id instead of using the intermediate variable and two allocations. KR> +static int input_set_attr(CMPIInstance *instance, KR> + struct input_device *dev) KR> +{ KR> + uint16_t cim_type; KR> + KR> + if (STREQC(dev->type, "mouse")) KR> + cim_type = CIM_INPUT_MOUSE; KR> + else KR> + cim_type = CIM_INPUT_UNKNOWN; Does CIM not have a tablet device? If not, I think we can expose the tablet devices as mice as well. IIRC, virt-manager gives most domains a PS2 and USB tablet pointer device. The PS2 device is for compatibility and boot, and the tablet provides an absolute-movement pointer for more seamless host-to-guest cursor movement. I think it's worth exposing both. What do you think? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com