MCPcopy Create free account
hub / github.com/acidanthera/VirtualSMC / readAccess

Method readAccess

Sensors/SMCBatteryManager/KeyImplementations.cpp:11–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "SMCBatteryManager.hpp"
10
11SMC_RESULT ACID::readAccess() {
12 IOSimpleLockLock(BatteryManager::getShared()->stateLock);
13 auto extConnected = BatteryManager::getShared()->externalPowerConnected();
14 IOSimpleLockUnlock(BatteryManager::getShared()->stateLock);
15 if (extConnected) {
16 // Have some dummy value here for now, because ACPI has no means of getting adapter info
17 // like power, voltage, serial number through only 2 pins - Vcc and GND.
18 data[0] = 0xba;
19 data[1] = 0xbe;
20 data[2] = 0x3c;
21 data[3] = 0x45;
22 data[4] = 0xc0;
23 data[5] = 0x03;
24 data[6] = 0x10;
25 data[7] = 0x43;
26 } else {
27 memset(data, 0, size);
28 }
29 return SmcSuccess;
30}
31
32SMC_RESULT ACIN::readAccess() {
33 bool *ptr = reinterpret_cast<bool *>(data);

Callers

nothing calls this directly

Calls 5

getSharedFunction · 0.85
batteriesConnectedMethod · 0.80
batteriesAreFullMethod · 0.80

Tested by

no test coverage detected