Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > IOCTL_HID_WRITE_REPORT fails

Reply
Fix Vista Errors
Thread Tools Display Modes

IOCTL_HID_WRITE_REPORT fails

 
 
tatsun
Guest
Posts: n/a

 
      12-01-2009



Hi

I am developing the driver based on HidFx2Usb driver source.
Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT.
So I add the following code in this IOCTL process in order to send data to
the USB, but CompleteWriteReport callback routine always called with status =
STATUS_INVALID_PARAMETER (0xc000000d).

I do not know why error occurs.

--- code ---
status = WdfRequestRetrieveInputMemory(Request, &memory);

if (!NT_SUCCESS(status)) {
goto Exit;
}

status = WdfUsbTargetPipeFormatRequestForWrite(
pipe,
Request,
memory,
NULL
);
if (!NT_SUCCESS(status)) {
goto Exit;
}
WdfRequestSetCompletionRoutine(
Request,
CompleteWriteReport,
pipe
);

if (WdfRequestSend(
Request,
WdfUsbTargetPipeGetIoTarget(pipe),
WDF_NO_SEND_OPTIONS
) == FALSE) {
status = WdfRequestGetStatus(Request);
goto Exit;
}

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      12-03-2009
WdfUsbTargetPipeFormatRequestForWrite does not send a
IOCTL_HID_WRITE_REPORT. you need to format the pipe for an IOCTL

d

--

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


"tatsun" <> wrote in message
news:9AC48ED6-AB33-47E4-AF05-...
> Hi
>
> I am developing the driver based on HidFx2Usb driver source.
> Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT.
> So I add the following code in this IOCTL process in order to send data to
> the USB, but CompleteWriteReport callback routine always called with
> status =
> STATUS_INVALID_PARAMETER (0xc000000d).
>
> I do not know why error occurs.
>
> --- code ---
> status = WdfRequestRetrieveInputMemory(Request, &memory);
>
> if (!NT_SUCCESS(status)) {
> goto Exit;
> }
>
> status = WdfUsbTargetPipeFormatRequestForWrite(
> pipe,
> Request,
> memory,
> NULL
> );
> if (!NT_SUCCESS(status)) {
> goto Exit;
> }
> WdfRequestSetCompletionRoutine(
> Request,
> CompleteWriteReport,
> pipe
> );
>
> if (WdfRequestSend(
> Request,
> WdfUsbTargetPipeGetIoTarget(pipe),
> WDF_NO_SEND_OPTIONS
> ) == FALSE) {
> status = WdfRequestGetStatus(Request);
> goto Exit;
> }
>

 
Reply With Quote
 
tatsun
Guest
Posts: n/a

 
      12-04-2009
Thank you Doron

I retrieved the WDFMEMORY from WDFREQUEST as follows,

status = WdfRequestRetrieveInputMemory(Request, &memory);

status is OK, but memory object does not contain buffer information. Because
I added below code and check return value, buffer=NULL.

buffer = WdfMemoryGetBuffer(memory, NULL);

I checked MdlAddress and found the data is stored in MDL. So I retrieved the
buffer and its length successfuly as follows,

Irp = WdfRequestWdmGetIrp(Request);
Buffer = (PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
NormalPagePriority);
BuffLen = Irp->MdlAddress->ByteCount;

After above I add making the new WDFMEMORY object and called
WdfUsbTargetPipeFormatRequestForWrite, then called WdfRequestSend, it success.

Is my method OK ?

Thanks.

"Doron Holan [MSFT]" wrote:

> WdfUsbTargetPipeFormatRequestForWrite does not send a
> IOCTL_HID_WRITE_REPORT. you need to format the pipe for an IOCTL
>
> d
>
> --
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "tatsun" <> wrote in message
> news:9AC48ED6-AB33-47E4-AF05-...
> > Hi
> >
> > I am developing the driver based on HidFx2Usb driver source.
> > Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT.
> > So I add the following code in this IOCTL process in order to send data to
> > the USB, but CompleteWriteReport callback routine always called with
> > status =
> > STATUS_INVALID_PARAMETER (0xc000000d).
> >
> > I do not know why error occurs.
> >
> > --- code ---
> > status = WdfRequestRetrieveInputMemory(Request, &memory);
> >
> > if (!NT_SUCCESS(status)) {
> > goto Exit;
> > }
> >
> > status = WdfUsbTargetPipeFormatRequestForWrite(
> > pipe,
> > Request,
> > memory,
> > NULL
> > );
> > if (!NT_SUCCESS(status)) {
> > goto Exit;
> > }
> > WdfRequestSetCompletionRoutine(
> > Request,
> > CompleteWriteReport,
> > pipe
> > );
> >
> > if (WdfRequestSend(
> > Request,
> > WdfUsbTargetPipeGetIoTarget(pipe),
> > WDF_NO_SEND_OPTIONS
> > ) == FALSE) {
> > status = WdfRequestGetStatus(Request);
> > goto Exit;
> > }
> >

