[Spice-devel] [spice-gtk 07/13] usb-redir: discard cold-plug device list under Windows
Christophe Fergeau
cfergeau at redhat.com
Tue Mar 12 13:53:40 UTC 2019
On Sun, Mar 10, 2019 at 04:46:06PM +0200, Yuri Benditovich wrote:
Maybe the shortlog would be clearer as
"usb-redir: remove SpiceUsbDeviceManager::coldplug_list"
> Discard the optimization of initial device enumeration.
> Just after connection to 'udev' signal request to report
"... to the 'uevent' signal, request to report ..."
> all the devices one by one as if they are inserted.
> Further commits will remove device enumeration in
> usb-dev-manager completely.
>
> Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
> ---
> src/usb-device-manager.c | 19 +++----------------
> src/win-usb-dev.c | 11 +++++++----
> src/win-usb-dev.h | 2 +-
> 3 files changed, 11 insertions(+), 21 deletions(-)
>
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index 5cf7ebb..f7b43f0 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -104,7 +104,6 @@ struct _SpiceUsbDeviceManagerPrivate {
> int redirect_on_connect_rules_count;
> #ifdef G_OS_WIN32
> GUdevClient *udev;
> - libusb_device **coldplug_list; /* Avoid needless reprobing during init */
> #else
> gboolean redirecting; /* Handled by GUdevClient in the gudev case */
> libusb_hotplug_callback_handle hp_handle;
> @@ -307,15 +306,7 @@ static gboolean spice_usb_device_manager_initable_init(GInitable *initable,
> g_signal_connect(G_OBJECT(priv->udev), "uevent",
> G_CALLBACK(spice_usb_device_manager_uevent_cb), self);
> /* Do coldplug (detection of already connected devices) */
> - libusb_get_device_list(priv->context, &priv->coldplug_list);
> - list = g_udev_client_query_by_subsystem(priv->udev, "usb");
> - for (it = g_list_first(list); it; it = g_list_next(it)) {
> - spice_usb_device_manager_add_udev(self, it->data);
> - g_object_unref(it->data);
> - }
> - g_list_free(list);
> - libusb_free_device_list(priv->coldplug_list, 1);
> - priv->coldplug_list = NULL;
> + g_udev_client_report_devices(priv->udev);
I think I would have gone with 'coldplug' or 'signal' instead of
'report" but that really is nitpicking
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190312/f45cfa08/attachment.sig>
More information about the Spice-devel
mailing list