Each spice widget can now restrict the area of the primary
surface they show and interact with by setting the private
area member.
A nice clean-up would be to seperate an area object that
would deal with clipping, input translation and color
conversion, but the resulting code would be similar anyway
For Windows client, when connecting a device to the guest, if a libusb
device (libdev) does not exist, cleanup and forget about that device.
Most likely, the device was plugged out at driver installation
time, and its remove-device event was ignored.
The motion count must stay synchronized with the server, otherwise,
it is possible that we will stop sending motion events to the server
after migration.
rhbz#835997
If a device that is asked to be shared with the guest, is unplugged out
of the machine before being redirected, then let the user know that
usbredir of that device failed (and cleanup nicely).
For Windows client, the time between request and redir is larger, as
it includes the time it takes to install the libusb driver.
vendor_count is the last access index, the actually count is +1.
On Windows, it crashes later on because of corrupted memory.
Thanks to valgrind for this precious help:
==4535== Invalid write of size 2
==4535== at 0x40197E: spice_usbutil_parse_usbids (usbutil.c:170)
==4535== by 0x401CEC: spice_usbutil_load_usbids (usbutil.c:241)
==4535== by 0x4020C6: main (usbutil.c:322)
==4535== Address 0x56b740c is 12 bytes after a block of size 348,160 alloc'd
==4535== at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==4535== by 0x4EAAEBE: g_malloc (gmem.c:159)
==4535== by 0x401847: spice_usbutil_parse_usbids (usbutil.c:156)
==4535== by 0x401CEC: spice_usbutil_load_usbids (usbutil.c:241)
==4535== by 0x4020C6: main (usbutil.c:322)
==4535==
Simplify a little bit the portability by looking up usb.ids file
under g_get_system_data_dirs(). This is how most resources are
found under other OS, looking up files under various places, since
installation location may vary.
This fixes the following compilation error message (without USE_USBREDIR):
usb-device-manager.c:183:13: error: 'spice_usb_device_manager_drv_install_cb' declared 'static' but never defined [-Werror=unused-function]
This fixes the following compilation error message:
../../gtk/win-usb-driver-install.c: In function 'spice_win_usb_driver_send_request':
../../gtk/win-usb-driver-install.c:187:5: error: missing braces around initializer [-Werror=missing-braces]
../../gtk/win-usb-driver-install.c:187:5: error: (near initialization for 'req.hdr') [-Werror=missing-braces]
- Added win-usb-driver-install.[ch]
- Added win-usb-clerk.h
Operation (on Windows, spice-gtk point of view):
- After some sanity checks, just before redir'ing a USB device
a libusb driver needs to be installed (before libusb can open the device)
- A connection (NamedPipe) is established with usb-clerk, a libusb
driver installation service, and a request for driver installation
is sent.
- Installation status is asynchronously read from the pipe, and
spice_usb_drv_install_finished() is called.
- Upon a successful intallation, usbredir continues.
Linux operation is not changed.
Note that this change may affect performance a bit, as sometimes there is
a need to find the libusb_device or the SpiceUsbDevice. Likely it's negligible.
For Windows, it's better not to keep references for libusb_devices
that are not used.
So instead of makeing SpiceUsbDevice a box for a libusb_device
it is going to be a box for a SpiceUsbDeviceInfo.
In preparation for a different SpiceUsbDevice.
With the new SpiceUsbDeviceInfo, <vid,pid> will be provided by
SpiceUsbDevice, and not by the device_descriptor (from libusb)
Currently SpiceUsbDevice is a BOX for libusb_device.
In preparation for a different SpiceUsbDevice.
Renamed the libusb_device variable to libdev. Needed when
asking usbredir to check the filter.
It seems that ssize_t is int, while DWORD is long
Compiler warning (some whitespaces where added for readability):
../../../gtk/controller/test.c: In function 'read_from_pipe':
../../../gtk/controller/test.c:108:5: warning: passing argument 4 \
of 'ReadFile' from incompatible pointer type [enabled by default]
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:70:0,
from ../../../gtk/controller/test.c:27:
/usr/i686-w64-mingw32/sys-root/mingw/include/winbase.h:1426:29: note: expected \
'LPDWORD' but argument is of type 'ssize_t *'
Windows namedpipes behave a bit differently from Unix socket, and may
return incomplete read/write. By using 2 read/write() helpers, try to
complete the operation before returning. Since the IO operation may be
splitted over several call, we make sure the buffer pointer is on the
heap. We use exception for EOF or BROKEN_PIPE condition, which also
simplifies the code.
To really work with namedpipe, the giowin32streams need to be fixed as
well to handle concurrent read & write properly, see for details:
https://bugzilla.gnome.org/show_bug.cgi?id=679288
printf is redefined by glib/gi18n.h
In file included from ../spice-common/common/spice_common.h:29:0,
from ../spice-common/common/ring.h:23,
from spice-channel-cache.h:23,
from spice-session-priv.h:26,
from desktop-integration.c:29:
../spice-common/common/log.h:49:17: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
../spice-common/common/log.h:56:16: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
In file included from ../spice-common/common/canvas_base.h:25:0,
from decode.h:23,
from spice-session-priv.h:27,
from desktop-integration.c:29:
../spice-common/common/lz.h:22:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
../spice-common/common/lz.h:23:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
../spice-common/common/lz.h:24:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]