Skip to content

Commit

Permalink
[COMPBATT] Enable debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoB99 committed Nov 24, 2024
1 parent 6148e6e commit 4beee5d
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 44 deletions.
4 changes: 3 additions & 1 deletion drivers/battery/battc/battc.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo,
NTSTATUS Status;
PBATTERY_CLASS_DATA BattClass;

__debugbreak();

BattClass = ExAllocatePoolWithTag(NonPagedPool,
sizeof(BATTERY_CLASS_DATA),
BATTERY_CLASS_DATA_TAG);
Expand All @@ -164,7 +166,7 @@ BatteryClassInitializeDevice(PBATTERY_MINIPORT_INFO MiniportInfo,
&BattClass->InterfaceName);
if (NT_SUCCESS(Status))
{
DPRINT("Initialized battery interface: %wZ\n", &BattClass->InterfaceName);
DPRINT1("Initialized battery interface: %wZ\n", &BattClass->InterfaceName);
Status = IoSetDeviceInterfaceState(&BattClass->InterfaceName, TRUE);
if (Status == STATUS_OBJECT_NAME_EXISTS)
{
Expand Down
2 changes: 2 additions & 0 deletions drivers/bus/acpi/cmbatt/cmbpnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ CmBattAddBattery(IN PDRIVER_OBJECT DriverObject,
if (CmBattDebug & 0x220)
DbgPrint("CmBattAddBattery: pdo %x\n", DeviceObject);

__debugbreak();

/* Create the FDO */
Status = CmBattCreateFdo(DriverObject,
DeviceObject,
Expand Down
2 changes: 1 addition & 1 deletion drivers/bus/acpi/compbatt/compbatt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/* GLOBALS ********************************************************************/

ULONG CompBattDebug;
ULONG CompBattDebug = 0x100 | 8 | 1 | 2;

/* FUNCTIONS ******************************************************************/

Expand Down
92 changes: 50 additions & 42 deletions drivers/bus/acpi/compbatt/compbatt.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
/*
* PROJECT: ReactOS Composite Battery Driver
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: boot/drivers/bus/acpi/compbatt/compbatt.h
* PURPOSE: Main Header File
* PROGRAMMERS: ReactOS Portable Systems Group
* PROJECT: ReactOS Composite Battery Driver
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Composite battery main header file
* COPYRIGHT: Copyright 2010 ReactOS Portable Systems Group
* Copyright 2024 George Bișoc <[email protected]>
*/

/* INCLUDES *******************************************************************/

#ifndef _COMPBATT_PCH_
#define _COMPBATT_PCH_

#include <wdm.h>
#include <batclass.h>

/* DEFINES ********************************************************************/

#define COMPBATT_BATTERY_INFORMATION_PRESENT 0x04
#define COMPBATT_TAG_ASSIGNED 0x80

/* STRUCTURES *****************************************************************/

typedef struct _COMPBATT_BATTERY_DATA
{
LIST_ENTRY BatteryLink;
Expand Down Expand Up @@ -56,101 +62,103 @@ typedef struct _COMPBATT_DEVICE_EXTENSION
PVOID NotificationEntry;
} COMPBATT_DEVICE_EXTENSION, *PCOMPBATT_DEVICE_EXTENSION;

/* PROTOTYPES *****************************************************************/

NTSTATUS
NTAPI
CompBattAddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT PdoDeviceObject
_In_ PDRIVER_OBJECT DriverObject,
_In_ PDEVICE_OBJECT PdoDeviceObject
);

NTSTATUS
NTAPI
CompBattPowerDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
_In_ PDEVICE_OBJECT DeviceObject,
_In_ PIRP Irp
);

NTSTATUS
NTAPI
CompBattPnpDispatch(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
_In_ PDEVICE_OBJECT DeviceObject,
_In_ PIRP Irp
);

NTSTATUS
NTAPI
CompBattQueryInformation(
IN PCOMPBATT_DEVICE_EXTENSION FdoExtension,
IN ULONG Tag,
IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel,
IN OPTIONAL LONG AtRate,
IN PVOID Buffer,
IN ULONG BufferLength,
OUT PULONG ReturnedLength
_In_ PCOMPBATT_DEVICE_EXTENSION FdoExtension,
_In_ ULONG Tag,
_In_ BATTERY_QUERY_INFORMATION_LEVEL InfoLevel,
_In_opt_ LONG AtRate,
_In_ PVOID Buffer,
_In_ ULONG BufferLength,
_Out_ PULONG ReturnedLength
);

NTSTATUS
NTAPI
CompBattQueryStatus(
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
IN ULONG Tag,
IN PBATTERY_STATUS BatteryStatus
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
_In_ ULONG Tag,
_In_ PBATTERY_STATUS BatteryStatus
);

NTSTATUS
NTAPI
CompBattSetStatusNotify(
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
IN ULONG BatteryTag,
IN PBATTERY_NOTIFY BatteryNotify
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
_In_ ULONG BatteryTag,
_In_ PBATTERY_NOTIFY BatteryNotify
);

NTSTATUS
NTAPI
CompBattDisableStatusNotify(
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension
);

NTSTATUS
NTAPI
CompBattQueryTag(
IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
OUT PULONG Tag
_In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
_Out_ PULONG Tag
);

NTSTATUS
NTAPI
CompBattMonitorIrpComplete(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PKEVENT Event
_In_ PDEVICE_OBJECT DeviceObject,
_In_ PIRP Irp,
_In_ PKEVENT Event
);

NTSTATUS
NTAPI
CompBattMonitorIrpCompleteWorker(
IN PCOMPBATT_BATTERY_DATA BatteryData
_In_ PCOMPBATT_BATTERY_DATA BatteryData
);

NTSTATUS
NTAPI
CompBattGetDeviceObjectPointer(
IN PUNICODE_STRING DeviceName,
IN ACCESS_MASK DesiredAccess,
OUT PFILE_OBJECT *FileObject,
OUT PDEVICE_OBJECT *DeviceObject
_In_ PUNICODE_STRING DeviceName,
_In_ ACCESS_MASK DesiredAccess,
_Out_ PFILE_OBJECT *FileObject,
_Out_ PDEVICE_OBJECT *DeviceObject
);

NTSTATUS
NTAPI
BatteryIoctl(
IN ULONG IoControlCode,
IN PDEVICE_OBJECT DeviceObject,
IN PVOID InputBuffer,
IN ULONG InputBufferLength,
IN PVOID OutputBuffer,
IN ULONG OutputBufferLength,
IN BOOLEAN InternalDeviceIoControl
_In_ ULONG IoControlCode,
_In_ PDEVICE_OBJECT DeviceObject,
_In_ PVOID InputBuffer,
_In_ ULONG InputBufferLength,
_In_ PVOID OutputBuffer,
_In_ ULONG OutputBufferLength,
_In_ BOOLEAN InternalDeviceIoControl
);

extern ULONG CompBattDebug;
Expand Down
4 changes: 4 additions & 0 deletions drivers/bus/acpi/compbatt/comppnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ CompBattAddDevice(IN PDRIVER_OBJECT DriverObject,
BATTERY_MINIPORT_INFO MiniportInfo;
if (CompBattDebug & 2) DbgPrint("CompBatt: Got an AddDevice - %x\n", PdoDeviceObject);

__debugbreak();

/* Create the device */
RtlInitUnicodeString(&DeviceName, L"\\Device\\CompositeBattery");
Status = IoCreateDevice(DriverObject,
Expand Down Expand Up @@ -414,6 +416,8 @@ CompBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject,
/* Set default error */
Status = STATUS_NOT_SUPPORTED;

__debugbreak();

/* Check what kind of PnP function this is */
switch (IoStackLocation->MinorFunction)
{
Expand Down

0 comments on commit 4beee5d

Please sign in to comment.