From 8fadf723885a16e20e74f75c74eb4b0cda689cf1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 Mar 2017 20:35:25 +0530 Subject: [PATCH] More graceful report for unnamed MTP devices --- src/calibre/devices/mtp/unix/driver.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/mtp/unix/driver.py b/src/calibre/devices/mtp/unix/driver.py index 02e7955973..7f65905c77 100644 --- a/src/calibre/devices/mtp/unix/driver.py +++ b/src/calibre/devices/mtp/unix/driver.py @@ -228,13 +228,14 @@ class MTP_DEVICE(MTPDeviceBase): # the user to allow access. Apparently what happens is # that when the user clicks allow, the device disconnects # and re-connects as a new device. - raise OpenActionNeeded(self.dev.friendly_name, _( + name = self.dev.friendly_name or connected_device.manufacturer or _('Unnamed device') + raise OpenActionNeeded(name, _( 'The device {0} is not allowing connections.' ' Unlock the screen on the {0}, tap "Allow" on any connection popup message you see,' ' then either wait a minute or restart calibre. You might' ' also have to change the mode of the USB connection on the {0}' ' to "Media Transfer mode (MTP)" or similar.' - ).format(self.dev.friendly_name), (self.dev.friendly_name, self.dev.serial_number)) + ).format(name), (name, self.dev.serial_number)) raise storage = [x for x in storage if x.get('rw', False)]