Hi,
We are working on USB serial driver using KMDF.
Currently facing issue with communication restore.
Here, test application is opening the com port it got from the driver,
after opening trying to send/write continuous data to the USB device,
in the mean time I restart the USB device, the driver is not getting the write events from the already running test application (i.e. my EvtIOWrite is not getting called second time)
But If I manually exit the “test application” and restarted again, communication is getting resumed.
Do I need to change anywhere for retaining the session from the application?
w.r.t IRP_MJ_CLOSE and IRP_MJ_CREATE ?
Here is my code:
Adddevice:
ntstatus = WdfDeviceInitAssignWdmIrpPreprocessCallback(
DeviceInit,
UsbWdmDeviceFileCreate,
IRP_MJ_CREATE,
NULL, // pointer minor function table
0); // number of entries in the table
ntstatus = WdfDeviceInitAssignWdmIrpPreprocessCallback(
DeviceInit,
UsbWdmFileClose,
IRP_MJ_CLOSE,
NULL, // pointer minor function table
0); // number of entries in the table
In both callbacks UsbWdmDeviceFileCreate and UsbWdmFileClose,
I am just completing the IRP received with status success.
Rest of my AddDevice Callback is:
ntstatus = RtlUnicodeStringPrintf(&deviceName, L"%ws%d",
L"\Device\USBTEST",
currentInstance++);
WdfDeviceInitAssignName(DeviceInit,&deviceName);
WdfDeviceInitSetExclusive(DeviceInit, TRUE);
WdfDeviceInitSetDeviceType(DeviceInit, FILE_DEVICE_SERIAL_PORT);
WdfDeviceInitSetRequestAttributes(DeviceInit, &attributes);
.
.
.
WdfDeviceInitAssignWdmIrpPreprocessCallback
WdfDeviceInitAssignWdmIrpPreprocessCallback
.
.
.
WdfDeviceCreate(&DeviceInit, &attributes, &device);
.