Converted libiMobileDevice errors to negative numbers to match error reporting.

This commit is contained in:
GRiker 2013-06-01 16:04:02 -06:00
parent cacc347a32
commit 9112b32b5e
2 changed files with 21 additions and 5 deletions

View File

@ -703,7 +703,7 @@ class libiMobileDevice():
(str) describing error (str) describing error
''' '''
e = "UNKNOWN ERROR (%s)" % error e = "UNKNOWN ERROR (%d)" % error
if not error: if not error:
e = "Success (0)" e = "Success (0)"
elif error == 2: elif error == 2:
@ -1080,6 +1080,7 @@ class libiMobileDevice():
error = self.lib.house_arrest_client_free(byref(self.house_arrest)) & 0xFFFF error = self.lib.house_arrest_client_free(byref(self.house_arrest)) & 0xFFFF
if error: if error:
error = error - 0x10000
if self.verbose: if self.verbose:
self.log(" ERROR: %s" % self._house_arrest_error(error)) self.log(" ERROR: %s" % self._house_arrest_error(error))
@ -1106,6 +1107,7 @@ class libiMobileDevice():
self.lockdown, self.lockdown,
byref(house_arrest_client_t)) & 0xFFFF byref(house_arrest_client_t)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1124,7 +1126,7 @@ class libiMobileDevice():
return house_arrest_client_t.contents return house_arrest_client_t.contents
def _house_arrest_error(self, error): def _house_arrest_error(self, error):
e = "UNKNOWN ERROR" e = "UNKNOWN ERROR (%d)" % error
if not error: if not error:
e = "Success (0)" e = "Success (0)"
elif error == -1: elif error == -1:
@ -1217,6 +1219,7 @@ class libiMobileDevice():
_command, _command,
_appid) & 0xFFFF _appid) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1258,6 +1261,7 @@ class libiMobileDevice():
error = self.lib.idevice_free(byref(self.device)) & 0xFFFF error = self.lib.idevice_free(byref(self.device)) & 0xFFFF
if error: if error:
error = error - 0x10000
if self.verbose: if self.verbose:
self.log(" ERROR: %s" % self._idevice_error(error)) self.log(" ERROR: %s" % self._idevice_error(error))
@ -1278,6 +1282,7 @@ class libiMobileDevice():
device_list = [] device_list = []
error = self.lib.idevice_get_device_list(byref(devices), byref(count)) & 0xFFFF error = self.lib.idevice_get_device_list(byref(devices), byref(count)) & 0xFFFF
if error: if error:
error = error - 0x10000
if error == -3: if error == -3:
if self.verbose: if self.verbose:
self.log(" no connected devices") self.log(" no connected devices")
@ -1315,6 +1320,7 @@ class libiMobileDevice():
c_void_p()) & 0xFFFF c_void_p()) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1354,6 +1360,7 @@ class libiMobileDevice():
byref(apps)) & 0xFFFF byref(apps)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1412,6 +1419,7 @@ class libiMobileDevice():
self.lockdown, self.lockdown,
byref(instproxy_client_t)) & 0xFFFF byref(instproxy_client_t)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1427,6 +1435,7 @@ class libiMobileDevice():
error = self.lib.instproxy_client_free(byref(self.instproxy)) & 0xFFFF error = self.lib.instproxy_client_free(byref(self.instproxy)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1463,7 +1472,7 @@ class libiMobileDevice():
''' '''
Return a string version of the error code Return a string version of the error code
''' '''
e = "UNKNOWN ERROR" e = "UNKNOWN ERROR (%d)" % error
if not error: if not error:
e = "Success" e = "Success"
elif error == -1: elif error == -1:
@ -1495,6 +1504,7 @@ class libiMobileDevice():
error = self.lib.lockdownd_client_free(byref(self.control)) & 0xFFFF error = self.lib.lockdownd_client_free(byref(self.control)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1534,6 +1544,7 @@ class libiMobileDevice():
SERVICE_NAME) & 0xFFFF SERVICE_NAME) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1543,7 +1554,7 @@ class libiMobileDevice():
return lockdownd_client_t.contents return lockdownd_client_t.contents
def _lockdown_error(self, error): def _lockdown_error(self, error):
e = "UNKNOWN ERROR" e = "UNKNOWN ERROR (%d)" % error
if not error: if not error:
e = "Success" e = "Success"
elif error == -1: elif error == -1:
@ -1607,6 +1618,7 @@ class libiMobileDevice():
error = self.lib.lockdownd_get_device_name(byref(self.control), error = self.lib.lockdownd_get_device_name(byref(self.control),
byref(device_name_p)) & 0xFFFF byref(device_name_p)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1725,6 +1737,7 @@ class libiMobileDevice():
None, None,
byref(preferences)) & 0xFFFF byref(preferences)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,
@ -1761,6 +1774,7 @@ class libiMobileDevice():
if self.control: if self.control:
error = self.lib.lockdownd_goodbye(byref(self.control)) & 0xFFFF error = self.lib.lockdownd_goodbye(byref(self.control)) & 0xFFFF
error = error - 0x10000
if self.verbose: if self.verbose:
self.log(" ERROR: %s" % self.error_lockdown(error)) self.log(" ERROR: %s" % self.error_lockdown(error))
else: else:
@ -1791,6 +1805,7 @@ class libiMobileDevice():
SERVICE_NAME, SERVICE_NAME,
byref(self.lockdown)) & 0xFFFF byref(self.lockdown)) & 0xFFFF
if error: if error:
error = error - 0x10000
error_description = self.LIB_ERROR_TEMPLATE.format( error_description = self.LIB_ERROR_TEMPLATE.format(
cls=self.__class__.__name__, cls=self.__class__.__name__,
func=sys._getframe().f_code.co_name, func=sys._getframe().f_code.co_name,

View File

@ -153,7 +153,8 @@ class XmlPropertyListParser(object):
def _end_dict(self, name): def _end_dict(self, name):
if self.__key is not None: 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() self._pop_stack()
def _start_true(self, name, attrs): def _start_true(self, name, attrs):