From 2eed1cf179de63256d0ce28d949316d8e50e2e98 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 Jan 2016 21:54:49 +0530 Subject: [PATCH] ... --- src/calibre/devices/winusb.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/winusb.py b/src/calibre/devices/winusb.py index c1d011f280..7669595a35 100644 --- a/src/calibre/devices/winusb.py +++ b/src/calibre/devices/winusb.py @@ -936,9 +936,11 @@ def develop(do_eject=False): # {{{ for drive in rd: eject_drive(drive) -def drives_for(vendor_id, product_id): - for usbdev in iterusbdevices(): - if usbdev.vendor_id == vendor_id and usbdev.product_id == product_id: +def drives_for(vendor_id, product_id=None): + usb_devices = scan_usb_devices() + pprint(usb_devices) + for usbdev in usb_devices: + if usbdev.vendor_id == vendor_id and (product_id is None or usbdev.product_id == product_id): print('Drives for: {}'.format(usbdev)) pprint(get_drive_letters_for_device(usbdev, debug=True)) print('USB info:', get_usb_info(usbdev, debug=True))