summaryrefslogtreecommitdiff
path: root/gusb/gusb-device-list.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-09-06 13:55:38 +0200
committerHans de Goede <hdegoede@redhat.com>2011-09-06 14:08:28 +0200
commit6a73aae262d98b7a2e99f03efe40f968abe5a35e (patch)
treec26da3d1c64075d78861e38ffdfbfe58bc15778d /gusb/gusb-device-list.c
parent4819d1362b550d88afcbdb1bd35704c34bf619ef (diff)
downloadgusb-6a73aae262d98b7a2e99f03efe40f968abe5a35e.tar.gz
gusb-device: drop g_usb_device_get_descriptor
We are using the contents of the descriptor in various log / GError messages, so just make sure we have it from the start. We can do this since on windows and Mac OS X libusb_get_device_descriptor never fails, and on Linux it will only fail if the device was unplugged since enumerating, in which case a g_warning will be printed. Since we create the GUsbDevice on a udev event, the chances of it being unplugged again already are very very small. And in case it is, we will simply end up with all 0's in the device descriptor, returning 0x0000 for vid/pid just like before. In the future this means we will also return 0 for the number of available configs, which is a problem for apps who actually want to try to do something with descriptors, but given that this only happens on unplugged devices it is once more not a real issue since any (to be implemented) g_usb_device_get_config_descriptor would fail on an unplugged device anyways. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'gusb/gusb-device-list.c')
-rw-r--r--gusb/gusb-device-list.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/gusb/gusb-device-list.c b/gusb/gusb-device-list.c
index e432986..ea03a95 100644
--- a/gusb/gusb-device-list.c
+++ b/gusb/gusb-device-list.c
@@ -449,16 +449,11 @@ g_usb_device_list_find_by_vid_pid (GUsbDeviceList *list,
{
GUsbDeviceListPrivate *priv = list->priv;
GUsbDevice *device = NULL;
- gboolean ret;
guint i;
for (i = 0; i < priv->devices->len; i++) {
GUsbDevice *curr = g_ptr_array_index (priv->devices, i);
- /* get descriptor details */
- ret = g_usb_device_get_descriptor (curr, error);
- if (!ret)
- goto out;
if (g_usb_device_get_vid (curr) == vid &&
g_usb_device_get_pid (curr) == pid) {
device = g_object_ref (curr);