danielpaulus / go-ios

This is an operating system independent implementation of iOS device features. You can run UI tests, launch or kill apps, install apps etc. with it.
MIT License
808 stars 163 forks source link

Apple TV issue diagnostics/mobilegestalt/rebooting #222

Open nickhyl opened 1 year ago

nickhyl commented 1 year ago

I am facing an issue getting diagnostics/mobilegestalt/rebooting an Apple TV device. The device is paired over network and supervised, running tvOS 16.2. These commands are working for me for another device running 16.1, so was thinking it is related to changes in the recent upgrade, but unsure. I get the following issues running commands

% ios diagnostics --udid 1dafa12122994bd53425e32165086f586c91c7ba list
{"level":"info","msg":"Handshake errorEOF","time":"2023-01-23T12:40:35Z"}
{"err":"EOF","level":"fatal","msg":"Starting diagnostics service failed with","time":"2023-01-23T12:40:35Z"}

 % ios mobilegestalt --udid 1dafa12122994bd53425e32165086f586c91c7ba AirplaneMode
{"level":"info","msg":"Handshake errorEOF","time":"2023-01-23T12:43:18Z"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x139a83c]

goroutine 1 [running]:
github.com/danielpaulus/go-ios/ios/diagnostics.(*Connection).MobileGestaltQuery(0xc0005300f0, {0xc0000d7810, 0x7, 0x5})
    /Users/runner/work/go-ios/go-ios/ios/diagnostics/mobilegestalt.go:18 +0x3c
main.mobileGestaltCommand({0x11b9, {0xc0000e01d0, 0x8}, {0x0, {0xc0000e0240, 0x7}, 0x11b9, 0x0, 0x0, {0xc00044c870, ...}}}, ...)
    /Users/runner/work/go-ios/go-ios/main.go:729 +0x105
main.Main()
    /Users/runner/work/go-ios/go-ios/main.go:260 +0x505
main.main()
    /Users/runner/work/go-ios/go-ios/main.go:52 +0x17

% ios reboot --udid 1dafa12122994bd53425e32165086f586c91c7ba
{"level":"info","msg":"Handshake errorEOF","time":"2023-01-23T12:43:39Z"}
{"level":"error","msg":"EOF","time":"2023-01-23T12:43:39Z"}
shamanec commented 1 year ago

I really don't know what is happening, but are you using Xcode 14.2 which has the development images for tvOS16.2? Does the device appear as successfully prepared for development in Xcode? I didn't even know go-ios works with tvOS as well, kudos to Daniel :D

danielpaulus commented 1 year ago

This seems like there is something wrong with the pair record.

danielpaulus commented 1 year ago

I will buy an AppleTV and add it to the list of test devices. Does ios info work?

nickhyl commented 1 year ago

Thanks for getting back to me guys @shamanec

I really don't know what is happening, but are you using Xcode 14.2 which has the development images for tvOS16.2? Does the device appear as successfully prepared for development in Xcode?

Yes using Xcode 14.2 and have the device successfully paired over network

I didn't even know go-ios works with tvOS as well, kudos to Daniel :D

Yeah it actually works quite well 😄 . In fact was the only way I could get wda running for the Apple TV (xcodebuild commands don't seem to work apparently)

@danielpaulus

Does ios info work?

Yes. I think pretty much all of go-ios is working correctly, just anything related to the diagnostics service is causing issues (reboot, mobilegestalt, ioregistry). Makes me wonder has the service name changed after update from 16.1 -> 16.2

app@mobile-10-102-48-249 browserstack % ios info --udid 1dafa12122994bd53425e32165086f586c91c7ba
{"ActivationState":"Activated","ActivationStateAcknowledged":true,"BasebandStatus":"NoTelephonyCapabilty","BluetoothAddress":"ec:a9:07:1a:f0:15","BoardId":8,"BootSessionID":"FD0183DA-FDE6-424E-8FC0-CF320C6ADA37","BrickState":false,"BuildVersion":"20K661","CPUArchitecture":"arm64e","ChipID":32800,"DeviceClass":"AppleTV","DeviceColor":"unknown","DeviceName":"10.102.48.214","DieID":2863867657535534,"EthernetAddress":"ec:a9:07:19:d5:d6","FirmwareVersion":"iBoot-8419.80.7","HardwareModel":"J305AP","HardwarePlatform":"t8020","MLBSerialNumber":"C0721461S3WL794DP","ModelNumber":"MXGY2","NonVolatileRAM":{"SystemAudioVolumeSaved":"dHJ1ZQ==","audio-features":"MHgw","auto-boot":"dHJ1ZQ==","boot-args":"","bootdelay":"MA==","obliteration":"RUFDUyBEb25lIEAxNjc1OTU0MDY3LCBDYWxsZXI6IE4vQSwgUmVhc29uOiBOL0EgW2dGOiAweDAwMDAwMDAwMDAwMDAwODBd","ota-original-base-os-version":"MjBLMzYy"},"PairRecordProtectionClass":4,"PartitionType":"GUID_partition_scheme","PasswordProtected":false,"ProductName":"Apple TVOS","ProductType":"AppleTV11,1","ProductVersion":"16.3.1","ProductionSOC":true,"ProtocolVersion":"2","RegionInfo":"B/A","SerialNumber":"KV66PHYXY9","SoftwareBundleVersion":"","SupportedDeviceFamilies":[3],"TelephonyCapability":false,"TimeIntervalSince1970":1677519616.157054,"TimeZone":"Europe/Dublin","TimeZoneOffsetFromUTC":0,"TrustedHostAttached":true,"UniqueChipID":2863867657535534,"UniqueDeviceID":"1dafa12122994bd53425e32165086f586c91c7ba","UseRaptorCerts":true,"Uses24HourClock":false,"WiFiAddress":"ec:a9:07:0b:78:4a","instruments:hardwareInformation":{"hwCPU64BitCapable":1,"hwCPUsubtype":2,"hwCPUtype":16777228,"numberOfCpus":6,"numberOfPhysicalCpus":6},"instruments:networkInformation":{"en0":"Ethernet","en1":"Wi-Fi","en2":"Ethernet Adapter (en2)","lo0":"Loopback"}}

Note have checked with latest version 16.3 and am still seeing the issue, but 16.1 it is still working as expected

danielpaulus commented 1 year ago

Ok the device is on the way. Apple says it will arrive tomorrow.

nickhyl commented 1 year ago

Hey, just wondering has there been any findings with the Apple TV device?