postlund / pyatv

A client library for Apple TV and AirPlay devices
https://pyatv.dev
MIT License
875 stars 95 forks source link

Unable to pair 3rd gen Apple TV via DMAP #1421

Open sergem155 opened 2 years ago

sergem155 commented 2 years ago

Describe the bug

Trying to pair, get "passcode incorrect"

Error log

2021-10-23 15:30:42 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.176
2021-10-23 15:30:42 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.176:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-23 15:30:42 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.176:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': 'D2A34DFAD64E27CB', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-23 15:30:42 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.176:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-23 15:30:42 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 58289
2021-10-23 15:30:42 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=58289, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': '91B5E2C44CD53B01'}, interface_index=None)
2021-10-23 15:30:43 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1234
Use pin 1234 to pair with "pyatv" (press ENTER to stop)
2021-10-23 15:30:58 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 1d79061f48baeab55bd851d7e85b1313
2021-10-23 15:30:58 DEBUG [pyatv.protocols.dmap.pairing]: Got code 1d79061f48baeab55bd851d7e85b1313, expects 2be73ff27acaaa7dcad5f1060d3603e3
2021-10-23 15:30:58 INFO [aiohttp.access]: 192.168.1.176 [23/Oct/2021:22:30:58 +0000] "GET /pair?pairingcode=1D79061F48BAEAB55BD851D7E85B1313&servicename=61FBE455BD6E3BF2 HTTP/1.1" 500 193 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"

How to reproduce the bug?

$ atvremote -s 192.168.1.176 --debug --protocol dmap pair

enter 1234 in Settings -> General -> Remotes -> pyatv

What is expected behavior?

credentials returned

Operating System

Ubuntu 20.04

Python

3.8

pyatv

0.9.5

Device

Apple TV 3rd gen v 7.8

Additional context

airplay protocol pairs just fine, trying DMAP doesn't seem to work

postlund commented 2 years ago

You need to press enter (in atvremote) once you have enter the passcode, did you do that?

sergem155 commented 2 years ago

There is a little "done" button on screen by the digits - once I hit it, "password incorrect" appears on top of the screen and pyatv debug shows the postback (not sure in that order)

postlund commented 2 years ago

Hmm, the output tells us that the PIN code is incorrect from the device. Can you try changing it to something else and try again, e.g. --pin 1111?

sergem155 commented 2 years ago

Same issue (tried entering PIN twice in the log below)

atvremote -s 192.168.1.176 --debug --pin 1111 --protocol dmap pair
2021-10-24 11:01:52 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.176
2021-10-24 11:01:53 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.176:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-24 11:01:53 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.176:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': 'D2A34DFAD64E27CB', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-24 11:01:53 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.176:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-24 11:01:53 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 57863
2021-10-24 11:01:53 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=57863, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': 'C0A0E9ABE36C602F'}, interface_index=None)
2021-10-24 11:01:53 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1111
Use pin 1111 to pair with "pyatv" (press ENTER to stop)
2021-10-24 11:02:23 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 7a0660e8d1970ef9cc4e544b37426712
2021-10-24 11:02:23 DEBUG [pyatv.protocols.dmap.pairing]: Got code 7a0660e8d1970ef9cc4e544b37426712, expects 8c26463008c4d3e71c5e901297b8d8ad
2021-10-24 11:02:23 INFO [aiohttp.access]: 192.168.1.176 [24/Oct/2021:18:02:23 +0000] "GET /pair?pairingcode=7A0660E8D1970EF9CC4E544B37426712&servicename=61FBE455BD6E3BF2 HTTP/1.1" 500 193 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"
2021-10-24 11:02:32 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 7a0660e8d1970ef9cc4e544b37426712
2021-10-24 11:02:32 DEBUG [pyatv.protocols.dmap.pairing]: Got code 7a0660e8d1970ef9cc4e544b37426712, expects 8c26463008c4d3e71c5e901297b8d8ad
2021-10-24 11:02:32 INFO [aiohttp.access]: 192.168.1.176 [24/Oct/2021:18:02:32 +0000] "GET /pair?pairingcode=7A0660E8D1970EF9CC4E544B37426712&servicename=61FBE455BD6E3BF2 HTTP/1.1" 500 193 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"
postlund commented 2 years ago

