After I plugged in an Apple TV 4, I noticed that upower goes havoc crashing and being respawned ending up in a loop eating up all CPU and freezing the system. Investigating the issue lead me to the workflow that queries for battery support of the iOS device. Since this device does not feature a battery, it does not provide the "BatteryIsCharging" key. As there is no further check in the code before attempting to get the boolean value of the node upower will crash. I'll cook up a patch to fix this and add another query for newer iOS versions.
Created attachment 138223 [details] [review] [PATCH 1/2] linux: Prevent crash after attaching an Apple TV As Apple TVs do not have a battery and do not provide the "BatteryIsCharging" lockdown key, upower would crash due to a missing check whether the retrieved node is actually valid.
Created attachment 138224 [details] [review] [PATCH 2/2] linux: Check "HasBattery" key for newer iOS versions This adds an extra check to query if the iOS device has a battery at all before actually trying to retrieve the battery status. Should still work for older iOS versions which do not provide this key.
Both committed to master, thanks! commit 598fdbc5e00573d1b56d4107798f82bd615842b3 Author: Martin Szulecki <martin.szulecki@libimobiledevice.org> Date: Tue Mar 20 15:04:26 2018 +0100 linux: Check "HasBattery" key for newer iOS versions This adds an extra check to query if the iOS device has a battery at all before actually trying to retrieve the battery status. Should still work for older iOS versions which do not provide this key. https://bugzilla.freedesktop.org/show_bug.cgi?id=105625 commit 9357aa60e7773d997e6208c9b3cab09adc166e38 Author: Martin Szulecki <martin.szulecki@libimobiledevice.org> Date: Tue Mar 20 15:00:21 2018 +0100 linux: Prevent crash after attaching an Apple TV As Apple TVs do not have a battery and do not provide the "BatteryIsCharging" lockdown key, upower would crash due to a missing check whether the retrieved node is actually valid. https://bugzilla.freedesktop.org/show_bug.cgi?id=105625
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.