diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index cf8eee706c..929c7b9ba0 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -212,11 +212,8 @@ class ITUNES(DriverBase): "for instructions on using 'Connect to iTunes'") ITUNES_SANDBOX_LOCKOUT_MESSAGE = _( '
Unable to communicate with iTunes.
' - "As of iTunes version 10.6.3, application 'sandboxing' " - 'was implemented by Apple, disabling inter-application communications ' - 'between iTunes and third-party applications.
' - 'Refer to the forum post ' - 'Apple implements sandboxing for iTunes 10.6.3 ' + '
Refer to this ' + 'forum post ' 'for more information.
' '') @@ -232,8 +229,9 @@ class ITUNES(DriverBase): # 0x12a0 iPhone 4S # 0x12a2 iPad2 (GSM) # 0x12a3 iPad2 (CDMA) + # 0x12a6 iPad3 (GSM) VENDOR_ID = [0x05ac] - PRODUCT_ID = [0x1292,0x1293,0x1294,0x1297,0x1299,0x129a,0x129f,0x12a2,0x12a3] + PRODUCT_ID = [0x1292,0x1293,0x1294,0x1297,0x1299,0x129a,0x129f,0x12a2,0x12a3,0x12a6] BCD = [0x01] # Plugboard ID @@ -2362,6 +2360,8 @@ class ITUNES(DriverBase): if isosx: import appscript + as_name = appscript.__name__ + as_version = appscript.__version__ ''' Launch iTunes if not already running ''' @@ -2371,7 +2371,7 @@ class ITUNES(DriverBase): if DEBUG: logger().info( "ITUNES:_launch_iTunes(): Launching iTunes" ) try: - self.iTunes = iTunes= appscript.app('iTunes', hide=True) + self.iTunes = iTunes = appscript.app('iTunes', hide=True) except: self.iTunes = None raise UserFeedback(' ITUNES._launch_iTunes(): unable to find installed iTunes', details=None, level=UserFeedback.WARN) @@ -2383,19 +2383,26 @@ class ITUNES(DriverBase): self.initial_status = 'already running' ''' - Test OSA. If we can't get the app name, we can't talk to iTunes. - As of iTunes 10.6.3 (June 2012), sandboxing was implemented disabling OSA - interapp communications. + Test OSA communication with iTunes. If unable to communicate with iTunes, set self.iTunes to None, then report to user in open() ''' + as_binding = "dynamic" try: + # Try dynamic binding - works with iTunes <= 10.6.1 foo = self.iTunes.name() except: - self.iTunes = None - if DEBUG: - logger().info(" unable to communicate with iTunes, raising dialog to user") - return + # Try static binding + import itunes + self.iTunes = appscript.app('iTunes',terms=itunes) + try: + foo = self.iTunes.name() + as_binding = "static" + except: + self.iTunes = None + if DEBUG: + logger().info(" unable to communicate with iTunes via %s %s using any binding" % (as_name, as_version)) + return ''' # Read the current storage path for iTunes media @@ -2415,6 +2422,7 @@ class ITUNES(DriverBase): logger().info(" [OSX %s - %s (%s), driver version %d.%d.%d]" % (self.iTunes.name(), self.iTunes.version(), self.initial_status, self.version[0],self.version[1],self.version[2])) + logger().info(" communicating with iTunes via %s %s using %s binding" % (as_name, as_version, as_binding)) logger().info(" calibre_library_path: %s" % self.calibre_library_path) if iswindows: