Re: [PATCH usbredir] usbredirserver: show bus:device of the chosen USB device if specifying vid:pid

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

 



>
> From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> 
> We use libusb_open_device_with_vid_pid.
> If multiple devices have the same vid:pid,
> it will only return the first one.
> 
> This patch will show the bus:device of the chosen one.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxx>
> ---
>  usbredirserver/usbredirserver.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/usbredirserver/usbredirserver.c
> b/usbredirserver/usbredirserver.c
> index 13965dc..e69e2d0 100644
> --- a/usbredirserver/usbredirserver.c
> +++ b/usbredirserver/usbredirserver.c
> @@ -321,6 +321,7 @@ int main(int argc, char *argv[])
>  
>          /* Try to find the specified usb device */
>          if (usbvendor != -1) {
> +            libusb_device *dev;
>              handle = libusb_open_device_with_vid_pid(ctx, usbvendor,
>                                                       usbproduct);
>              if (!handle) {
> @@ -328,6 +329,12 @@ int main(int argc, char *argv[])
>                      "Could not open an usb-device with vid:pid %04x:%04x\n",
>                      usbvendor, usbproduct);
>              }
> +            dev = libusb_get_device(handle);
> +            fprintf(stderr, "Open a usb-device with vid:pid %04x:%04x on "
> +                    "bus %03x device %03x\n",
> +                    usbvendor, usbproduct,
> +                    libusb_get_bus_number(dev),
> +                    libusb_get_device_address(dev));
>          } else {
>              libusb_device **list = NULL;
>              ssize_t i, n;

The actual code write on stderr for errors and logs.
Looks like this is a sort of log that should be affected by the verbose parameter.
I would say this should be printed as info (see
http://libusb.sourceforge.net/api-1.0/group__lib.html#ga2d6144203f0fc6d373677f6e2e89d2d2).
Please note I'm not a expert usbredir user.

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]