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.