Ok, that is indeed very strange. I want to try to backtrack this a bit. Please try atvremote -s 192.168.1.176 --debug --pin 1111 --pairing-guid 0xAAAAAAAAAAAAAAAA --protocol dmap pair and let me know what you get.

sergem155 commented 2 years ago

The Apple TV is now happy, but atvremote did not seem to have returned any code

$ atvremote -s 192.168.1.173 --debug --pin 1111 --pairing-guid 0xAAAAAAAAAAAAAAAA --protocol dmap pair
2021-10-25 19:22:09 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.173
2021-10-25 19:22:09 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.173:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-25 19:22:09 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.173:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': '7BF569519717E6B9', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-25 19:22:09 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.173:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-25 19:22:09 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 41405
2021-10-25 19:22:09 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=41405, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': 'AAAAAAAAAAAAAAAA'}, interface_index=None)
2021-10-25 19:22:10 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1111
Use pin 1111 to pair with "pyatv" (press ENTER to stop)
2021-10-25 19:22:36 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code c6f1332d6aea49c6aef9c38d3b89fe01
2021-10-25 19:22:36 DEBUG [pyatv.protocols.dmap.pairing]: Got code c6f1332d6aea49c6aef9c38d3b89fe01, expects c6f1332d6aea49c6aef9c38d3b89fe01
2021-10-25 19:22:36 INFO [aiohttp.access]: 192.168.1.173 [26/Oct/2021:02:22:36 +0000] "GET /pair?pairingcode=C6F1332D6AEA49C6AEF9C38D3B89FE01&servicename=61FBE455BD6E3BF2 HTTP/1.1" 200 226 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"
postlund commented 2 years ago

