From: tatsun on
Hi, all

I am developping the HID minidriver for device (A). It contains USB hub and
another USB HID device (B) is connected. So I want to read data from device
(B) in one driver.

So I refered toaster sample and code the IoRegisterPlugPlayNotification()
for retreive the symbolic link name for device (B). I could get the symbolic
link name in PnP and WdfIoTargetCreate is successfull but WdfIoTargetOpen
fails 0x0c0000001.

Is this method right ?

Please advice.

------------------------------------
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, TARGET_DEVICE_INFO);

status = WdfIoTargetCreate(deviceExtension->WdfDevice,
&attributes,
&ioTarget);
if (!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
"WdfIoTargetCreate failed 0x%x\n", status);
return status;
}

targetDeviceInfo = GetTargetDeviceInfo(ioTarget);
targetDeviceInfo->DeviceExtension = deviceExtension;

WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(
&openParams,
SymbolicLink,
STANDARD_RIGHTS_ALL);

openParams.ShareAccess = FILE_SHARE_READ;
openParams.EvtIoTargetQueryRemove = HidEvtIoTargetQueryRemove;
openParams.EvtIoTargetRemoveCanceled = HidEvtIoTargetRemoveCanceled;
openParams.EvtIoTargetRemoveComplete = HidEvtIoTargetRemoveComplete;


status = WdfIoTargetOpen(ioTarget, &openParams);

if (!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
"WdfIoTargetOpen failed with status 0x%x\n", status);
WdfObjectDelete(ioTarget);
return status;
}

From: Doron Holan [MSFT] on
does device (b) support file handles? what does !wdfkd.wdflogdump <your
driver name> say?

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"tatsun" <tatsun(a)discussions.microsoft.com> wrote in message
news:51B79189-A3BA-48A4-94DA-77DADDA6FBC2(a)microsoft.com...
> Hi, all
>
> I am developping the HID minidriver for device (A). It contains USB hub
> and
> another USB HID device (B) is connected. So I want to read data from
> device
> (B) in one driver.
>
> So I refered toaster sample and code the IoRegisterPlugPlayNotification()
> for retreive the symbolic link name for device (B). I could get the
> symbolic
> link name in PnP and WdfIoTargetCreate is successfull but WdfIoTargetOpen
> fails 0x0c0000001.
>
> Is this method right ?
>
> Please advice.
>
> ------------------------------------
> WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
> TARGET_DEVICE_INFO);
>
> status = WdfIoTargetCreate(deviceExtension->WdfDevice,
> &attributes,
> &ioTarget);
> if (!NT_SUCCESS(status)) {
> TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
> "WdfIoTargetCreate failed 0x%x\n", status);
> return status;
> }
>
> targetDeviceInfo = GetTargetDeviceInfo(ioTarget);
> targetDeviceInfo->DeviceExtension = deviceExtension;
>
> WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(
> &openParams,
> SymbolicLink,
> STANDARD_RIGHTS_ALL);
>
> openParams.ShareAccess = FILE_SHARE_READ;
> openParams.EvtIoTargetQueryRemove = HidEvtIoTargetQueryRemove;
> openParams.EvtIoTargetRemoveCanceled = HidEvtIoTargetRemoveCanceled;
> openParams.EvtIoTargetRemoveComplete = HidEvtIoTargetRemoveComplete;
>
>
> status = WdfIoTargetOpen(ioTarget, &openParams);
>
> if (!NT_SUCCESS(status)) {
> TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
> "WdfIoTargetOpen failed with status 0x%x\n", status);
> WdfObjectDelete(ioTarget);
> return status;
> }
>
From: tatsun on
Thanks Doron

> does device (b) support file handles?

Device (b) does not have my driver and it is displayed as "USB Input Device"
on Device Manager. I can open the device (b) by CreateFile and read data from
the device (b) by user mode application, so I think it supports file handle.

> what does !wdfkd.wdflogdump <your driver name> say?

I tried to display but could not display it. ( Message : Could not retrieve
WDF log header for driver ).

By the way, I found article on release note on the WDK
(C:\WinDDK\7600.16385.0\relnote.htm), it says "KMDF filter driver for HID
device may fail to send I/O". Is it related issue ?

I want to combine the data from device (a) and device (b) without user mode
application.

Thanks.


"Doron Holan [MSFT]" wrote:

