Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1115917
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
The transfer->foo_packet union members are also used on cancellation, and
completion and cancellation may race, so they should not be accessed without
holding the lock.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
The guest should have cancelled any pending urbs already, but the cancellations
have not necessary completed when we receive a reset.
If we then continue with the reset pending urbs may complete with an error code
of LIBUSB_TRANSFER_NO_DEVICE, causing us to see a device disconnect.
We also need to cleanly shutdown any streams and let the guest know they
should be restarted after the reset.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
If this is 1 then the guest will be send stream_status packets with
a status of usb_redir_stall for any stopped streams.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Coverity does not like uint8_t * int being casted to an uint64_t, change
the int to an unsigned int to make it happy.
Note that the int in question can never be > 255, so this is not a real issue.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
And populate it with 1210:001c
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Send the error status in the places where the error actually happens,
rather then passing an error return code all the way up, and then check
+ send the error status at the higher level.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
And name the input version usbredirhost_buffered_packet_complete in preparation
for also using it for handling of buffered bulk-in endpoints.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
To ensure we don't loose any date when we suffer some latency in completion
processing.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
1) Any stream failure which causes the stream to stop, should return
usb_redir_stall, push this logic into the actual functions causing the
failure, rather then letting the callers translate the error code.
2) Rename usbredirhost_alloc_stream to usbredirhost_alloc_stream_unlocked,
add a new usbredirhost_alloc_stream() which does the locking on behalf of
the caller.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Now that the iso functions have been changed into generic buffered stream
functions group them together in their own block, rather then grouping them
with other iso functions. No functional changes, just moving code around.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Mostly just variable/function renaming, and some small changes
to usbredir_alloc_iso_stream to allow extending it to also allocate other
type of streams (interrupt, bulk).
This is a preparation patch for using multiple transfers per endpoint
for interrupt receiving as well as for adding buffered bulk input support.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
The usbredir 0.5 release introduced the new API for 64 bit packet ids, but
it kept the libusbredirparser.pc name as is, meaning that older versions of
qemu will still have their pkg-config check for usbredirparser fulfilled,
and build with the usb-redir device. Due to the API change there will be
some compiler warnings, but the build will succeed, however the usb-redir
device will be broken on 32 bit machines.
To solve this, this patch renames the libusbredirparser.pc file to
libusbredirparser-0.5.pc, so that it will no longer fulfill the pkg-config
check of the qemu-1.2 and older releases, stopping the (silent) breakage.
A patch has been send to qemu-devel to adjusts qemu master's configure.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
If the write queue gets too large our network connection likely is not keeping
up. The best (and only) thing we can do then is drop isoc input packages,
these are also the likely cause of this, since all other transfer types more
or less auto-adjust to the network speed (rhbz#855737).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Instead of only returning 0 or 1, this can be used for flowcontrol purposes.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
-ABI and API breakage !!
-Bump libusbredirparser soname version
-Change version to 0.5 so that libusbredirparser users can test for the new API
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
With the upcoming qemu changes (for live migration), once a packet has been
cancelled its id may be reused for another packet immediately afterward,
the usb-guest will then expect to first get the reply to the cancelled packet,
and then to the new packet with the same id. But the actual cancellation can
finish later then the new packet.
To avoid this, this patch moves the sending back of the cancelled packet to
the usb-guest to immediately after receiving the cancel, rather then waiting
for the usb-host OS to mark the packet as completed or cancelled.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Make log messages prefix constant, rather then dependent on the log level
so that it can be easily removed by the higher levels if desired, even
when translated.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
After upstream review of the libusb patch for returning ERROR_BUSY from
libusb_detach_kernel_driver if the uswbfs driver is already bound, the
behavior has been changed to instead return ERROR_NOT_FOUND. This means that
the userfriendly device is busy error test is now done in the wrong place.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Bulk packets can be (ab)used as interrupt transfers without timing guarantees,
iow you can submit a bulk in transfer and let it be submitted until the
device has data to reports a few eons later.
This is used by (some?) USB cdc-acm devices (modems, smartcard readers, gps
devices), specifically a smartcard reader I've been debugging, which currently
does not work.
Not setting a timeout at the usb-host side fixes these devices. For devices
where timeouts do make sense, the timeouts should be handled by the usb-guest,
which has device specific knowledge we lack.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
On Windows libusb_(attach|detach)_kernel_driver are not supported.
A libusb driver is already installed (device was successfully opened).
In that case just continue as if operation was successful.
|
|
In libusb.h the following definition appears:
typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer);
Added LIBUSB_CALL to the following functions:
usbredirhost_iso_packet_complete
usbredirhost_interrupt_packet_complete
usbredirhost_control_packet_complete
usbredirhost_bulk_packet_complete
This fixes the following compiler warning for Windows (mingw):
./usbredirhost/usbredirhost.c: In function 'usbredirhost_alloc_iso_stream':
./usbredir/usbredirhost/usbredirhost.c:1206:13: warning: passing argument 7 of 'libusb_fill_iso_transfer' from incompatible pointer type [enabled by default]
|
|
On Windows (mingw), ERROR is already defined (to 0)
This fixes the following compiler warning:
warning: "ERROR" redefined [enabled by default]
|
|
In some cases a usb-guest does multiple resets in a row, these are instant
from the guest pov but they are synchronously handled by us. So if a usb-guest
does 4 resets in a row (seabios does this) then we can accumulate quite a
bit of latency, sometimes so much that guests cancel a submitted transfer
because they think it has timed out while we simply have not gotten around
to handling it.
This patch fixes this issue by speeding up resets in a number of ways:
1) Keep track of a reset state, if the device was reset and no requests
were send to it since, this is true. In this case further resets are
treated as a no-op.
2) Since the first thing most guests do is a reset, do one as soon as we
open the device.
3) Remove the sleep we had in our reset code, as it is not necessary,
actually the kernel already fires multiple commands to the device
before the libusb_reset_device call returns...
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|