That seems to have succeed, you just need to press enter in atvremote to stop and print the credentials (there's unfortunately no feedback that pairing succeeded).

sergem155 commented 2 years ago

Setting pairing GUID definitely helped, I am able to connect - thank you. Feel free to close this one, as I have the workaround (but will be happy to test any fixes you might want to have tested against 3rd gen)

postlund commented 2 years ago

It's great that it works with the pre-defined identifier, but I'm very confused in regards to it not working with the randomly generated one. It really should. I have tried twisting and turning the values (brute forcing) various combination to figure out what the Apple TV is doing, but I can't seem to understand.

Can you try again with pairing guid 0x 0xAAAAAAAAAAAAAAAB and 0xBAAAAAAAAAAAAAAA with pin code 1111 and 1234 for each and include logs and results? That would help me a lot.

sergem155 commented 2 years ago

Installment 1:

atvremote -s 192.168.1.173 --debug --pin 1111 --pairing-guid 0xAAAAAAAAAAAAAAAB --protocol dmap pair
2021-10-31 15:48:43 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.173
2021-10-31 15:48:44 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.173:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-31 15:48:44 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.173:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': '38B8494B15F42D30', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-31 15:48:44 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.173:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-31 15:48:44 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 56553
2021-10-31 15:48:44 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=56553, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': 'AAAAAAAAAAAAAAAB'}, interface_index=None)
2021-10-31 15:48:45 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1111
Use pin 1111 to pair with "pyatv" (press ENTER to stop)
2021-10-31 15:49:04 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 78f4ac87ae57fb0961b76cbd767600f1
2021-10-31 15:49:04 DEBUG [pyatv.protocols.dmap.pairing]: Got code 78f4ac87ae57fb0961b76cbd767600f1, expects 78f4ac87ae57fb0961b76cbd767600f1
2021-10-31 15:49:04 INFO [aiohttp.access]: 192.168.1.173 [31/Oct/2021:22:49:04 +0000] "GET /pair?pairingcode=78F4AC87AE57FB0961B76CBD767600F1&servicename=61FBE455BD6E3BF2 HTTP/1.1" 200 226 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"

2021-10-31 15:49:08 DEBUG [pyatv.protocols.dmap.pairing]: Saving updated credentials
Pairing seems to have succeeded, yey!
You may now use these credentials: 0xAAAAAAAAAAAAAAAB
2021-10-31 15:49:08 WARNING [zeroconf]: unregister_all_services skipped as it does blocking i/o; use AsyncZeroconf with asyncio
sergem155 commented 2 years ago

Installment 2:

atvremote -s 192.168.1.173 --debug --pin 1111 --pairing-guid 0xBAAAAAAAAAAAAAAA --protocol dmap pair
2021-10-31 15:52:03 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.173
2021-10-31 15:52:04 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.173:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-31 15:52:04 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.173:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': '956DF2D836B67AB5', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-31 15:52:04 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.173:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-31 15:52:04 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 45107
2021-10-31 15:52:04 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=45107, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': 'BAAAAAAAAAAAAAAA'}, interface_index=None)
2021-10-31 15:52:05 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1111
Use pin 1111 to pair with "pyatv" (press ENTER to stop)
2021-10-31 15:52:20 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 61efd0e65277a900d7396a0ef777de4a
2021-10-31 15:52:20 DEBUG [pyatv.protocols.dmap.pairing]: Got code 61efd0e65277a900d7396a0ef777de4a, expects 61efd0e65277a900d7396a0ef777de4a
2021-10-31 15:52:20 INFO [aiohttp.access]: 192.168.1.173 [31/Oct/2021:22:52:20 +0000] "GET /pair?pairingcode=61EFD0E65277A900D7396A0EF777DE4A&servicename=61FBE455BD6E3BF2 HTTP/1.1" 200 226 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"

2021-10-31 15:52:25 DEBUG [pyatv.protocols.dmap.pairing]: Saving updated credentials
Pairing seems to have succeeded, yey!
You may now use these credentials: 0xBAAAAAAAAAAAAAAA
2021-10-31 15:52:25 WARNING [zeroconf]: unregister_all_services skipped as it does blocking i/o; use AsyncZeroconf with asyncio
sergem155 commented 2 years ago

Installment 3:

atvremote -s 192.168.1.173 --debug --pin 1234 --pairing-guid 0xAAAAAAAAAAAAAAAB --protocol dmap pair
2021-10-31 15:55:16 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.173
2021-10-31 15:55:17 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.173:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-31 15:55:17 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.173:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': '59591ECE5A9EC35A', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-31 15:55:17 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.173:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-31 15:55:17 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 53085
2021-10-31 15:55:17 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=53085, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': 'AAAAAAAAAAAAAAAB'}, interface_index=None)
2021-10-31 15:55:18 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1234
Use pin 1234 to pair with "pyatv" (press ENTER to stop)
2021-10-31 15:55:35 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 7e9cdc94afd308f5d484627482e448b1
2021-10-31 15:55:35 DEBUG [pyatv.protocols.dmap.pairing]: Got code 7e9cdc94afd308f5d484627482e448b1, expects 7e9cdc94afd308f5d484627482e448b1
2021-10-31 15:55:35 INFO [aiohttp.access]: 192.168.1.173 [31/Oct/2021:22:55:35 +0000] "GET /pair?pairingcode=7E9CDC94AFD308F5D484627482E448B1&servicename=61FBE455BD6E3BF2 HTTP/1.1" 200 226 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"

2021-10-31 15:55:38 DEBUG [pyatv.protocols.dmap.pairing]: Saving updated credentials
Pairing seems to have succeeded, yey!
You may now use these credentials: 0xAAAAAAAAAAAAAAAB
2021-10-31 15:55:38 WARNING [zeroconf]: unregister_all_services skipped as it does blocking i/o; use AsyncZeroconf with asyncio
sergem155 commented 2 years ago

Installment 4:

atvremote -s 192.168.1.173 --debug --pin 1234 --pairing-guid 0xBAAAAAAAAAAAAAAA --protocol dmap pair
2021-10-31 15:57:52 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.173
2021-10-31 15:57:53 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.173:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-10-31 15:57:53 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.173:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': '994A85FC3D54BCDA', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-10-31 15:57:53 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.173:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-10-31 15:57:53 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 57125
2021-10-31 15:57:53 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=57125, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': 'BAAAAAAAAAAAAAAA'}, interface_index=None)
2021-10-31 15:57:54 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1234
Use pin 1234 to pair with "pyatv" (press ENTER to stop)
2021-10-31 15:58:12 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 7d028a9c0af06d9dd127b3e885d8dc25
2021-10-31 15:58:12 DEBUG [pyatv.protocols.dmap.pairing]: Got code 7d028a9c0af06d9dd127b3e885d8dc25, expects 7d028a9c0af06d9dd127b3e885d8dc25
2021-10-31 15:58:12 INFO [aiohttp.access]: 192.168.1.173 [31/Oct/2021:22:58:12 +0000] "GET /pair?pairingcode=7D028A9C0AF06D9DD127B3E885D8DC25&servicename=61FBE455BD6E3BF2 HTTP/1.1" 200 226 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"

2021-10-31 15:58:15 DEBUG [pyatv.protocols.dmap.pairing]: Saving updated credentials
Pairing seems to have succeeded, yey!
You may now use these credentials: 0xBAAAAAAAAAAAAAAA
2021-10-31 15:58:15 WARNING [zeroconf]: unregister_all_services skipped as it does blocking i/o; use AsyncZeroconf with asyncio

let me know what else can I test

postlund commented 2 years ago

Wow, this is interesting. I have no idea what is going on. One more test that is interesting now though is if the initial pairing guid works when passing it from the command line. Does this work?

atvremote -s 192.168.1.173 --debug --pin 1234 --pairing-guid 0x91B5E2C44CD53B01 --protocol dmap pair
sergem155 commented 2 years ago

there you go:

atvremote -s 192.168.1.173 --debug --pin 1234 --pairing-guid 0x91B5E2C44CD53B01 --protocol dmap pair
2021-11-01 19:43:27 DEBUG [pyatv.support.knock]: Knocking at ports [3689, 7000, 49152, 32498] on 192.168.1.173
2021-11-01 19:43:28 DEBUG [pyatv.core.scan]: Auto-discovered Big Stereo at 192.168.1.173:7000 via Protocol.AirPlay ({'deviceid': 'B8:78:2E:4C:CB:EB', 'features': '0x5A7FFFF7,0x1E', 'flags': '0x44', 'model': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'pi': 'a3dd25ff-59c1-4f59-a813-c682b278bf77', 'srcvers': '220.68', 'osvers': '8.4.4', 'vv': '2'})
2021-11-01 19:43:28 DEBUG [pyatv.core.scan]: Auto-discovered 61FBE455BD6E3BF2 at 192.168.1.173:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': 'B7BC772A8B4AE8F6', 'ctln': 'Big Stereo', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2021-11-01 19:43:28 DEBUG [pyatv.core.scan]: Auto-discovered B8782E4CCBEB@Big Stereo at 192.168.1.173:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x5A7FFFF7,0x1E', 'md': '0,1,2', 'am': 'AppleTV3,2', 'pk': '9e456060d821f737ba5253187ab2460196a86b05e8ef2b041b074aa301c9f81f', 'sf': '0x44', 'tp': 'UDP', 'vn': '65537', 'vs': '220.68', 'ov': '8.4.4', 'vv': '2'})
2021-11-01 19:43:28 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 53589
2021-11-01 19:43:28 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000003232235947._touch-remote._tcp.local.', addresses=[b'\xc0\xa8\x01\xab'], port=53589, weight=0, priority=0, server='0000000000000000000000000000003232235947._touch-remote._tcp.local.', properties={'DvNm': 'pyatv', 'RemV': '10000', 'DvTy': 'iPod', 'RemN': 'Remote', 'txtvers': '1', 'Pair': '91B5E2C44CD53B01'}, interface_index=None)
2021-11-01 19:43:29 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1234
Use pin 1234 to pair with "pyatv" (press ENTER to stop)
2021-11-01 19:43:48 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from 61FBE455BD6E3BF2 with code 2be73ff27acaaa7dcad5f1060d3603e3
2021-11-01 19:43:48 DEBUG [pyatv.protocols.dmap.pairing]: Got code 2be73ff27acaaa7dcad5f1060d3603e3, expects 2be73ff27acaaa7dcad5f1060d3603e3
2021-11-01 19:43:48 INFO [aiohttp.access]: 192.168.1.173 [02/Nov/2021:02:43:48 +0000] "GET /pair?pairingcode=2BE73FF27ACAAA7DCAD5F1060D3603E3&servicename=61FBE455BD6E3BF2 HTTP/1.1" 200 226 "-" "AppleTV/7.8 iOS/8.4.4 AppleTV/7.8 model/AppleTV3,2 build/12H937 (3; dt:12)"