> does device (b) support file handles? what does !wdfkd.wdflogdump <your
> driver name> say?
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "tatsun" <tatsun(a)discussions.microsoft.com> wrote in message
> news:51B79189-A3BA-48A4-94DA-77DADDA6FBC2(a)microsoft.com...
> > Hi, all
> >
> > I am developping the HID minidriver for device (A). It contains USB hub
> > and
> > another USB HID device (B) is connected. So I want to read data from
> > device
> > (B) in one driver.
> >
> > So I refered toaster sample and code the IoRegisterPlugPlayNotification()
> > for retreive the symbolic link name for device (B). I could get the
> > symbolic
> > link name in PnP and WdfIoTargetCreate is successfull but WdfIoTargetOpen
> > fails 0x0c0000001.
> >
> > Is this method right ?
> >
> > Please advice.
> >
> > ------------------------------------
> > WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
> > TARGET_DEVICE_INFO);
> >
> > status = WdfIoTargetCreate(deviceExtension->WdfDevice,
> > &attributes,
> > &ioTarget);
> > if (!NT_SUCCESS(status)) {
> > TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
> > "WdfIoTargetCreate failed 0x%x\n", status);
> > return status;
> > }
> >
> > targetDeviceInfo = GetTargetDeviceInfo(ioTarget);
> > targetDeviceInfo->DeviceExtension = deviceExtension;
> >
> > WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(
> > &openParams,
> > SymbolicLink,
> > STANDARD_RIGHTS_ALL);
> >
> > openParams.ShareAccess = FILE_SHARE_READ;
> > openParams.EvtIoTargetQueryRemove = HidEvtIoTargetQueryRemove;
> > openParams.EvtIoTargetRemoveCanceled = HidEvtIoTargetRemoveCanceled;
> > openParams.EvtIoTargetRemoveComplete = HidEvtIoTargetRemoveComplete;
> >
> >
> > status = WdfIoTargetOpen(ioTarget, &openParams);
> >
> > if (!NT_SUCCESS(status)) {
> > TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
> > "WdfIoTargetOpen failed with status 0x%x\n", status);
> > WdfObjectDelete(ioTarget);
> > return status;
> > }
> >
> .
>
From: Abhishek R [MSFT] on
> I tried to display but could not display it. ( Message : Could not
> retrieve
> WDF log header for driver ).
Just to make sure, did you correctly set the TMF file before attempting to
view the log? The extension is !wdftmffile.

"tatsun" <tatsun(a)discussions.microsoft.com> wrote in message
news:365D2DA6-1978-4625-819A-09F94CB11C4C(a)microsoft.com...
> Thanks Doron
>
>> does device (b) support file handles?
>
> Device (b) does not have my driver and it is displayed as "USB Input
> Device"
> on Device Manager. I can open the device (b) by CreateFile and read data
> from
> the device (b) by user mode application, so I think it supports file
> handle.
>
>> what does !wdfkd.wdflogdump <your driver name> say?
>
> I tried to display but could not display it. ( Message : Could not
> retrieve
> WDF log header for driver ).
>
> By the way, I found article on release note on the WDK
> (C:\WinDDK\7600.16385.0\relnote.htm), it says "KMDF filter driver for HID
> device may fail to send I/O". Is it related issue ?
>
> I want to combine the data from device (a) and device (b) without user
> mode
> application.
>
> Thanks.
>
>
> "Doron Holan [MSFT]" wrote:
>
>> does device (b) support file handles? what does !wdfkd.wdflogdump <your
>> driver name> say?
>>
>> --
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "tatsun" <tatsun(a)discussions.microsoft.com> wrote in message
>> news:51B79189-A3BA-48A4-94DA-77DADDA6FBC2(a)microsoft.com...
>> > Hi, all
>> >
>> > I am developping the HID minidriver for device (A). It contains USB hub
>> > and
>> > another USB HID device (B) is connected. So I want to read data from
>> > device
>> > (B) in one driver.
>> >
>> > So I refered toaster sample and code the
>> > IoRegisterPlugPlayNotification()
>> > for retreive the symbolic link name for device (B). I could get the
>> > symbolic
>> > link name in PnP and WdfIoTargetCreate is successfull but
>> > WdfIoTargetOpen
>> > fails 0x0c0000001.
>> >
>> > Is this method right ?
>> >
>> > Please advice.
>> >
>> > ------------------------------------
>> > WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
>> > TARGET_DEVICE_INFO);
>> >
>> > status = WdfIoTargetCreate(deviceExtension->WdfDevice,
>> > &attributes,
>> > &ioTarget);
>> > if (!NT_SUCCESS(status)) {
>> > TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
>> > "WdfIoTargetCreate failed 0x%x\n", status);
>> > return status;
>> > }
>> >
>> > targetDeviceInfo = GetTargetDeviceInfo(ioTarget);
>> > targetDeviceInfo->DeviceExtension = deviceExtension;
>> >
>> > WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(
>> > &openParams,
>> > SymbolicLink,
>> > STANDARD_RIGHTS_ALL);
>> >
>> > openParams.ShareAccess = FILE_SHARE_READ;
>> > openParams.EvtIoTargetQueryRemove = HidEvtIoTargetQueryRemove;
>> > openParams.EvtIoTargetRemoveCanceled = HidEvtIoTargetRemoveCanceled;
>> > openParams.EvtIoTargetRemoveComplete = HidEvtIoTargetRemoveComplete;
>> >
>> >
>> > status = WdfIoTargetOpen(ioTarget, &openParams);
>> >
>> > if (!NT_SUCCESS(status)) {
>> > TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
>> > "WdfIoTargetOpen failed with status 0x%x\n", status);
>> > WdfObjectDelete(ioTarget);
>> > return status;
>> > }
>> >
>> .
>>