Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
This is similar to the application side callback introduced by
a88e197 "usbredirhost: new callback to drop isoc packets", only that
packages are now dropped when usbredirparser owns and queues the
outgoing data.
Resolves: https://gitlab.freedesktop.org/spice/usbredir/-/issues/19
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
Application should not be able to set this callback if data queue is
on the library's side.
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
While "#pragma once" is not part of the C or C++ standards, it is a construct
supported "by the vast majority of modern compilers"[1]. The previously used
include guards starting with two underscores were also in violation of the
relevant standards: identifiers starting with a double underscore ("__") are
reserved for the implementation[2].
[1] https://en.cppreference.com/w/cpp/preprocessor/impl#.23pragma_once
[2] https://eel.is/c++draft/lex.name#3.1
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
|
|
This mainly address MacOS issues using visibility.
The .map files we use serve both at limiting symbols and provide
symbol versioning.
However to limit symbols using MacOS linker some different files
need to be prepared and arguments to linker must be different.
Using visibility is more supported by both Meson and multiple
systems (Linux due to gcc or clang, MacOS due to clang, Windows).
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
|
|
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
|
|
Meson build was added for 0.9.0 release where we deprecated
autotools. Now that release is done, let's maintain only meson.
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
All includes of usbredir-related headers use the form
`#include "usbredirparser.h"`, i.e. not relative to the root directory. As
a consequence builds would fail to find files if they weren't installed in
a global include directory:
```
../usbredirhost/usbredirhost.h:25:10: fatal error: usbredirparser.h: No such file or directory
```
Adding "." to the include paths avoids this issue.
Signed-off-by: Michael Hanselmann <public@hansmi.ch>
|
|
Fix incorrect usbredir parser library dependency in generated by meson
libusbredirhost.pc file.
Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
|
|
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
Address the following error:
> usbredirhost.c: In function 'usbredirhost_can_write_iso_package':
> usbredirhost.c:1043:19: error: unknown conversion type character 'l' in format [-Werror=format=]
> 1043 | DEBUG("START dropping isoc packets %" PRIu64 " buffer > %" PRIu64 " hi threshold",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> usbredirhost.c:186:57: note: in definition of macro 'DEBUG'
I've cherry-picked Frediano's patch in the #11 issue bellow.
Fixes: https://gitlab.freedesktop.org/spice/usbredir/-/issues/11
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
The opposite is already true. You can build with autotools on a
tarball made with meson dist.
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
As an alternative to autotools. Simple time comparison between
configure+build time:
11.569s ./autogen.sh && make
1.642s meson . _build && ninja -C _build
Note that from cflags defined in autotools, only -fstack-protector was
removed for the windows build, otherwise we get few of the following:
> /usbredir/winbuild/../usbredirparser/usbredirfilter.c:274: undefined reference to `__stack_chk_fail'
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
Renamed removing the README as it is already in the docs folder.
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
Prior to this, usbredir user could provide usbredirparser_debug_data
as log level but that has no direct mapping to libusb log levels.
libusb_set_option() would return LIBUSB_ERROR_INVALID_PARAM. That was
unnoticed till previous commit.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
|
|
Otherwise, we don't get the logs in case of bad input or any other
underlying issue.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
|
|
In case calloc() in usbredirparser_create() fails, we should be
closing libusb_device_handle* as we own it (similar is done after
earlier in same function after calloc for usbredirhost*).
Note that usbredirhost_close() will not work as host->handle is not
set yet.
Signed-off-by: Victor Toso <victortoso@redhat.com>
|
|
Since libusb-1.0.22, libusb_set_debug is deprecated and replaced with
libusb_set_option.
Details:
https://github.com/libusb/libusb/commit/539f22e2fd916558d11ab9a66f10f461c5593168
Compiling error:
usbredirhost.c: In function ‘usbredirhost_open_full’:
usbredirhost.c:753:5: error: ‘libusb_set_debug’ is deprecated: Use
libusb_set_option instead [-Werror=deprecated-declarations]
libusb_set_debug(host->ctx, host->verbose);
^~~~~~~~~~~~~~~~
Signed-off-by: Han Han <hhan@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
When usbredirhost clears the current device, it resets the device and
attempts to re-attach the kernel driver for the device. The current
device is cleared when the API user explicitly sets a new device with
usbredirhost_set_device(). However, some API users call
usbredirhost_set_device(..., NULL) to clear the current device when the
redirected device has been unplugged. In this scenario, resetting the
device will fail and print a warning to the terminal. Since this is an
expected scenario, we should simply handle it rather than printing an
warning.
Resolves: rhbz#1442963
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
|
|
ERROR() is a wrapper for va_log() which takes usbredirhost* as first
argument. We can't use it if host == NULL. Changing to fprintf to not
fail the function silently.
This was catched by coverity:
3. usbredir-0.7.1/usbredirhost/usbredirhost.c:1412: var_deref_model:
Passing null pointer "host" to "va_log", which dereferences it.
4. usbredir-0.7.1/usbredirhost/usbredirhost.c:163:5: deref_parm:
Directly dereferencing parameter "host".
# 161| int n;
# 162|
# 163|-> if (level > host->verbose) {
# 164| return;
# 165| }
Acked-by: Pavel Grunt <pgrunt@redhat.com>
|
|
Pointed by coverity:
17. usbredir-0.7.1/usbredirhost/usbredirhost.c:2306: leaked_storage:
Returning without freeing "data" leaks the storage that it points to.
# 2304|
# usbredirhost_bulk_packet_complete(transfer->transfer);
# 2305| }
# 2306|-> }
# 2307|
# 2308| static void usbredirhost_iso_packet(void *priv, uint64_t
# id,
Acked-by: Pavel Grunt <pgrunt@redhat.com>
|
|
|
|
Use "PRIu64" macro for printf-ing uint64_t variables, avoiding warnings
like:
usbredirhost.c: In function 'usbredirhost_can_write_iso_package':
usbredirhost.c:1023:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold",
^
usbredirhost.c:181:57: note: in definition of macro 'DEBUG'
#define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__)
^
usbredirhost.c:1023:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold",
^
usbredirhost.c:181:57: note: in definition of macro 'DEBUG'
#define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__)
^
usbredirhost.c:1028:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold",
^
usbredirhost.c:181:57: note: in definition of macro 'DEBUG'
#define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__)
^
usbredirhost.c:1028:19: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold",
^
usbredirhost.c:181:57: note: in definition of macro 'DEBUG'
#define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__)
^
usbredirhost.c: In function 'usbredirhost_set_iso_threshold':
usbredirhost.c:1162:11: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes",
^
usbredirhost.c:181:57: note: in definition of macro 'DEBUG'
#define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__)
^
usbredirhost.c:1162:11: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes",
^
usbredirhost.c:181:57: note: in definition of macro 'DEBUG'
#define DEBUG(...) va_log(host, usbredirparser_debug, __VA_ARGS__)
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
|
|
For streaming devices it might be necessary from application to drop
data for different reasons. This patch provides a new callback that it
is called before queueing the most recent isoc packet.
usbredirhost uses the device information to set two levels of threshold.
In case application's buffer size is higher then the higher threshold we
will drop enough isoc packets to be able to provide a complete video
frame again.
The calculation aims at 10fps as worst case. The higher threshold is set
to 180ms and the lower threshold to 30ms which would give us at least
150ms of continuous data.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1264156
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
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>
|