> .
>

 
Reply With Quote
 
Doron Holan [MSFT]
Guest
Posts: n/a

 
      12-04-2009
for IOCTL_HID_WRITE_REPORT, the KMDF APIs used to extract the buffer do not
work b/c hidclass does not follow the standard rules for formatting. you
get the buffer from Irp->UserBuffer which is a pointer to a HID_XFER_PACKET.
the HID_XFER_PACKET contains pointers for the underlying buffer and its
length

d

--

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


"tatsun" <> wrote in message
news:55918E86-C7FC-4E6A-A548-...
> Thank you Doron
>
> I retrieved the WDFMEMORY from WDFREQUEST as follows,
>
> status = WdfRequestRetrieveInputMemory(Request, &memory);
>
> status is OK, but memory object does not contain buffer information.
> Because
> I added below code and check return value, buffer=NULL.
>
> buffer = WdfMemoryGetBuffer(memory, NULL);
>
> I checked MdlAddress and found the data is stored in MDL. So I retrieved
> the
> buffer and its length successfuly as follows,
>
> Irp = WdfRequestWdmGetIrp(Request);
> Buffer = (PUCHAR)MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
> NormalPagePriority);
> BuffLen = Irp->MdlAddress->ByteCount;
>
> After above I add making the new WDFMEMORY object and called
> WdfUsbTargetPipeFormatRequestForWrite, then called WdfRequestSend, it
> success.
>
> Is my method OK ?
>
> Thanks.
>
> "Doron Holan [MSFT]" wrote:
>
>> WdfUsbTargetPipeFormatRequestForWrite does not send a
>> IOCTL_HID_WRITE_REPORT. you need to format the pipe for an IOCTL
>>
>> d
>>
>> --
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "tatsun" <> wrote in message
>> news:9AC48ED6-AB33-47E4-AF05-...
>> > Hi
>> >
>> > I am developing the driver based on HidFx2Usb driver source.
>> > Application call WriteFile() then driver called IOCTL_HID_WRITE_REPORT.
>> > So I add the following code in this IOCTL process in order to send data
>> > to
>> > the USB, but CompleteWriteReport callback routine always called with
>> > status =
>> > STATUS_INVALID_PARAMETER (0xc000000d).
>> >
>> > I do not know why error occurs.
>> >
>> > --- code ---
>> > status = WdfRequestRetrieveInputMemory(Request, &memory);
>> >
>> > if (!NT_SUCCESS(status)) {
>> > goto Exit;
>> > }
>> >
>> > status = WdfUsbTargetPipeFormatRequestForWrite(
>> > pipe,
>> > Request,
>> > memory,
>> > NULL
>> > );
>> > if (!NT_SUCCESS(status)) {
>> > goto Exit;
>> > }
>> > WdfRequestSetCompletionRoutine(
>> > Request,
>> > CompleteWriteReport,
>> > pipe
>> > );
>> >
>> > if (WdfRequestSend(
>> > Request,
>> > WdfUsbTargetPipeGetIoTarget(pipe),
>> > WDF_NO_SEND_OPTIONS
>> > ) == FALSE) {
>> > status = WdfRequestGetStatus(Request);
>> > goto Exit;
>> > }
>> >

>> .
>>

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Install Windows Internet Explorer 8 fails with Error Code E Chuck Windows Update 3 10-23-2009 02:33 AM
Complete PC Backup fails, restore fails differently! Harry Coin Windows Vista Performance 5 11-19-2007 09:42 PM
Vista fails to start after BSOD Dave Wakefield Windows Vista Installation 6 07-12-2007 11:41 PM
TAPI driver setup fails on Vista Christoph Künkel Windows Vista Installation 0 05-07-2007 09:32 AM
USB Flash Drives (thumbdrives) fails to install TonyR Windows Vista Installation 0 02-12-2007 09:53 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59