You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
simbatt: Provide instructions for how to test the driver
Add instructions for how to install the driver, simulate two batteries, modify battery parameters and clean up afterwards.
The instructions assume that testsigning is already enabled with "bcdedit /set testsigning on" and that the driver signing certificate is trusted with "certutil.exe -addstore root simbatt.cer" and "certutil.exe -f -addstore trustedpublisher simbatt.cer".
The simulated batteries will have device instance ID `SWD\DEVGEN\1` and `SWD\DEVGEN\2`.
35
+
36
+
### Modify battery parameters
37
+
Parameters for each simulated battery can be changed through `IOCTL_SIMBATT_SET_STATUS` IOCTL calls with [`BATTERY_STATUS`](https://learn.microsoft.com/en-us/windows/win32/power/battery-status-str) input. This enables simulation of many power scenarios, such as low charge and switching between AC and DC power. This can be done without any physical batteries attached. One can in fact use the driver to simulate multi-battery setups in a Virtual Machine (VM).
38
+
39
+
Example of how to simulate 50% battery charge that is currently being discharged:
The `battery` handle can be accessed by first using `CM_Locate_DevNode` to get a device instance handle from the device instance ID. Then, use `CM_Get_DevNode_Property` with `DEVPKEY_Device_PDOName` to get the physical device object (PDO) string. Finally, use `CreateFile` to open the battery based on the PDO string with a `\\?\GLOBALROOT` prefix.
0 commit comments