Date: Sun, 16 Nov 2008 11:55:19 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 153028 for review Message-ID: <200811161155.mAGBtJ2u025253@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=153028 Change 153028 by hselasky@hselasky_laptop001 on 2008/11/16 11:54:26 Fix problem with dfu-util and libusb. Affected files ... .. //depot/projects/usb/src/lib/libusb20/libusb20_compat01.c#8 edit Differences ... ==== //depot/projects/usb/src/lib/libusb20/libusb20_compat01.c#8 (text+ko) ==== @@ -821,36 +821,28 @@ struct libusb20_device *pdev; struct usb_device *udev; struct LIBUSB20_DEVICE_DESC_DECODED *ddesc; - struct libusb20_backend *pold; int err; /* cleanup after last device search */ + /* close all opened devices, if any */ - pold = usb_backend; - - pdev = NULL; - while ((pdev = libusb20_be_device_foreach(pold, pdev))) { - if (!pdev->is_opened) { - /* - * if the device has not been opened we free the - * device data - */ - udev = pdev->priv01Data; - libusb20_be_dequeue_device(pold, pdev); - libusb20_dev_free(pdev); - if (udev != NULL) { - LIST_DEL(usb_global_bus.devices, udev); - free(udev); - } - pdev = NULL; /* restart search */ + while ((pdev = libusb20_be_device_foreach(usb_backend, NULL))) { + udev = pdev->priv01Data; + libusb20_be_dequeue_device(usb_backend, pdev); + libusb20_dev_free(pdev); + if (udev != NULL) { + LIST_DEL(usb_global_bus.devices, udev); + free(udev); } } + /* free old USB backend, if any */ + + libusb20_be_free(usb_backend); + /* do a new backend device search */ - usb_backend = libusb20_be_alloc_default(); if (usb_backend == NULL) { - usb_backend = pold; /* restore */ return (-1); } /* iterate all devices */ @@ -904,17 +896,6 @@ LIST_ADD(usb_global_bus.devices, udev); } - /* move old devices over to the new USB backend */ - - while ((pdev = libusb20_be_device_foreach(pold, pdev))) { - libusb20_be_dequeue_device(pold, pdev); - libusb20_be_enqueue_device(usb_backend, pdev); - } - - /* free old backend, if any */ - - libusb20_be_free(pold); - return (0); /* success */ }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811161155.mAGBtJ2u025253>