diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 5c7bf5c25b..1708956546 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -248,14 +248,15 @@ class Device(DeviceConfig, DevicePlugin): filtered = set() for dl in dlmap['drive_letters']: pnp_id = dlmap['pnp_id_map'][dl].upper() - if self.windows_filter_pnp_id(pnp_id): + if dl in dlmap['readonly_drives']: + filtered.add(dl) + if debug: + prints('Ignoring the drive %s as it is readonly' % dl) + elif self.windows_filter_pnp_id(pnp_id): filtered.add(dl) if debug: prints('Ignoring the drive %s because of a PNP filter on %s' % (dl, pnp_id)) - dlmap['drive_letters'] = [dl for dl in dlmap['drive_letters'] if dl not in filtered] - filtered = set() - for dl in dlmap['drive_letters']: - if not drive_is_ok(dl, debug=debug): + elif not drive_is_ok(dl, debug=debug): filtered.add(dl) if debug: prints('Ignoring the drive %s because failed to get free space for it' % dl)