doronz88 / pymobiledevice3

Pure python3 implementation for working with iDevices (iPhone, etc...).
https://discord.gg/52mZGC3JXJ
GNU General Public License v3.0
1.15k stars 159 forks source link

Apple Vision Pro Support #1094

Open Colonelpanic0 opened 1 week ago

Colonelpanic0 commented 1 week ago

Is your feature request related to a problem? Please describe. When connecting to Apple Vision Pro through a remote session, the device is detected through Bonjour presumably, but throws errors when attempting to connect. I'd like to be able to connect to AVP for device management features.

Describe the solution you'd like Successful connectivity to AVP over wireless.

Describe alternatives you've considered Might be feasible with the developer strap, which provides a wired connection instead.

Additional context Here is the device being picked up after running python3 -m pymobiledevice3 remote pair

Screenshot 2024-06-25 at 7 04 59 PM

Here is the errors after attempting to connect:

INFO Waiting user pairing consent
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/__main__.py", line 176, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/__main__.py", line 100, in main
    cli()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/cli/remote.py", line 240, in cli_pair
    asyncio.run(start_remote_pair_task(name), debug=True)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/cli/remote.py", line 233, in start_remote_pair_task
    await service.connect(autopair=True)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/remote/tunnel_service.py", line 904, in connect
    await RemotePairingProtocol.connect(self, autopair=autopair)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/remote/tunnel_service.py", line 373, in connect
    await self._pair()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/remote/tunnel_service.py", line 494, in _pair
    await self._verify_proof()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymobiledevice3/remote/tunnel_service.py", line 562, in _verify_proof
    assert self.srp_context.verify_proof(data[PairingDataComponentType.PROOF].hex().encode())
                                         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: EnumIntegerString.new(4, 'PROOF')

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

doronz88 commented 1 week ago

Please verify if the same stuff applying to AppleTV may also be applied to Apple VisionPro (simply try adding your own device string there):

https://github.com/doronz88/pymobiledevice3/blob/decc9229b3338aa5c5ece3feedc2a2d38ea0666f/pymobiledevice3/remote/tunnel_service.py#L517-L527

Colonelpanic0 commented 4 days ago

Well, it got a little further this time. Changing the 'AppleTV' string to 'Apple Vision Pro' I get the PIN to appear briefly on the connect attempt on the AVP itself, but it disappears and the script throws an error again.

47] INFO Waiting user pairing consent
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/__main__.py", line 174, in <module>
    main()
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/__main__.py", line 100, in main
    cli()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/cli/remote.py", line 240, in cli_pair
    asyncio.run(start_remote_pair_task(name), debug=True)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/cli/remote.py", line 233, in start_remote_pair_task
    await service.connect(autopair=True)
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/remote/tunnel_service.py", line 904, in connect
    await RemotePairingProtocol.connect(self, autopair=autopair)
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/remote/tunnel_service.py", line 373, in connect
    await self._pair()
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/remote/tunnel_service.py", line 494, in _pair
    await self._verify_proof()
  File "/Users/ric/pymobiledevice3/pymobiledevice3/pymobiledevice3/remote/tunnel_service.py", line 562, in _verify_proof
    assert self.srp_context.verify_proof(data[PairingDataComponentType.PROOF].hex().encode())
                                         ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: EnumIntegerString.new(4, 'PROOF')
doronz88 commented 21 hours ago

Sounds like it's not the same issue as in AppleTV. Can you print the data you are receiving instead of the expected one?