Skip to content

Commit

Permalink
Merge pull request #1211 from doronz88/bugfix/handling-too-many-devic…
Browse files Browse the repository at this point in the history
…e-error

usbmux: fix handling of bad messages (#1208)
  • Loading branch information
doronz88 authored Sep 22, 2024
2 parents f95d12e + b9e5255 commit 65dddbc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pymobiledevice3/usbmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ def get_device_list(self, timeout: float = None) -> None:
""" get device list synchronously without waiting the timeout """
self.devices = []
self._send({'MessageType': 'ListDevices'})
for response in self._receive(self._tag - 1)['DeviceList']:
response = self._receive(self._tag - 1)
device_list = response.get('DeviceList')
if device_list is None:
raise MuxException(f'Got an invalid response from usbmux: {response}')
for response in device_list:
if response['MessageType'] == 'Attached':
super()._add_device(MuxDevice(response['DeviceID'], response['Properties']['SerialNumber'],
response['Properties']['ConnectionType']))
Expand Down

0 comments on commit 65dddbc

Please sign in to comment.