[libvirt] [PATCH 1/9] libxl: add tablet/mouse input device support

Jim Fehlig jfehlig at suse.com
Fri Mar 13 16:25:15 UTC 2015


Marek Marczykowski-Górecki wrote:
> From: Marek Marczykowski <marmarek at invisiblethingslab.com>
>
> Signed-off-by: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
> ---
>  src/libxl/libxl_conf.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
>
> Changes in v2:
>  - rebase on 1.2.12+
>  - multiple devices support
> Changes in v3:
>  - reduce code duplication
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 2321660..50ef9d8 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -749,6 +749,50 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
>          libxl_defbool_set(&b_info->u.hvm.vnc.enable, 0);
>          libxl_defbool_set(&b_info->u.hvm.sdl.enable, 0);
>  
> +        if (def->ninputs) {
> +            for (i = 0; i < def->ninputs; i++) {
> +                if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB) {
> +                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                            _("libxenlight supports only USB input"));
> +                    return -1;
> +                }
> +            }
> +#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
> +            if (VIR_ALLOC_N(b_info->u.hvm.usbdevice_list, def->ninputs+1) < 0)
> +                return -1;
> +#else
> +            if (def->ninputs > 1) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                        _("libxenlight supports only one input device"));
> +                return -1;
> +            }
> +#endif
> +            for (i = 0; i < def->ninputs; i++) {
> +                char **usbdevice;
> +#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
> +                usbdevice = &b_info->u.hvm.usbdevice_list[i];
> +#else
> +                usbdevice = &b_info->u.hvm.usbdevice;
> +#endif
> +                switch (def->inputs[i]->type) {
> +                    case VIR_DOMAIN_INPUT_TYPE_MOUSE:
> +                        VIR_FREE(*usbdevice);
> +                        if (VIR_STRDUP(*usbdevice, "mouse") < 0)
> +                            return -1;
> +                        break;
> +                    case VIR_DOMAIN_INPUT_TYPE_TABLET:
> +                        VIR_FREE(*usbdevice);
> +                        if (VIR_STRDUP(*usbdevice, "tablet") < 0)
> +                            return -1;
> +                        break;
> +                    default:
> +                        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                                _("Unknown input device type"));
> +                        return -1;
> +                }
> +            }
> +        }
> +
>   

Looks good now; ACK.

Regards,
Jim




More information about the libvir-list mailing list