acidanthera / bugtracker

Acidanthera Bugtracker
385 stars 44 forks source link

"UPS battery is at 0%" on an iMac with no battery #590

Closed HQuest closed 4 years ago

HQuest commented 4 years ago

Earlier this month, my iMac19,2 (running Catalina; currently at 10.15.2 Beta 3 19C46a) started to display a warning stating my UPS battery was at 0%. However, I have no UPS battery communication wiring installed on this desktop unit. Unless the system has magically found any of my multiple UPS battery systems on my AC network (which would be a first to me), I suspect this is a bug somewhere along the lines of similar reports introduced with some recent VirtualSMC code.

Because this is a desktop system, I have no battery SSDT/DSDT files, nor am using any extension like SMCBatteryManager.kext. Just the basic required for any system (Lilu/VirtualSMC/WEG/AppleALC) and the specifics for my system (USBPorts/IntelMausi/AGPMInjector).

I have rebuilt OC from today's git code, since the previous files from Nov 21 could have been modified and the above resolved, but it doesn't seems like.

Hints on log files/predicates to collect are appreciated.

[Edit] I have downloaded VirtualSMC v1.0.8 DEBUG and will left it run for a while; curious if this is not a Catalina Beta issue, as I might recall seeing it first time after latest beta was applied.

vit9696 commented 4 years ago

I am afraid SMC (neither real, nor VirtualSMC) has no means to report anything about UPS. This should be your network or alike. Please try to investigate further and close the issue unless there is something we can help you with.

HQuest commented 4 years ago

Thank you for the suggestions. None of my UPS systems are connected to any data channel; everything is purely AC only, so as I joked, if the OS magically identified UPS units via AC lines with no extra hardware required, I would truly be impressed (and eager to extend this feature into my business systems).

Now, I partially agree with the UPS statement. While the symptoms are UPS related, this is still a system information, read from something purely local (no wired Ethernet cables, wlan adapter physically removed to be on the absolutely safe side, and all but USB keyboard/mouse left - I do have a FTDI USB to Serial adapter, which too was removed), claiming current system power source is from a UPS. Power management, IIRC, is part of the SMC.

Screen Shot 2019-11-30 at 15 14 35

I will indeed do some more testings to confirm. After I rolled an earlier VirtualSMC code and I still saw this warning, I'm tempted to claim this is on Apple's end.

vit9696 commented 4 years ago

This really sounds like a bug in macOS. Power management is not working through SMC, this is normally SMBus. It is just that on newer models battery data is also available through SMC for touchbar convenience primarily.

07151129 commented 4 years ago

Could you post a complete dump of ioreg? In the meantime, you could try unloading ioupsd.

On 30 Nov 2019, at 21:24, HQuest notifications@github.com wrote:

Thank you for the suggestions. None of my UPS systems are connected to any data channel; everything is purely AC only, so as I joked, if the OS magically identified UPS units via AC lines with no extra hardware required, I would truly be impressed (and eager to extend this feature into my business systems).

Now, I partially agree with the UPS statement. While the symptoms are UPS related, this is still a system information, read from something purely local (no wired Ethernet cables, wlan adapter physically removed to be on the absolutely safe side, and all but USB keyboard/mouse left - I do have a FTDI USB to Serial adapter, which too was removed), claiming current system power source is from a UPS. Power management, IIRC, is part of the SMC.

I will indeed do some more testings to confirm. After I rolled an earlier VirtualSMC code and I still saw this warning, I'm tempted to claim this is on Apple's end.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

HQuest commented 4 years ago

Could you post a complete dump of ioreg? In the meantime, you could try unloading ioupsd.

ioreg.txt

07151129 commented 4 years ago

It looks like USB device Corsair Commander PRO is (mistakenly?) recognised as UPS by IOHIDFamily (see IOHIDUPSClass.cpp):

    | |   |   |     +-o AppleUserUSBHostHIDDevice  <class IORegistryEntry:IOService:IOHIDDevice:AppleUserHIDDevice, id 0x100001885, registered, matched, active, busy 0 (2 ms), retain 15>
    | |   |   |       | {
    | |   |   |       |   "PrimaryUsagePage" = 0x84
    | |   |   |       |   "MaxInputReportSize" = 0x10
    | |   |   |       |   "IOUserClientClass" = "IOHIDLibUserClient"
    | |   |   |       |   "VersionNumber" = 0x9
    | |   |   |       |   "VendorID" = 0x1b1c
    | |   |   |       |   "ReportDescriptor" = <05840952a101a1000a00ff758095018102c0091a7508953f9102c0>
    | |   |   |       |   "DebugState" = {}
    | |   |   |       |   "BootProtocol" = 0x0
    | |   |   |       |   "MaxFeatureReportSize" = 0x0
    | |   |   |       |   "Product" = "Commander PRO"
    | |   |   |       |   "SerialNumber" = "1205002A9303141B"
    | |   |   |       |   "Transport" = "USB"
    | |   |   |       |   "UPSDevice" = Yes
    | |   |   |       |   "IOServiceDEXTEntitlements" = "com.apple.developer.driverkit.family.hid.device"
    | |   |   |       |   "Manufacturer" = "Corsair"
    | |   |   |       |   "IOUserServerCDHash" = "0c43a589362c9eff8783b8ca4c2251908c8650c5"
    | |   |   |       |   "ProductID" = 0xc10
...

The device reports usage page 0x84 (Power Device Page), and IOHID seems to ignore the reported usage, despite kHIDUsage_PD_UPS = 0x04 not being reported.

In order to confirm if that's indeed the case, you could try unplugging it. There is not much we can do without patching IOHID; this is definitely not a bug with vsmc. It's probably the easiest to unload the ups daemon (ioupsd, most likely spawned by powerd).

HQuest commented 4 years ago

By "mistakenly recognizing", you are being very generous. Yes, this is not an UPS device but a RGB/Fan/Temp monitor system that has zero support on OS X but allows me to have preconfigured settings for system acoustics from its Windows iCue software. Unfortunately it shares its "Commander Pro" name with a well known UPS system, so lazy Apple decided to assume any vendor using this name must be talking about a UPS device. Same logic as I me going to my grocery store to buy a new phone that sits on the bin right next to berries and grapefruits...

Done deal, false alarm, thank you for pointing it out.