Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
This is necessary to be able to properly init a parser for unserialization.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This way the caller can differentiate between a deny caused by a
matching rule, and one caused by there being no matching rules.
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>
|
|
Note this commit only adds support for 64 bit packet ids to the wire
protocol and parser, the libusbredirparser API still needs to be updated
to actually deal with 64 bit ids at the API level.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Rename usb_redir_ep_info_header_no_max_pktsz_version to
usb_redir_ep_info_header_no_max_pktsz.
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>
|
|
As indicated in the ChangeLog I'm aiming to do a new release on Sept 3th :)
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>
|
|
Even when skipping over bad packets, this is needed for state serialization
support.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
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>
|
|
I could not find an imlpementation of strtok_r in mingw.
It seems strtok_s requires an additional package to be installed on the
usb-host machine.
This patch adds the glibc implementation of strtok_r to be used on windows.
|
|
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]
|
|
Their build fails, so skip them.
Things to fix to make the them work on Win32 include sockets, signals, threads
and more.
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
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>
|
|
Instead of rejecting (when trying to open) or crashing (when the device
was set to unconfigured state from the guest), properly handle unconfigured
devices.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This new field is only send / received if both sides have the (new)
usb_redir_cap_ep_info_max_packet_size capability.
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>
|
|
Before this patch we were reporting unused endpoints as having a
type of control rather then invalid after a set_interface on interface 0.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Failure to reset a device means that we've lost the device, report this
to the user by returning usbredirhost_read_device_lost from the
usbredirhost_read_guest_data call which triggered the reset.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
An usbredirhost_claim failure always gets followed by a
usbredirhost_clear_device call, so there is no need to cleanup / undo
claiming of interfaces in the error path.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
No callers are interested in the return value, so lets just make it void.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
If we fail to change the config we still need to re-claim the device, otherwise
we loose access to it.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
So cleanup on failure to re-claim after a set_config, and let our user know
that we've lost the device with a new usbredirhost_read_device_lost status.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
So that the same mechanism can be used to return other errors too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Changing the configuration of a device causes the drivers to get
re-attached by the kernel, so we need to detach them after a set_config
too. Since we then always detach the drivers we can drop the detach_drivers
argument to usbredirhost_claim().
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
The set_config code path releases the interface without re-attaching the
kernel drivers. If after this the actual set_config call or the re-claim
failed the claimed flag would be 0, resulting in device cleanup not
re-attaching the kernel drivers.
So this patch keeps the claimed flag set to 1 when usbredirhost_release
only releases the interfaces without re-attaching the kernel drivers, to
ensure that they are properly re-attached on any later cleanup.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|