[libvirt] [PATCH 06/10] libxl: add tablet/mouse input device support

Marek Marczykowski-Górecki marmarek at invisiblethingslab.com
Fri Feb 20 01:42:59 UTC 2015


On Wed, Feb 18, 2015 at 08:22:12PM -0700, Jim Fehlig wrote:
> Marek Marczykowski-Górecki wrote:
> > Signed-off-by: Marek Marczykowski-Górecki <marmarek at invisiblethingslab.com>
> > ---
> > Changes in v2:
> >  - rebase on 1.2.12+
> >  - multiple devices support
> >
> >  src/libxl/libxl_conf.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> >
> > diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> > index 4730585..b1131ea 100644
> > --- a/src/libxl/libxl_conf.c
> > +++ b/src/libxl/libxl_conf.c
> > @@ -815,6 +815,54 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
> >              }
> >          }
> >  
> > +        if (def->ninputs) {
> > +#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++) {
> > +                if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_USB) {
> > +                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> > +                            _("libxenlight supports only USB input"));
> > +                    return -1;
> > +                }
> > +            }
> >   
> > +            for (i = 0; i < def->ninputs; i++) {
> > +                switch (def->inputs[i]->type) {
> > +                    case VIR_DOMAIN_INPUT_TYPE_MOUSE:
> > +#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
> > +                        if (VIR_STRDUP(b_info->u.hvm.usbdevice_list[i], "mouse") < 0)
> > +                            return -1;
> > +#else
> > +                        VIR_FREE(b_info->u.hvm.usbdevice);
> > +                        if (VIR_STRDUP(b_info->u.hvm.usbdevice, "mouse") < 0)
> > +                            return -1;
> > +#endif
> > +                        break;
> > +                    case VIR_DOMAIN_INPUT_TYPE_TABLET:
> > +#ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
> > +                        if (VIR_STRDUP(b_info->u.hvm.usbdevice_list[i], "tablet") < 0)
> > +                            return -1;
> > +#else
> > +                        VIR_FREE(b_info->u.hvm.usbdevice);
> > +                        if (VIR_STRDUP(b_info->u.hvm.usbdevice, "tablet") < 0)
> > +                            return -1;
> > +#endif
> >   
> 
> One of the #ifdef could be dropped with something like
> 
> for (i=0; i < def->ninputs; i++) {
>     char *temp;
> #ifdef LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
>     temp = b_info->u.hvm.usbdevice_list[i];
> #else
>     temp = b_info->u.hvm.usbdevice;
> #endif
>     ...
>     VIR_STRDUP(temp, "mouse");
>     ...
> }

I'll send v3 in a moment...

> Also, could you look into adding support for usbdevice_list to the
> parsing/formating code in src/xenconfig?

...together with additional patches for this.

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150220/4be35f58/attachment-0001.sig>


More information about the libvir-list mailing list