commit usbredir for openSUSE:Factory
Hello community, here is the log from the commit of package usbredir for openSUSE:Factory checked in at 2012-04-23 09:18:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/usbredir (Old) and /work/SRC/openSUSE:Factory/.usbredir.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "usbredir", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/usbredir/usbredir.changes 2012-03-09 21:29:06.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.usbredir.new/usbredir.changes 2012-04-23 09:18:56.000000000 +0200 @@ -1,0 +2,11 @@ +Fri Apr 20 09:41:31 UTC 2012 - joop.boonen@opensuse.org + +- Update to version 0.4.3: + + usbredirhost: + - Don't crash on devices in unconfigured state + - Restore original device configuration when releasing the device + - Significantly speed up reset handling + + usbredirserver: + -Add a manpage + +------------------------------------------------------------------- Old: ---- usbredir-0.4.2.tar.bz2 New: ---- usbredir-0.4.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ usbredir.spec ++++++ --- /var/tmp/diff_new_pack.I4fKdN/_old 2012-04-23 09:18:57.000000000 +0200 +++ /var/tmp/diff_new_pack.I4fKdN/_new 2012-04-23 09:18:57.000000000 +0200 @@ -17,10 +17,9 @@ # - Name: usbredir -Version: 0.4.2 -Release: 0 +Version: 0.4.3 +Release: 0.0 Summary: A protocol for redirection USB traffic License: GPL-2.0+ ; LGPL-2.1+ Group: System/Libraries @@ -90,6 +89,7 @@ %files %defattr(-,root,root) %doc ChangeLog README COPYING +%{_mandir}/man1/usbredirserver.1.gz %{_sbindir}/usbredirserver %files -n libusbredirhost1 ++++++ usbredir-0.4.2.tar.bz2 -> usbredir-0.4.3.tar.bz2 ++++++ ++++ 3190 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/usbredir-0.4.2/ChangeLog new/usbredir-0.4.3/ChangeLog --- old/usbredir-0.4.2/ChangeLog 2012-03-06 15:42:20.000000000 +0100 +++ new/usbredir-0.4.3/ChangeLog 2012-04-02 11:43:34.000000000 +0200 @@ -1,3 +1,12 @@ +usbredir-0.4.3 2 April 2012 +--------------------------- +-usbredirhost: + -Don't crash on devices in unconfigured state + -Restore original device configuration when releasing the device + -Significantly speed up reset handling +-usbredirserver: + -Add a manpage + usbredir-0.4.2 6 March 2012 --------------------------- -Add usb_redir_babble status code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/usbredir-0.4.2/configure.ac new/usbredir-0.4.3/configure.ac --- old/usbredir-0.4.2/configure.ac 2012-03-06 15:42:20.000000000 +0100 +++ new/usbredir-0.4.3/configure.ac 2012-04-02 11:43:34.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ(2.63) -AC_INIT([usbredir], [0.4.2]) +AC_INIT([usbredir], [0.4.3]) AC_CONFIG_SRCDIR([configure.ac]) AM_CONFIG_HEADER([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/usbredir-0.4.2/missing new/usbredir-0.4.3/missing --- old/usbredir-0.4.2/missing 2012-03-06 15:53:52.000000000 +0100 +++ new/usbredir-0.4.3/missing 2012-04-02 11:43:59.000000000 +0200 @@ -1,10 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2009-04-28.21; # UTC +scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 Free Software Foundation, Inc. +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -84,7 +84,6 @@ help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and @@ -122,15 +121,6 @@ # Not GNU programs, they don't have --version. ;; - tar*) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. @@ -226,7 +216,7 @@ \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` @@ -256,7 +246,7 @@ \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then - eval LASTARG="\${$#}" + eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` @@ -318,41 +308,6 @@ touch $file ;; - tar*) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/usbredir-0.4.2/usbredirhost/usbredirhost.c new/usbredir-0.4.3/usbredirhost/usbredirhost.c --- old/usbredir-0.4.2/usbredirhost/usbredirhost.c 2012-03-06 15:42:20.000000000 +0100 +++ new/usbredir-0.4.3/usbredirhost/usbredirhost.c 2012-03-31 16:52:31.000000000 +0200 @@ -110,8 +110,9 @@ libusb_device_handle *handle; struct libusb_device_descriptor desc; struct libusb_config_descriptor *config; - int active_config; + int restore_config; int claimed; + int reset; int disconnected; int read_status; int cancels_pending; @@ -307,10 +308,12 @@ int i; const struct libusb_interface_descriptor *intf_desc; struct usb_redir_ep_info_header ep_info; - struct usb_redir_interface_info_header interface_info; + struct usb_redir_interface_info_header interface_info = { 0, }; - interface_info.interface_count = host->config->bNumInterfaces; - for (i = 0; i < host->config->bNumInterfaces; i++) { + if (host->config) + interface_info.interface_count = host->config->bNumInterfaces; + + for (i = 0; i < interface_info.interface_count; i++) { intf_desc = &host->config->interface[i].altsetting[host->alt_setting[i]]; @@ -370,7 +373,7 @@ usbredirhost_send_interface_n_ep_info(host); usbredirparser_send_device_connect(host->parser, &device_connect); host->connect_pending = 0; - host->disconnected = 0; /* The guest know may use the device */ + host->disconnected = 0; /* The guest may now use the device */ FLUSH(host); } @@ -418,13 +421,13 @@ host->endpoint[i].max_packetsize = 0; } - for (i = 0; i < host->config->bNumInterfaces; i++) { + for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { usbredirhost_parse_interface(host, i); } } /* Called from open/close and parser read callbacks */ -static int usbredirhost_claim(struct usbredirhost *host) +static int usbredirhost_claim(struct usbredirhost *host, int initial_claim) { int i, n, r; @@ -433,49 +436,62 @@ host->config = NULL; } - r = libusb_get_configuration(host->handle, &host->active_config); - if (r < 0) { - ERROR("could not get active configuration: %d", r); - return libusb_status_or_error_to_redir_status(host, r); - } - r = libusb_get_device_descriptor(host->dev, &host->desc); if (r < 0) { ERROR("could not get device descriptor: %d", r); return libusb_status_or_error_to_redir_status(host, r); } - r = libusb_get_config_descriptor_by_value(host->dev, host->active_config, - &host->config); - if (r < 0) { - ERROR("could not get descriptors for configuration %d: %d", - host->active_config, r); + r = libusb_get_active_config_descriptor(host->dev, &host->config); + if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND) { + ERROR("could not get descriptors for active configuration: %d", r); return libusb_status_or_error_to_redir_status(host, r); } - if (host->config->bNumInterfaces > MAX_INTERFACES) { + if (host->config && host->config->bNumInterfaces > MAX_INTERFACES) { ERROR("usb decriptor has too much intefaces (%d > %d)", (int)host->config->bNumInterfaces, MAX_INTERFACES); return usb_redir_ioerror; } - /* All interfaces begin alt setting 0 when (re)claimed */ + if (initial_claim) { + if (host->config) + host->restore_config = host->config->bConfigurationValue; + else + host->restore_config = -1; /* unconfigured */ + + /* If the device is unconfigured and has only 1 config, we assume + this is the result of the user doing "safely remove hardware", + and we try to reset the device configuration to this config when + we release the device, so that it becomes usable again. */ + if (host->restore_config == -1 && host->desc.bNumConfigurations == 1) { + struct libusb_config_descriptor *config; + + r = libusb_get_config_descriptor(host->dev, 0, &config); + if (r == 0) { + host->restore_config = config->bConfigurationValue; + libusb_free_config_descriptor(config); + } + } + } + + /* All interfaces begin at alt setting 0 when (re)claimed */ memset(host->alt_setting, 0, MAX_INTERFACES); host->claimed = 1; - for (i = 0; i < host->config->bNumInterfaces; i++) { + for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { n = host->config->interface[i].altsetting[0].bInterfaceNumber; r = libusb_detach_kernel_driver(host->handle, n); if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND) { ERROR("could not detach driver from interface %d (configuration %d): %d", - n, host->active_config, r); + n, host->config->bConfigurationValue, r); return libusb_status_or_error_to_redir_status(host, r); } r = libusb_claim_interface(host->handle, n); if (r < 0) { ERROR("could not claim interface %d (configuration %d): %d", - n, host->active_config, r); + n, host->config->bConfigurationValue, r); return libusb_status_or_error_to_redir_status(host, r); } } @@ -487,37 +503,48 @@ /* Called from open/close and parser read callbacks */ static void usbredirhost_release(struct usbredirhost *host, int attach_drivers) { - int i, n, r; + int i, n, r, current_config = -1; if (!host->claimed) return; - for (i = 0; i < host->config->bNumInterfaces; i++) { + for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { n = host->config->interface[i].altsetting[0].bInterfaceNumber; r = libusb_release_interface(host->handle, n); if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND && r != LIBUSB_ERROR_NO_DEVICE) { ERROR("could not release interface %d (configuration %d): %d", - n, host->active_config, r); + n, host->config->bConfigurationValue, r); } } if (!attach_drivers) return; - for (i = 0; i < host->config->bNumInterfaces; i++) { + host->claimed = 0; + + if (host->config) + current_config = host->config->bConfigurationValue; + + if (current_config != host->restore_config) { + r = libusb_set_configuration(host->handle, host->restore_config); + if (r < 0) + ERROR("could not restore configuration to %d: %d", + host->restore_config, r); + return; /* set_config automatically binds drivers for the new config */ + } + + for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { n = host->config->interface[i].altsetting[0].bInterfaceNumber; r = libusb_attach_kernel_driver(host->handle, n); if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND /* No driver */ && r != LIBUSB_ERROR_NO_DEVICE /* Device unplugged */ && r != LIBUSB_ERROR_BUSY /* driver rebound already */) { ERROR("could not re-attach driver to interface %d (configuration %d): %d", - n, host->active_config, r); + n, host->config->bConfigurationValue, r); } } - - host->claimed = 0; } struct usbredirhost *usbredirhost_open( @@ -655,7 +682,7 @@ int usbredirhost_set_device(struct usbredirhost *host, libusb_device_handle *usb_dev_handle) { - int status; + int r, status; usbredirhost_clear_device(host); @@ -665,12 +692,21 @@ host->dev = libusb_get_device(usb_dev_handle); host->handle = usb_dev_handle; - status = usbredirhost_claim(host); + status = usbredirhost_claim(host, 1); if (status != usb_redir_success) { usbredirhost_clear_device(host); return status; } + /* The first thing almost any usb-guest does is a (slow) device-reset + so lets do that before hand */ + r = libusb_reset_device(host->handle); + if (r != 0) { + usbredirhost_clear_device(host); + return libusb_status_or_error_to_redir_status(host, r); + } + host->reset = 1; + usbredirhost_send_device_connect(host); return usb_redir_success; @@ -826,7 +862,7 @@ return wait; } -/* Called from close and parser read callbacks */ +/* Only called from read callbacks */ static void usbredirhost_cancel_pending_urbs_on_interface( struct usbredirhost *host, int i) { @@ -864,7 +900,7 @@ { int i, n; - for (i = 0; i < host->config->bNumInterfaces; i++) { + for (i = 0; host->config && i < host->config->bNumInterfaces; i++) { n = host->config->interface[i].altsetting[0].bInterfaceNumber; if (n == bInterfaceNumber) { return i; @@ -1379,14 +1415,13 @@ struct usbredirhost *host = priv; int r; - if (host->disconnected) { + if (host->disconnected || host->reset) { return; } r = libusb_reset_device(host->handle); if (r == 0) { - /* Some devices need some time to settle before firing more cmds */ - usleep(100000); + host->reset = 1; } else { ERROR("resetting device: %d", r); usbredirhost_clear_device(host); @@ -1408,10 +1443,13 @@ goto exit; } - if (set_config->configuration == host->active_config) { + if (host->config && + host->config->bConfigurationValue == set_config->configuration) { goto exit; } + host->reset = 0; + usbredirhost_cancel_pending_urbs(host); usbredirhost_release(host, 0); @@ -1422,7 +1460,7 @@ status.status = usb_redir_ioerror; } - claim_status = usbredirhost_claim(host); + claim_status = usbredirhost_claim(host, 0); if (claim_status != usb_redir_success) { usbredirhost_clear_device(host); host->read_status = usbredirhost_read_device_lost; @@ -1433,7 +1471,7 @@ usbredirhost_send_interface_n_ep_info(host); exit: - status.configuration = host->active_config; + status.configuration = host->config ? host->config->bConfigurationValue:0; usbredirparser_send_configuration_status(host->parser, id, &status); FLUSH(host); } @@ -1447,7 +1485,7 @@ status.status = usb_redir_ioerror; else status.status = usb_redir_success; - status.configuration = host->active_config; + status.configuration = host->config ? host->config->bConfigurationValue:0; usbredirparser_send_configuration_status(host->parser, id, &status); FLUSH(host); } @@ -1475,6 +1513,8 @@ goto exit_unknown_interface; } + host->reset = 0; + usbredirhost_cancel_pending_urbs_on_interface(host, i); r = libusb_set_interface_alt_setting(host->handle, @@ -1565,6 +1605,8 @@ goto leave; } + host->reset = 0; + /* For input endpoints submit the transfers now */ if (start_iso_stream->endpoint & LIBUSB_ENDPOINT_IN) { for (i = 0; i < host->endpoint[EP2I(ep)].iso_transfer_count; i++) { @@ -1629,6 +1671,9 @@ status = usb_redir_stall; goto leave; } + + host->reset = 0; + status = usbredirhost_submit_interrupt_in_transfer(host, ep); leave: UNLOCK(host); @@ -1816,6 +1861,8 @@ return; } + host->reset = 0; + /* If it is a clear stall, we need to do an actual clear stall, rather then just forward the control packet, so that the usbhost usbstack knows the stall is cleared */ @@ -1960,6 +2007,8 @@ return; } + host->reset = 0; + libusb_fill_bulk_transfer(transfer->transfer, host->handle, ep, data, bulk_packet->length, usbredirhost_bulk_packet_complete, @@ -2145,6 +2194,8 @@ return; } + host->reset = 0; + libusb_fill_interrupt_transfer(transfer->transfer, host->handle, ep, data, data_len, usbredirhost_interrupt_packet_complete, transfer, INTERRUPT_TIMEOUT); @@ -2176,7 +2227,7 @@ { int i, r, num_interfaces; struct libusb_device_descriptor dev_desc; - struct libusb_config_descriptor *config; + struct libusb_config_descriptor *config = NULL; uint8_t interface_class[MAX_INTERFACES]; uint8_t interface_subclass[MAX_INTERFACES]; uint8_t interface_protocol[MAX_INTERFACES]; @@ -2189,11 +2240,19 @@ } r = libusb_get_active_config_descriptor(dev, &config); - if (r < 0) { + if (r < 0 && r != LIBUSB_ERROR_NOT_FOUND) { if (r == LIBUSB_ERROR_NO_MEM) return -ENOMEM; return -EIO; } + if (config == NULL) { + return usbredirfilter_check(rules, rules_count, dev_desc.bDeviceClass, + dev_desc.bDeviceSubClass, dev_desc.bDeviceProtocol, + NULL, NULL, NULL, 0, + dev_desc.idVendor, dev_desc.idProduct, + dev_desc.bcdDevice, flags); + } + num_interfaces = config->bNumInterfaces; for (i = 0; i < num_interfaces; i++) { const struct libusb_interface_descriptor *intf_desc = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/usbredir-0.4.2/usbredirserver/Makefile.am new/usbredir-0.4.3/usbredirserver/Makefile.am --- old/usbredir-0.4.2/usbredirserver/Makefile.am 2011-11-25 18:14:57.000000000 +0100 +++ new/usbredir-0.4.3/usbredirserver/Makefile.am 2012-04-02 11:43:34.000000000 +0200 @@ -6,3 +6,5 @@ usbredirserver_CFLAGS = $(LIBUSB_CFLAGS) \ -I$(top_srcdir)/usbredirhost \ -I$(top_srcdir)/usbredirparser + +dist_man_MANS = usbredirserver.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/usbredir-0.4.2/usbredirserver/usbredirserver.1 new/usbredir-0.4.3/usbredirserver/usbredirserver.1 --- old/usbredir-0.4.2/usbredirserver/usbredirserver.1 1970-01-01 01:00:00.000000000 +0100 +++ new/usbredir-0.4.3/usbredirserver/usbredirserver.1 2012-04-02 11:28:07.000000000 +0200 @@ -0,0 +1,38 @@ +.TH USBREDIRSERVER "1" "April 2012" "usbredirserver 0.4.3" "User Commands" +.SH NAME +usbredirserver \- manual page for usbredirserver 0.4.3 +.SH SYNOPSIS +.B usbredirserver +[\fI-p|--port <port>\fR] [\fI-v|--verbose <0-5>\fR] \fI<usbbus-usbaddr|vendorid:prodid>\fR +.SH DESCRIPTION +usbredirserver is a small standalone server for exporting an USB device for +use from another (virtual) machine through the usbredir protocol. +.PP +You can specify the USB device to export either by USB id in the form of +\fI<vendorid>:<prodid>\fR, or by USB bus number and device address in the form +of \fI<usbbus>-<usbaddr>\fR. +.PP +Notice that an instance of usbredirserver can only be used to export a +single USB device. If you want to export multiple devices you can start +multiple instances listening on different TCP ports. +.SH OPTIONS +.TP +\fB\-p\fR, \fB\-\-port\fR=\fIPORT\fR +Set the TCP port to listen on to \fIPORT\fR +.TP +\fB\-v\fR, \fB\-\-verbose\fR=\fIVERBOSE\fR +Set usbredirserver's verbosity level to \fIVERBOSE\fR, this mostly affects USB +redirection related messages. Valid values are 0-5: +.br +0:Silent 1:Errors 2:Warnings 3:Info 4:Debug 5:Debug++ +.SH AUTHOR +Written by Hans de Goede <hdegoede@redhat.com> +.SH REPORTING BUGS +Report bugs to the spice-devel mailinglist: +http://lists.freedesktop.org/mailman/listinfo/spice-devel +.SH COPYRIGHT +Copyright 2010-2012 Red Hat, Inc. +License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>. +.br +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de