diff --git a/src/calibre/devices/usbms/driver.py b/src/calibre/devices/usbms/driver.py index e568bd2587..89531ec057 100644 --- a/src/calibre/devices/usbms/driver.py +++ b/src/calibre/devices/usbms/driver.py @@ -94,11 +94,29 @@ class USBMS(CLI, Device): self.report_progress(1.0, _('Get device information...')) self.driveinfo = {} if self._main_prefix is not None: - self.driveinfo['main'] = self._update_driveinfo_file(self._main_prefix, 'main') - if self._card_a_prefix is not None: - self.driveinfo['A'] = self._update_driveinfo_file(self._card_a_prefix, 'A') - if self._card_b_prefix is not None: - self.driveinfo['B'] = self._update_driveinfo_file(self._card_b_prefix, 'B') + try: + self.driveinfo['main'] = self._update_driveinfo_file(self._main_prefix, 'main') + except (IOError, OSError) as e: + raise IOError(_('Failed to access files in the main memory of' + ' your device. You should contact the device' + ' manufacturer for support. Common fixes are:' + ' try a different USB cable/USB port on your computer.' + ' If you device has a "Reset to factory defaults" type' + ' of setting somewhere, use it. Underlying error: %s') + % e) + try: + if self._card_a_prefix is not None: + self.driveinfo['A'] = self._update_driveinfo_file(self._card_a_prefix, 'A') + if self._card_b_prefix is not None: + self.driveinfo['B'] = self._update_driveinfo_file(self._card_b_prefix, 'B') + except (IOError, OSError) as e: + raise IOError(_('Failed to access files on the SD card in your' + ' device. This can happen for many reasons. The SD card may be' + ' corrupted, it may be too large for your device, it may be' + ' write-protected, etc. Try a different SD card, or reformat' + ' your SD card using the FAT32 filesystem. Also make sure' + ' there are not too many files in the root of your SD card.' + ' Underlying error: %s') % e) return (self.get_gui_name(), '', '', '', self.driveinfo) def set_driveinfo_name(self, location_code, name):