postlund / pyatv

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

Trigger sysdiagnose #1808

Open llamafilm opened 2 years ago

llamafilm commented 2 years ago

What feature would you like?

I would like to trigger a sysdiagnose to capture Apple TV logs. This is normally done by holding PLAY and VOL- for 6 seconds.

Describe the solution you'd like

I use this tool with Bitfocus Companion using the tutorial.py web server. Ideally I would like to see an additional command exposed like /remote_control/<DEVICE_ID>/sysdiagnose.

Any other information to share?

sysdiagnose_Logging_Instructions.pdf

llamafilm commented 2 years ago

Is this possible? I would be willing to sponsor development.

postlund commented 2 years ago

I will look into it, sure! I suspect "pressing the buttons" like on the physical remote does not work over any of the protocols, some commands seem to only work on the physical remote. I have seen some diagnostic messages in MRP though, so maybe I can use one of those.

postlund commented 2 years ago

I experimented with button presses over MRP yesterday and got some kind of results... If I "press" play/pause + volume down for one second, I can see in the upper right corner of the screen that it made a stack dump. Also telling me to hold for six seconds to trigger full diagnostics. If I do the full six second press, then nothing in particular happens. Not entirely sure why that is. There is a timestamp in the HID message that I haven't manage to decode yet, so maybe related to that being wrong. I'm gonna try with the SendButtonMesssage and see if it makes any difference when I get a few minutes.

postlund commented 2 years ago

I have now tried the same thing with SendButtonMessage as well as via Companion and the behavior is consistent amongst all protocols. Must be some sort of detail I'm missing, not sure what though.

llamafilm commented 2 years ago

I tried watching the Console log while triggering this via Apple remote. The first line shows the stackshot, and the second line shows the sysdiagnose, just a question mark. Not very helpful...

sysdiagnose request: sysdiagnose (stackshot only) keychord: PlayPause + Volume Down
sysdiagnose request: sysdiagnose (full) keychord: ?