Driver installation

Hi,

Can I install one driver as a lower filter driver for one device and a function driver for another device? I did this on pre Win10 and it worked fine. However, when I did the same thing on Win10, an issue after the unplug the device happened - the two device nodes don’t disappear from the device manager. Instead, there’re two yellow marks on the device nodes. So I’m wondering whether Win10 doesn’t allow this? Debugging into my code, I don’t see my EvtDeviceContextCleanup and EvtDriverContextCleanup get called. Any ideas?

Thanks,
Marshall

One more clue - if I installed the driver on only one of devices, then the device can be removed successfully after unplugging the device.

Same INF or 2 INFs installing the driver file to disk?

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@hotmail.com
Sent: Wednesday, August 26, 2015 6:40 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Driver installation

One more clue - if I installed the driver on only one of devices, then the device can be removed successfully after unplugging the device.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Hi Doron,

I used two different INF to install them. But the latest finding is that the issue happens even if I only install the driver on the HID Game Controller as the function driver. However, if I only install the driver on other HID devices which is non HID Game Controller, then the issue doesn’t happen.

Currently, I’ve modified the driver to do nothing more than setup a Read queue but the issue still happens. It only happens on Win10 no other OS. It looks the HID device nodes can’t be removed after unplugging the device.

BR,
Marshall

Did you look in setupapi.dev.log for any hints?

Sent from Outlook Mailhttp: for Windows 10

From: xxxxx@hotmail.com
Sent: Wednesday, August 26, 2015 9:19 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Driver installation

Hi Doron,

I used two different INF to install them. But the latest finding is that the issue happens even if I only install the driver on the HID Game Controller as the function driver. However, if I only install the driver on other HID devices which is non HID Game Controller, then the issue doesn’t happen.

Currently, I’ve modified the driver to do nothing more than setup a Read queue but the issue still happens. It only happens on Win10 no other OS. It looks the HID device nodes can’t be removed after unplugging the device.

BR,
Marshall


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</http:>

Hi Doron,

No log information is generated into the setupapi.dev.log file if I unplug the device from the Win10 machine. After isolating the code, I finally found setting up the EvtIoRead cause the problem.

WDF_IO_QUEUE_CONFIG_INIT(
&queueConfig,
WdfIoQueueDispatchSequential
);
queueConfig.EvtIoRead = Bthxbus_EvtIoRead;

status = WdfIoQueueCreate(
hDevice,
&queueConfig,
&attributes,
&hQueue
);
IfFailGoToExit(status, BTHX_BUS, “WdfIoQueueCreate for read failed”);

status = WdfDeviceConfigureRequestDispatching(
hDevice,
hQueue,
WdfRequestTypeRead
);
IfFailGoToExit(status, BTHX_BUS, “WdfDeviceConfigureRequestDispatching for read failed”);

VOID
Bthxbus_EvtIoRead(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t Length
)
{
WDFDEVICE hDevice = NULL;
WDFIOTARGET hIoTarget = NULL;

UNREFERENCED_PARAMETER(Length);

BthxTraceFuncEntry();

hDevice = WdfIoQueueGetDevice(Queue);
hIoTarget = WdfDeviceGetIoTarget(hDevice);

WdfRequestFormatRequestUsingCurrentType(Request);
WdfRequestSetCompletionRoutine(Request, Bthxbus_EvtIoReadComplete, hDevice);
if (WdfRequestSend(Request, hIoTarget, NULL) == FALSE)
{
WdfRequestSetCompletionRoutine(Request, NULL, NULL);
WdfRequestComplete(Request, WdfRequestGetStatus(Request));
}

BthxTraceFuncExit();
}

VOID
Bthxbus_EvtIoReadComplete(
IN WDFREQUEST Request,
IN WDFIOTARGET Target,
IN PWDF_REQUEST_COMPLETION_PARAMS Params,
IN WDFCONTEXT Context
)
{
NTSTATUS status = Params->IoStatus.Status;
WDFDEVICE hDevice = Context;
WDFREQUEST hRequest = NULL;
PBTHXBUS_DEVICE_CONTEXT pDeviceContext = Bthxbus_GetDeviceContext(hDevice);
LONG lEnableHid = FALSE;
PMDL pMdl = NULL;
PUCHAR pbBuffer = NULL;
ULONG ulIndex = 0;
BOOLEAN bComplete = TRUE;
BOOLEAN bDown = FALSE;

UNREFERENCED_PARAMETER(Target);

BthxTraceFuncEntry();
… …
if (bComplete == TRUE)
{
WdfRequestComplete(Request, status);
}

BthxTraceFuncExit();
}

Hi Doron,

Do you know why? The issue only happens on Win10. Per my observation, some system process also sends the Read request to the HID Game Controller. Maybe my code doesn’t make sense in this case.

Really appreciate your help,

Marshall