[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4 of 4 v2] xl: Accept a list for usbdevice in config file



On Fri, 2012-11-30 at 16:24 +0000, George Dunlap wrote:
> # HG changeset patch
> # User George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> # Date 1354291988 0
> # Node ID 043d69be04c91eaead159e8e74999c59eb68f560
> # Parent  af47b01d2dbe0e916e1014a264845c48d6ef8108
> xl: Accept a list for usbdevice in config file
> 
> Allow the "usbdevice" key to accept a list of USB devices, and pass
> them in using the new usbdevice_list domain build element.
> 
> For backwards compatibility, still accept singleton values.
> 
> Also update the xl.cfg manpage, adding information about how to pass
> through host devices.
> 
> v2:
>  - Add some verbiage to make it clear that "usb" is for emulated devices
>  - Reference qemu manual for more usbdevice options
> 
> Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

> 
> diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
> --- a/docs/man/xl.cfg.pod.5
> +++ b/docs/man/xl.cfg.pod.5
> @@ -1107,17 +1107,27 @@ device.
>  
>  =item B<usb=BOOLEAN>
>  
> -Enables or disables a USB bus in the guest.
> +Enables or disables an emulated USB bus in the guest.
>  
> -=item B<usbdevice=DEVICE>
> +=item B<usbdevice=[ "DEVICE", "DEVICE", ...]>
>  
> -Adds B<DEVICE> to the USB bus. The USB bus must also be enabled using
> -B<usb=1>. The most common use for this option is B<usbdevice=tablet>
> -which adds pointer device using absolute coordinates. Such devices
> -function better than relative coordinate devices (such as a standard
> -mouse) since many methods of exporting guest graphics (such as VNC)
> -work better in this mode. Note that this is independent of the actual
> -pointer device you are using on the host/client side.
> +Adds B<DEVICE>s to the emulated USB bus. The USB bus must also be
> +enabled using B<usb=1>. The most common use for this option is
> +B<usbdevice=['tablet']> which adds pointer device using absolute
> +coordinates. Such devices function better than relative coordinate
> +devices (such as a standard mouse) since many methods of exporting
> +guest graphics (such as VNC) work better in this mode. Note that this
> +is independent of the actual pointer device you are using on the
> +host/client side.
> +
> +Host devices can also be passed through in this way, by specifying
> +host:USBID, where USBID is of the form xxxx:yyyy.  The USBID can 
> +typically be found by using lsusb or usb-devices.
> +
> +The form usbdevice=DEVICE is also accepted for backwards compatibility.
> +
> +More valid options can be found in the "usbdevice" section of the qemu
> +documentation.
>  
>  =back
>  
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -1486,8 +1486,23 @@ skip_vfb:
>          xlu_cfg_replace_string (config, "serial", &b_info->u.hvm.serial, 0);
>          xlu_cfg_replace_string (config, "boot", &b_info->u.hvm.boot, 0);
>          xlu_cfg_get_defbool(config, "usb", &b_info->u.hvm.usb, 0);
> -        xlu_cfg_replace_string (config, "usbdevice",
> -                                &b_info->u.hvm.usbdevice, 0);
> +        switch (xlu_cfg_get_list_as_string_list(config, "usbdevice",
> +                                                
> &b_info->u.hvm.usbdevice_list,
> +                                                1))
> +        {
> +
> +        case 0: break; /* Success */
> +        case ESRCH: break; /* Option not present */
> +        case EINVAL:
> +            /* If it's not a valid list, try reading it as an atom, falling 
> through to
> +             * an error if it fails */
> +            if (!xlu_cfg_replace_string(config, "usbdevice", 
> &b_info->u.hvm.usbdevice, 0)) 
> +                break;
> +            /* FALLTHRU */
> +        default:
> +            fprintf(stderr,"xl: Unable to parse usbdevice.\n");
> +            exit(-ERROR_FAIL);
> +        }
>          xlu_cfg_replace_string (config, "soundhw", &b_info->u.hvm.soundhw, 
> 0);
>          xlu_cfg_get_defbool(config, "xen_platform_pci",
>                              &b_info->u.hvm.xen_platform_pci, 0);
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.