mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:45:50 +00:00
Use kernel facilities to change debug level at runtime
svn path=/trunk/; revision=31639
This commit is contained in:
parent
105d16cdd9
commit
8fbe89bbba
5 changed files with 26 additions and 26 deletions
|
@ -141,14 +141,14 @@ SermouseDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) return mtNone;
|
if (!NT_SUCCESS(Status)) return mtNone;
|
||||||
|
|
||||||
/* Reset UART */
|
/* Reset UART */
|
||||||
CHECKPOINT;
|
TRACE_(SERMOUSE, "Reset UART\n");
|
||||||
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
|
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||||
&Mcr, sizeof(Mcr), NULL, NULL);
|
&Mcr, sizeof(Mcr), NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Set communications parameters */
|
/* Set communications parameters */
|
||||||
CHECKPOINT;
|
TRACE_(SERMOUSE, "Set communications parameters\n");
|
||||||
/* DLAB off */
|
/* DLAB off */
|
||||||
Fcr = 0;
|
Fcr = 0;
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
||||||
|
@ -168,7 +168,7 @@ SermouseDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Flush receive buffer */
|
/* Flush receive buffer */
|
||||||
CHECKPOINT;
|
TRACE_(SERMOUSE, "Flush receive buffer\n");
|
||||||
Command = SERIAL_PURGE_RXCLEAR;
|
Command = SERIAL_PURGE_RXCLEAR;
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||||
&Command, sizeof(Command), NULL, NULL);
|
&Command, sizeof(Command), NULL, NULL);
|
||||||
|
@ -177,7 +177,7 @@ SermouseDetectLegacyDevice(
|
||||||
Wait(100);
|
Wait(100);
|
||||||
|
|
||||||
/* Enable DTR/RTS */
|
/* Enable DTR/RTS */
|
||||||
CHECKPOINT;
|
TRACE_(SERMOUSE, "Enable DTR/RTS\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -186,7 +186,7 @@ SermouseDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Set timeout to 500 microseconds */
|
/* Set timeout to 500 microseconds */
|
||||||
CHECKPOINT;
|
TRACE_(SERMOUSE, "Set timeout to 500 microseconds\n");
|
||||||
Timeouts.ReadIntervalTimeout = 100;
|
Timeouts.ReadIntervalTimeout = 100;
|
||||||
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
Timeouts.ReadTotalTimeoutConstant = 500;
|
Timeouts.ReadTotalTimeoutConstant = 500;
|
||||||
|
@ -196,7 +196,7 @@ SermouseDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Fill the read buffer */
|
/* Fill the read buffer */
|
||||||
CHECKPOINT;
|
TRACE_(SERMOUSE, "Fill the read buffer\n");
|
||||||
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
|
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,8 @@ SermouseDeviceWorker(
|
||||||
&ioStatus);
|
&ioStatus);
|
||||||
if (!Irp)
|
if (!Irp)
|
||||||
{
|
{
|
||||||
/* no memory actually, try later */
|
/* No memory actually, try later */
|
||||||
CHECKPOINT;
|
INFO_(SERMOUSE, "No memory actually, trying again\n");
|
||||||
KeStallExecutionProcessor(10);
|
KeStallExecutionProcessor(10);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ SerenumDetectPnpDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* 1. COM port initialization, check for device enumerate */
|
/* 1. COM port initialization, check for device enumerate */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "COM port initialization, check for device enumerate\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -263,7 +263,7 @@ SerenumDetectPnpDevice(
|
||||||
if ((Msr & SERIAL_DSR_STATE) == 0) goto DisconnectIdle;
|
if ((Msr & SERIAL_DSR_STATE) == 0) goto DisconnectIdle;
|
||||||
|
|
||||||
/* 2. COM port setup, 1st phase */
|
/* 2. COM port setup, 1st phase */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "COM port setup, 1st phase\n");
|
||||||
BaudRate = 1200;
|
BaudRate = 1200;
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
||||||
&BaudRate, sizeof(BaudRate), NULL, 0);
|
&BaudRate, sizeof(BaudRate), NULL, 0);
|
||||||
|
@ -287,7 +287,7 @@ SerenumDetectPnpDevice(
|
||||||
Wait(200);
|
Wait(200);
|
||||||
|
|
||||||
/* 3. Wait for response, 1st phase */
|
/* 3. Wait for response, 1st phase */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Wait for response, 1st phase\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -303,7 +303,7 @@ SerenumDetectPnpDevice(
|
||||||
if (Size != 0) goto CollectPnpComDeviceId;
|
if (Size != 0) goto CollectPnpComDeviceId;
|
||||||
|
|
||||||
/* 4. COM port setup, 2nd phase */
|
/* 4. COM port setup, 2nd phase */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "COM port setup, 2nd phase\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -317,7 +317,7 @@ SerenumDetectPnpDevice(
|
||||||
Wait(200);
|
Wait(200);
|
||||||
|
|
||||||
/* 5. Wait for response, 2nd phase */
|
/* 5. Wait for response, 2nd phase */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Wait for response, 2nd phase\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -335,7 +335,7 @@ SerenumDetectPnpDevice(
|
||||||
|
|
||||||
/* 6. Collect PnP COM device ID */
|
/* 6. Collect PnP COM device ID */
|
||||||
CollectPnpComDeviceId:
|
CollectPnpComDeviceId:
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Collect PnP COM device ID\n");
|
||||||
Timeouts.ReadIntervalTimeout = 200;
|
Timeouts.ReadIntervalTimeout = 200;
|
||||||
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
Timeouts.ReadTotalTimeoutConstant = 2200;
|
Timeouts.ReadTotalTimeoutConstant = 2200;
|
||||||
|
@ -374,7 +374,7 @@ CollectPnpComDeviceId:
|
||||||
|
|
||||||
/* 7. Verify disconnect */
|
/* 7. Verify disconnect */
|
||||||
VerifyDisconnect:
|
VerifyDisconnect:
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Verify disconnect\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -386,7 +386,7 @@ VerifyDisconnect:
|
||||||
|
|
||||||
/* 8. Connect idle */
|
/* 8. Connect idle */
|
||||||
ConnectIdle:
|
ConnectIdle:
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Connect idle\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -411,7 +411,7 @@ ConnectIdle:
|
||||||
|
|
||||||
/* 9. Disconnect idle */
|
/* 9. Disconnect idle */
|
||||||
DisconnectIdle:
|
DisconnectIdle:
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Disconnect idle\n");
|
||||||
/* FIXME: report to OS device removal, if it was present */
|
/* FIXME: report to OS device removal, if it was present */
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
|
@ -476,14 +476,14 @@ SerenumDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) return Status;
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
|
|
||||||
/* Reset UART */
|
/* Reset UART */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Reset UART\n");
|
||||||
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
|
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||||
&Mcr, sizeof(Mcr), NULL, NULL);
|
&Mcr, sizeof(Mcr), NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Set communications parameters */
|
/* Set communications parameters */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Set communications parameters\n");
|
||||||
/* DLAB off */
|
/* DLAB off */
|
||||||
Fcr = 0;
|
Fcr = 0;
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
||||||
|
@ -503,7 +503,7 @@ SerenumDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Flush receive buffer */
|
/* Flush receive buffer */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Flush receive buffer\n");
|
||||||
Command = SERIAL_PURGE_RXCLEAR;
|
Command = SERIAL_PURGE_RXCLEAR;
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||||
&Command, sizeof(Command), NULL, NULL);
|
&Command, sizeof(Command), NULL, NULL);
|
||||||
|
@ -512,7 +512,7 @@ SerenumDetectLegacyDevice(
|
||||||
Wait(100);
|
Wait(100);
|
||||||
|
|
||||||
/* Enable DTR/RTS */
|
/* Enable DTR/RTS */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Enable DTR/RTS\n");
|
||||||
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
Status = DeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
@ -521,7 +521,7 @@ SerenumDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Set timeout to 500 microseconds */
|
/* Set timeout to 500 microseconds */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Set timeout to 500 microseconds\n");
|
||||||
Timeouts.ReadIntervalTimeout = 100;
|
Timeouts.ReadIntervalTimeout = 100;
|
||||||
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
Timeouts.ReadTotalTimeoutConstant = 500;
|
Timeouts.ReadTotalTimeoutConstant = 500;
|
||||||
|
@ -531,7 +531,7 @@ SerenumDetectLegacyDevice(
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
/* Fill the read buffer */
|
/* Fill the read buffer */
|
||||||
CHECKPOINT;
|
TRACE_(SERENUM, "Fill the read buffer\n");
|
||||||
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
|
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
|
||||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ SerialCreate(
|
||||||
|
|
||||||
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
|
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
|
||||||
{
|
{
|
||||||
CHECKPOINT;
|
INFO_(SERIAL, "Not a directory\n");
|
||||||
Status = STATUS_NOT_A_DIRECTORY;
|
Status = STATUS_NOT_A_DIRECTORY;
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,8 +227,8 @@ SerialRead(
|
||||||
return STATUS_PENDING;
|
return STATUS_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* insufficient resources, we can't pend the Irp */
|
/* Insufficient resources, we can't pend the Irp */
|
||||||
CHECKPOINT;
|
INFO_(SERIAL, "Insufficient resources\n");
|
||||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, ULongToPtr(DeviceExtension->ComPort));
|
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, ULongToPtr(DeviceExtension->ComPort));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue