Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acf5d03277 | ||
|
|
9933c87004 |
@@ -705,7 +705,9 @@ public final class SystemTelemetryStore {
|
|||||||
: 0
|
: 0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
context.batteryLevel = self.power.batteryLevel
|
context.batteryLevel = self.batteryHealth.maxCapacity > 0
|
||||||
|
? Double(self.batteryHealth.currentCapacity) / Double(self.batteryHealth.maxCapacity) * 100.0
|
||||||
|
: self.power.batteryLevel
|
||||||
context.hasBattery = self.batteryHealth.hasBattery
|
context.hasBattery = self.batteryHealth.hasBattery
|
||||||
context.onExternalPower = self.batteryHealth.externalConnected
|
context.onExternalPower = self.batteryHealth.externalConnected
|
||||||
context.isCharging = self.batteryHealth.isCharging || self.power.isCharging
|
context.isCharging = self.batteryHealth.isCharging || self.power.isCharging
|
||||||
|
|||||||
@@ -57,13 +57,13 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CFMutableDictionaryRef matching = IOServiceMatching("AppleSMCClient");
|
CFMutableDictionaryRef matching = IOServiceMatching("AppleSMC");
|
||||||
if (!matching) {
|
if (!matching) {
|
||||||
os_unfair_lock_unlock(&_lock);
|
os_unfair_lock_unlock(&_lock);
|
||||||
if (error) {
|
if (error) {
|
||||||
*error = [NSError errorWithDomain:@"com.i3omb.MacMonitor.SMC"
|
*error = [NSError errorWithDomain:@"com.i3omb.MacMonitor.SMC"
|
||||||
code:-1
|
code:-1
|
||||||
userInfo:@{NSLocalizedDescriptionKey: @"Failed to create AppleSMCClient matching dictionary"}];
|
userInfo:@{NSLocalizedDescriptionKey: @"Failed to create AppleSMC matching dictionary"}];
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
if (error) {
|
if (error) {
|
||||||
*error = [NSError errorWithDomain:@"com.i3omb.MacMonitor.SMC"
|
*error = [NSError errorWithDomain:@"com.i3omb.MacMonitor.SMC"
|
||||||
code:-2
|
code:-2
|
||||||
userInfo:@{NSLocalizedDescriptionKey: @"AppleSMCClient service not found (running on non-Mac or unsupported VM)"}];
|
userInfo:@{NSLocalizedDescriptionKey: @"AppleSMC service not found (running on non-Mac or unsupported VM)"}];
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
#define kSMCGetKeyFromIndex 8
|
#define kSMCGetKeyFromIndex 8
|
||||||
#define kSMCGetKeyInfo 9
|
#define kSMCGetKeyInfo 9
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char major;
|
unsigned char major;
|
||||||
unsigned char minor;
|
unsigned char minor;
|
||||||
@@ -58,8 +56,6 @@ typedef struct {
|
|||||||
UInt8 bytes[32];
|
UInt8 bytes[32];
|
||||||
} SMCVal_t;
|
} SMCVal_t;
|
||||||
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
static inline UInt32 MMSMCToFourCharCode(const char * _Nonnull str) {
|
static inline UInt32 MMSMCToFourCharCode(const char * _Nonnull str) {
|
||||||
UInt32 code = 0;
|
UInt32 code = 0;
|
||||||
for (int i = 0; i < 4 && str[i] != '\0'; i++) {
|
for (int i = 0; i < 4 && str[i] != '\0'; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user