mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
Register GUID_DEVINTERFACE_COMPORT for serial devices
Register GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR for serenum devices Fix some comments svn path=/trunk/; revision=14876
This commit is contained in:
parent
8293cc1006
commit
5c87a8787a
5 changed files with 45 additions and 38 deletions
|
@ -18,11 +18,10 @@ SerenumAddDevice(
|
|||
{
|
||||
PDEVICE_OBJECT Fdo;
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
//UNICODE_STRING SymbolicLinkName;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo);
|
||||
|
||||
|
||||
/* Create new device object */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(FDO_DEVICE_EXTENSION),
|
||||
|
@ -36,27 +35,22 @@ SerenumAddDevice(
|
|||
DPRINT("Serenum: IoCreateDevice() failed with status 0x%08lx\n", Status);
|
||||
return Status;
|
||||
}
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
|
||||
|
||||
/* Register device interface */
|
||||
#if 0 /* FIXME: activate */
|
||||
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, NULL, &SymbolicLinkName);
|
||||
Status = IoRegisterDeviceInterface(
|
||||
Pdo,
|
||||
&GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR,
|
||||
NULL,
|
||||
&DeviceExtension->SerenumInterfaceName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
|
||||
goto ByeBye;
|
||||
IoDeleteDevice(Fdo);
|
||||
return Status;
|
||||
}
|
||||
DPRINT1("Serenum: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
|
||||
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
RtlFreeUnicodeString(&SymbolicLinkName);
|
||||
#endif
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.IsFDO = TRUE;
|
||||
DeviceExtension->Common.PnpState = dsStopped;
|
||||
DeviceExtension->Pdo = Pdo;
|
||||
|
@ -80,13 +74,22 @@ SerenumFdoStartDevice(
|
|||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PCOMMON_DEVICE_EXTENSION DeviceExtension;
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serenum: SerenumFdoStartDevice() called\n");
|
||||
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
ASSERT(DeviceExtension->PnpState == dsStopped);
|
||||
DeviceExtension->PnpState = dsStarted;
|
||||
ASSERT(DeviceExtension->Common.PnpState == dsStopped);
|
||||
|
||||
Status = IoSetDeviceInterfaceState(&DeviceExtension->SerenumInterfaceName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DeviceExtension->Common.PnpState = dsStarted;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ typedef struct _FDO_DEVICE_EXTENSION
|
|||
PDEVICE_OBJECT Pdo;
|
||||
IO_REMOVE_LOCK RemoveLock;
|
||||
|
||||
UNICODE_STRING SerenumInterfaceName;
|
||||
|
||||
PDEVICE_OBJECT AttachedPdo;
|
||||
ULONG Flags;
|
||||
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||
|
@ -122,7 +124,7 @@ SerenumDuplicateUnicodeString(
|
|||
NTSTATUS
|
||||
SerenumInitMultiSzString(
|
||||
OUT PUNICODE_STRING Destination,
|
||||
... /* list of ANSI_STRINGs */);
|
||||
... /* list of PCSZ */);
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWait(
|
||||
|
|
|
@ -45,7 +45,7 @@ SerialCreate(
|
|||
|
||||
if(DeviceExtension->IsOpened)
|
||||
{
|
||||
DPRINT("Serial: COM%lu is already opened", DeviceExtension->ComPort);
|
||||
DPRINT("Serial: COM%lu is already opened\n", DeviceExtension->ComPort);
|
||||
Status = STATUS_ACCESS_DENIED;
|
||||
goto ByeBye;
|
||||
}
|
||||
|
|
|
@ -26,15 +26,14 @@ SerialAddDeviceInternal(
|
|||
NTSTATUS Status;
|
||||
WCHAR DeviceNameBuffer[32];
|
||||
UNICODE_STRING DeviceName;
|
||||
//UNICODE_STRING SymbolicLinkName;
|
||||
static ULONG DeviceNumber = 0;
|
||||
static ULONG ComPortNumber = 1;
|
||||
|
||||
|
||||
DPRINT("Serial: SerialAddDeviceInternal called\n");
|
||||
|
||||
ASSERT(DeviceObject);
|
||||
ASSERT(Pdo);
|
||||
|
||||
|
||||
/* Create new device object */
|
||||
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber);
|
||||
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
|
||||
|
@ -55,23 +54,13 @@ SerialAddDeviceInternal(
|
|||
RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION));
|
||||
|
||||
/* Register device interface */
|
||||
#if 0 /* FIXME: activate */
|
||||
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &SymbolicLinkName);
|
||||
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &DeviceExtension->SerialInterfaceName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoRegisterDeviceInterface() failed with status 0x%08x\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
DPRINT1("Serial: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
|
||||
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
RtlFreeUnicodeString(&SymbolicLinkName);
|
||||
#endif
|
||||
|
||||
|
||||
DeviceExtension->SerialPortNumber = DeviceNumber++;
|
||||
if (pComPortNumber == NULL)
|
||||
DeviceExtension->ComPort = ComPortNumber++;
|
||||
|
@ -254,6 +243,15 @@ SerialPnpStartDevice(
|
|||
return Status;
|
||||
}
|
||||
|
||||
/* Activate serial interface */
|
||||
Status = IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status);
|
||||
IoDeleteSymbolicLink(&LinkName);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Connect interrupt and enable them */
|
||||
Status = IoConnectInterrupt(
|
||||
&DeviceExtension->Interrupt, SerialInterruptService,
|
||||
|
@ -264,6 +262,7 @@ SerialPnpStartDevice(
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serial: IoConnectInterrupt() failed with status 0x%08x\n", Status);
|
||||
IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, FALSE);
|
||||
IoDeleteSymbolicLink(&LinkName);
|
||||
return Status;
|
||||
}
|
||||
|
@ -366,6 +365,7 @@ SerialPnp(
|
|||
IoAcquireRemoveLock
|
||||
IoReleaseRemoveLockAndWait
|
||||
pass request to DeviceExtension-LowerDriver
|
||||
disable interface
|
||||
IoDeleteDevice(Fdo) and/or IoDetachDevice
|
||||
break;
|
||||
}*/
|
||||
|
|
|
@ -100,6 +100,8 @@ typedef struct _SERIAL_DEVICE_EXTENSION
|
|||
CIRCULAR_BUFFER OutputBuffer;
|
||||
KSPIN_LOCK OutputBufferLock;
|
||||
|
||||
UNICODE_STRING SerialInterfaceName;
|
||||
|
||||
/* Current values */
|
||||
UCHAR MCR; /* Base+4, Modem Control Register */
|
||||
UCHAR MSR; /* Base+6, Modem Status Register */
|
||||
|
|
Loading…
Reference in a new issue