mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-21 21:26:06 +01:00
Converted libiMobileDevice errors to negative numbers to match error reporting.
This commit is contained in:
parent
cacc347a32
commit
9112b32b5e
2 changed files with 21 additions and 5 deletions
|
|
@ -703,7 +703,7 @@ def _afc_error(self, error):
|
|||
(str) describing error
|
||||
|
||||
'''
|
||||
e = "UNKNOWN ERROR (%s)" % error
|
||||
e = "UNKNOWN ERROR (%d)" % error
|
||||
if not error:
|
||||
e = "Success (0)"
|
||||
elif error == 2:
|
||||
|
|
@ -1080,6 +1080,7 @@ def _house_arrest_client_free(self):
|
|||
|
||||
error = self.lib.house_arrest_client_free(byref(self.house_arrest)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
if self.verbose:
|
||||
self.log(" ERROR: %s" % self._house_arrest_error(error))
|
||||
|
||||
|
|
@ -1106,6 +1107,7 @@ def _house_arrest_client_new(self):
|
|||
self.lockdown,
|
||||
byref(house_arrest_client_t)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1124,7 +1126,7 @@ def _house_arrest_client_new(self):
|
|||
return house_arrest_client_t.contents
|
||||
|
||||
def _house_arrest_error(self, error):
|
||||
e = "UNKNOWN ERROR"
|
||||
e = "UNKNOWN ERROR (%d)" % error
|
||||
if not error:
|
||||
e = "Success (0)"
|
||||
elif error == -1:
|
||||
|
|
@ -1217,6 +1219,7 @@ def _house_arrest_send_command(self, command=None, appid=None):
|
|||
_command,
|
||||
_appid) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1258,6 +1261,7 @@ def _idevice_free(self):
|
|||
error = self.lib.idevice_free(byref(self.device)) & 0xFFFF
|
||||
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
if self.verbose:
|
||||
self.log(" ERROR: %s" % self._idevice_error(error))
|
||||
|
||||
|
|
@ -1278,6 +1282,7 @@ def _idevice_get_device_list(self):
|
|||
device_list = []
|
||||
error = self.lib.idevice_get_device_list(byref(devices), byref(count)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
if error == -3:
|
||||
if self.verbose:
|
||||
self.log(" no connected devices")
|
||||
|
|
@ -1315,6 +1320,7 @@ def _idevice_new(self):
|
|||
c_void_p()) & 0xFFFF
|
||||
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1354,6 +1360,7 @@ def _instproxy_browse(self, applist=[]):
|
|||
byref(apps)) & 0xFFFF
|
||||
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1412,6 +1419,7 @@ def _instproxy_client_new(self):
|
|||
self.lockdown,
|
||||
byref(instproxy_client_t)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1427,6 +1435,7 @@ def _instproxy_client_free(self):
|
|||
|
||||
error = self.lib.instproxy_client_free(byref(self.instproxy)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1463,7 +1472,7 @@ def _instproxy_error(self, error):
|
|||
'''
|
||||
Return a string version of the error code
|
||||
'''
|
||||
e = "UNKNOWN ERROR"
|
||||
e = "UNKNOWN ERROR (%d)" % error
|
||||
if not error:
|
||||
e = "Success"
|
||||
elif error == -1:
|
||||
|
|
@ -1495,6 +1504,7 @@ def _lockdown_client_free(self):
|
|||
|
||||
error = self.lib.lockdownd_client_free(byref(self.control)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1534,6 +1544,7 @@ def _lockdown_client_new_with_handshake(self):
|
|||
SERVICE_NAME) & 0xFFFF
|
||||
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1543,7 +1554,7 @@ def _lockdown_client_new_with_handshake(self):
|
|||
return lockdownd_client_t.contents
|
||||
|
||||
def _lockdown_error(self, error):
|
||||
e = "UNKNOWN ERROR"
|
||||
e = "UNKNOWN ERROR (%d)" % error
|
||||
if not error:
|
||||
e = "Success"
|
||||
elif error == -1:
|
||||
|
|
@ -1607,6 +1618,7 @@ def _lockdown_get_device_name(self):
|
|||
error = self.lib.lockdownd_get_device_name(byref(self.control),
|
||||
byref(device_name_p)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1725,6 +1737,7 @@ def _lockdown_get_value(self, requested_items=[]):
|
|||
None,
|
||||
byref(preferences)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
@ -1761,6 +1774,7 @@ def _lockdown_goodbye(self):
|
|||
|
||||
if self.control:
|
||||
error = self.lib.lockdownd_goodbye(byref(self.control)) & 0xFFFF
|
||||
error = error - 0x10000
|
||||
if self.verbose:
|
||||
self.log(" ERROR: %s" % self.error_lockdown(error))
|
||||
else:
|
||||
|
|
@ -1791,6 +1805,7 @@ def _lockdown_start_service(self, service_name):
|
|||
SERVICE_NAME,
|
||||
byref(self.lockdown)) & 0xFFFF
|
||||
if error:
|
||||
error = error - 0x10000
|
||||
error_description = self.LIB_ERROR_TEMPLATE.format(
|
||||
cls=self.__class__.__name__,
|
||||
func=sys._getframe().f_code.co_name,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,8 @@ def _end_array(self, name):
|
|||
|
||||
def _end_dict(self, name):
|
||||
if self.__key is not None:
|
||||
raise PropertyListParseError("Missing value for key '%s'" % self.__key)
|
||||
print("XmlPropertyListParser() WARNING: Missing value for key '%s'" % self.__key)
|
||||
#raise PropertyListParseError("Missing value for key '%s'" % self.__key)
|
||||
self._pop_stack()
|
||||
|
||||
def _start_true(self, name, attrs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue