From: KMDF_FW on
Hi, I am writing a KMDF driver to send about 10K data to a USB device.
However, the device only has a interrupt pipe, not bulk write pipe. does
anyone know what is the right approach in sending the data over? I can use api

WdfUsbTargetDeviceSendUrbSynchronously()

to send an URB that contains a vendor command after I fill up the urb using
its UrbControlVendorClassRequest substructure. But I do not think I can use
the same approach in sending data data longer than 8 bytes. I read somewhere
that in cases like this, we need to break up the data stream into smaller
segments and send them over sequnentially. But I did not find any sample KMDF
code in WDF kit for cases like this. The sample available show how to do
read/write for device with ISOChronous or bulkwrite pipe present on the
device.

I would appreciate it if someone can share their thoughts on how to do this.

AT
From: Doron Holan [MS] on
to write data on the INT pipe, use WdfUsbTargetPipeWriteSynchronously (or
WdfUsbTargetPipeFormatRequestForWrite + WdfRequestSend).

Typically you should only use WdfUsbTargetDeviceSendUrbSynchronously when
there is no built in KMDF routine that does what you need. In the case of
sending a vendor command, you can do this

WDF_USB_CONTROL_SETUP_PACKET setup;
WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&setup, <insert your parameters>);

WdfUsbTargetDeviceSendControlTransferSynchronously(usbDevice, ..., &setup,
....);

You do not need to break up the data, the usb core will do this for you,
just write the entire buffer in one shot.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"KMDF_FW" <KMDFFW(a)discussions.microsoft.com> wrote in message
news:97CE50BF-ED67-4223-8C23-E98255389C92(a)microsoft.com...
> Hi, I am writing a KMDF driver to send about 10K data to a USB device.
> However, the device only has a interrupt pipe, not bulk write pipe. does
> anyone know what is the right approach in sending the data over? I can use
> api
>
> WdfUsbTargetDeviceSendUrbSynchronously()
>
> to send an URB that contains a vendor command after I fill up the urb
> using
> its UrbControlVendorClassRequest substructure. But I do not think I can
> use
> the same approach in sending data data longer than 8 bytes. I read
> somewhere
> that in cases like this, we need to break up the data stream into smaller
> segments and send them over sequnentially. But I did not find any sample
> KMDF
> code in WDF kit for cases like this. The sample available show how to do
> read/write for device with ISOChronous or bulkwrite pipe present on the
> device.
>
> I would appreciate it if someone can share their thoughts on how to do
> this.
>
> AT


From: KMDF_FW on
Doron:

Hi, thanks for taking time to answer my Q at late night :)

And here are my further questions:

- many KMDF API's are for IOTarget or UsbTarget. What's the difference
between these
two different kinds of targets?
- I have tried the api WdfUsbTargetPipeWriteSynchronously to send the
request and got the
STATUS_INVALID_DEVICE_REQUEST error. And according to the docu, there are
many
things that can lead to this error. Is there a way we can get KMDF
framework to isolate the
source of problem beside manually verifying each of the potential source?

Thanks.

AT

"Doron Holan [MS]" wrote:

> to write data on the INT pipe, use WdfUsbTargetPipeWriteSynchronously (or
> WdfUsbTargetPipeFormatRequestForWrite + WdfRequestSend).
>
> Typically you should only use WdfUsbTargetDeviceSendUrbSynchronously when
> there is no built in KMDF routine that does what you need. In the case of
> sending a vendor command, you can do this
>
> WDF_USB_CONTROL_SETUP_PACKET setup;
> WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&setup, <insert your parameters>);
>
> WdfUsbTargetDeviceSendControlTransferSynchronously(usbDevice, ..., &setup,
> ....);
>
> You do not need to break up the data, the usb core will do this for you,
> just write the entire buffer in one shot.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "KMDF_FW" <KMDFFW(a)discussions.microsoft.com> wrote in message
> news:97CE50BF-ED67-4223-8C23-E98255389C92(a)microsoft.com...
> > Hi, I am writing a KMDF driver to send about 10K data to a USB device.
> > However, the device only has a interrupt pipe, not bulk write pipe. does
> > anyone know what is the right approach in sending the data over? I can use
> > api
> >
> > WdfUsbTargetDeviceSendUrbSynchronously()
> >
> > to send an URB that contains a vendor command after I fill up the urb
> > using
> > its UrbControlVendorClassRequest substructure. But I do not think I can
> > use
> > the same approach in sending data data longer than 8 bytes. I read
> > somewhere
> > that in cases like this, we need to break up the data stream into smaller
> > segments and send them over sequnentially. But I did not find any sample
> > KMDF
> > code in WDF kit for cases like this. The sample available show how to do
> > read/write for device with ISOChronous or bulkwrite pipe present on the
> > device.
> >
> > I would appreciate it if someone can share their thoughts on how to do
> > this.
> >
> > AT
>
>
>
From: KMDF_FW on
Doron:

Here is another thing that I need to check with you regarding USB device.
To verify the end point of the USB that I works on, I used the USB view from
sdk yesterday, and it's shown that it's an IN pipe of INT type. The part of
info that surprise me is the wMaxPacketSize of the device is 0. Does that
mean the pipe
can not be used for writing data? And there is only one endpoint/pipe for
this device.

thanks.

AT

"Doron Holan [MS]" wrote:

> to write data on the INT pipe, use WdfUsbTargetPipeWriteSynchronously (or
> WdfUsbTargetPipeFormatRequestForWrite + WdfRequestSend).
>
> Typically you should only use WdfUsbTargetDeviceSendUrbSynchronously when
> there is no built in KMDF routine that does what you need. In the case of
> sending a vendor command, you can do this
>
> WDF_USB_CONTROL_SETUP_PACKET setup;
> WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&setup, <insert your parameters>);
>
> WdfUsbTargetDeviceSendControlTransferSynchronously(usbDevice, ..., &setup,
> ....);
>
> You do not need to break up the data, the usb core will do this for you,
> just write the entire buffer in one shot.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "KMDF_FW" <KMDFFW(a)discussions.microsoft.com> wrote in message
> news:97CE50BF-ED67-4223-8C23-E98255389C92(a)microsoft.com...
> > Hi, I am writing a KMDF driver to send about 10K data to a USB device.
> > However, the device only has a interrupt pipe, not bulk write pipe. does
> > anyone know what is the right approach in sending the data over? I can use
> > api
> >
> > WdfUsbTargetDeviceSendUrbSynchronously()
> >
> > to send an URB that contains a vendor command after I fill up the urb
> > using
> > its UrbControlVendorClassRequest substructure. But I do not think I can
> > use
> > the same approach in sending data data longer than 8 bytes. I read
> > somewhere
> > that in cases like this, we need to break up the data stream into smaller
> > segments and send them over sequnentially. But I did not find any sample
> > KMDF
> > code in WDF kit for cases like this. The sample available show how to do
> > read/write for device with ISOChronous or bulkwrite pipe present on the
> > device.
> >
> > I would appreciate it if someone can share their thoughts on how to do
> > this.
> >
> > AT
>
>
>
From: Doron Holan [MS] on
you can only write to an OUT endpoint

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"KMDF_FW" <KMDFFW(a)discussions.microsoft.com> wrote in message
news:DC5C8F99-A1D7-4332-A200-6E2859C7D257(a)microsoft.com...
> Doron:
>
> Here is another thing that I need to check with you regarding USB device.
> To verify the end point of the USB that I works on, I used the USB view
> from
> sdk yesterday, and it's shown that it's an IN pipe of INT type. The part
> of
> info that surprise me is the wMaxPacketSize of the device is 0. Does that
> mean the pipe
> can not be used for writing data? And there is only one endpoint/pipe for
> this device.
>
> thanks.
>
> AT
>
> "Doron Holan [MS]" wrote:
>
>> to write data on the INT pipe, use WdfUsbTargetPipeWriteSynchronously (or
>> WdfUsbTargetPipeFormatRequestForWrite + WdfRequestSend).
>>
>> Typically you should only use WdfUsbTargetDeviceSendUrbSynchronously when
>> there is no built in KMDF routine that does what you need. In the case
>> of
>> sending a vendor command, you can do this
>>
>> WDF_USB_CONTROL_SETUP_PACKET setup;
>> WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR(&setup, <insert your
>> parameters>);
>>
>> WdfUsbTargetDeviceSendControlTransferSynchronously(usbDevice, ...,
>> &setup,
>> ....);
>>
>> You do not need to break up the data, the usb core will do this for you,
>> just write the entire buffer in one shot.
>>
>> d
>>
>> --
>> Please do not send e-mail directly to this alias. this alias is for
>> newsgroup purposes only.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "KMDF_FW" <KMDFFW(a)discussions.microsoft.com> wrote in message
>> news:97CE50BF-ED67-4223-8C23-E98255389C92(a)microsoft.com...
>> > Hi, I am writing a KMDF driver to send about 10K data to a USB device.
>> > However, the device only has a interrupt pipe, not bulk write pipe.
>> > does
>> > anyone know what is the right approach in sending the data over? I can
>> > use
>> > api
>> >
>> > WdfUsbTargetDeviceSendUrbSynchronously()
>> >
>> > to send an URB that contains a vendor command after I fill up the urb
>> > using
>> > its UrbControlVendorClassRequest substructure. But I do not think I can
>> > use
>> > the same approach in sending data data longer than 8 bytes. I read
>> > somewhere
>> > that in cases like this, we need to break up the data stream into
>> > smaller
>> > segments and send them over sequnentially. But I did not find any
>> > sample
>> > KMDF
>> > code in WDF kit for cases like this. The sample available show how to
>> > do
>> > read/write for device with ISOChronous or bulkwrite pipe present on the
>> > device.
>> >
>> > I would appreciate it if someone can share their thoughts on how to do
>> > this.
>> >
>> > AT
>>
>>
>>