2021-11-01 19:43:54 DEBUG [pyatv.protocols.dmap.pairing]: Saving updated credentials
Pairing seems to have succeeded, yey!
You may now use these credentials: 0x91B5E2C44CD53B01
2021-11-01 19:43:54 WARNING [zeroconf]: unregister_all_services skipped as it does blocking i/o; use AsyncZeroconf with asyncio
cherpake commented 1 week ago

Having same issue:

atvremote -s 10.0.0.38 --debug --pin 1234 --pairing-guid 0x91B5E2C44CD53B01 --protocol dmap pair
2024-09-02 12:35:02 DEBUG [pyatv.scripts]: Running with pyatv 0.15.0
2024-09-02 12:35:02 DEBUG [pyatv.storage.file_storage]: Loading settings from /Users/cherpake/.pyatv.conf
2024-09-02 12:35:02 DEBUG [pyatv.support.knock]: Knocking at port 3689 on 10.0.0.38
2024-09-02 12:35:02 DEBUG [pyatv.support.knock]: Knocking at port 7000 on 10.0.0.38
2024-09-02 12:35:02 DEBUG [pyatv.support.knock]: Knocking at port 49152 on 10.0.0.38
2024-09-02 12:35:02 DEBUG [pyatv.support.knock]: Knocking at port 32498 on 10.0.0.38
2024-09-02 12:35:02 DEBUG [pyatv.core.scan]: Auto-discovered ED05931001EC96D2 at 10.0.0.38:3689 via Protocol.DMAP ({'txtvers': '1', 'atsv': '65541', 'dbid': 'E114A2955094B6F5', 'ctln': 'Apple TV', 'dvty': 'AppleTV', 'dvsv': '1792', 'atcv': '65539', 'ver': '131077'})
2024-09-02 12:35:02 DEBUG [pyatv.protocols.dmap.pairing]: Started pairing web server at port 62890
2024-09-02 12:35:02 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000000167772228._touch-remote._tcp.local.', addresses=[b'\n\x00\x00D'], port=62890, weight=0, priority=0, server=None, properties={b'DvNm': b'pyatv', b'RemV': b'10000', b'DvTy': b'iPod', b'RemN': b'Remote', b'txtvers': b'1', b'Pair': b'91B5E2C44CD53B01'}, interface_index=None)
2024-09-02 12:35:02 DEBUG [pyatv.core.mdns]: Publishing zeroconf service: ServiceInfo(type='_touch-remote._tcp.local.', name='0000000000000000000000000000002852002989._touch-remote._tcp.local.', addresses=[b'\xa9\xfe\x1c\xad'], port=62890, weight=0, priority=0, server=None, properties={b'DvNm': b'pyatv', b'RemV': b'10000', b'DvTy': b'iPod', b'RemN': b'Remote', b'txtvers': b'1', b'Pair': b'91B5E2C44CD53B01'}, interface_index=None)
2024-09-02 12:35:03 DEBUG [pyatv.protocols.dmap.pairing]: DMAP PIN changed to 1234
Use pin 1234 to pair with "pyatv" (press ENTER to stop)
2024-09-02 12:35:31 INFO [pyatv.protocols.dmap.pairing]: Got pairing request from ED05931001EC96D2 with code 0e681378e1d986deb811919ebc0a613b
2024-09-02 12:35:31 DEBUG [pyatv.protocols.dmap.pairing]: Got code 0e681378e1d986deb811919ebc0a613b, expects 2be73ff27acaaa7dcad5f1060d3603e3
2024-09-02 12:35:31 INFO [aiohttp.access]: 10.0.0.38 [02/Sep/2024:11:35:31 +0200] "GET /pair?pairingcode=0E681378E1D986DEB811919EBC0A613B&servicename=ED05931001EC96D2 HTTP/1.1" 500 188 "-" "AppleTV/7.9 iOS/8.4.4 AppleTV/7.9 model/AppleTV3,1 build/12H1006 (3; dt:12)"