Thanks. I get it now. 2012/7/29 Hans de Goede <hdego...@redhat.com>
> Hi, > > > On 07/25/2012 03:36 PM, flooding Controlled wrote: > >> Hi: >> I am puzzled by some functions calling in the function : >> "spice_usb_device_manager_**initable_init" >> >> At this block: >> /* 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"); >> ... >> ... >> libusb_free_device_list(priv->**coldplug_list, 1); >> priv->coldplug_list = NULL; >> >> My questions are as follows: >> 1. Well, it seems that there are two routines to gather information of >> the already connected devices : >> "libusb_get_device_list" and " g_udev_client_query_by_**subsystem " , >> which is the really for wok one ? >> "g_udev_client_query_by_**subsystem" seems to be , am I right ? >> > > g_udev gives us a list of USB devices present in the system, and not much > more then that, where as we > use libusb for low level device access, so we manage usb devices through a > list of libusb_device references, > the only reason we're also using gusb is because it gives us dynamic > notification when device get plugged > in / removed. > > > >> 2. So, the second question is, why we gather info to >> "priv->coldplug_list", as the codes above, it just be freed, and has never >> been used! >> > > That is not true, the coldplug_list gets used in > spice_usb_device_manager_add_**dev to not have to > call libusb_get_device_list repeatedly when enumerating devices already > plugged in on spice-gtk > startup. > > Regards, > > Hans >
_______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel