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

Re: Q about sending 10k of data to USB device. by Doron

Doron
Mon Apr 23 00:52:22 CDT 2007

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@discussions.microsoft.com> wrote in message
news:97CE50BF-ED67-4223-8C23-E98255389C92@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



Re: Q about sending 10k of data to USB device. by KMDFFW

KMDFFW
Mon Apr 23 12:22:01 CDT 2007

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@discussions.microsoft.com> wrote in message
> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
>
>
>

Re: Q about sending 10k of data to USB device. by KMDFFW

KMDFFW
Mon Apr 23 12:34:01 CDT 2007

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@discussions.microsoft.com> wrote in message
> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
>
>
>

Re: Q about sending 10k of data to USB device. by Doron

Doron
Tue Apr 24 00:11:21 CDT 2007

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@discussions.microsoft.com> wrote in message
news:DC5C8F99-A1D7-4332-A200-6E2859C7D257@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@discussions.microsoft.com> wrote in message
>> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
>>
>>
>>



Re: Q about sending 10k of data to USB device. by Doron

Doron
Tue Apr 24 00:11:51 CDT 2007

USB io targets are a superset of the normal io targets. they add additional
formatting funcationality, but the sending and tracking of io remains the
same

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@discussions.microsoft.com> wrote in message
news:96CB90C0-806A-4013-ADD4-15EBAC7FC4C3@microsoft.com...
> 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@discussions.microsoft.com> wrote in message
>> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
>>
>>
>>



Re: Q about sending 10k of data to USB device. by Tim

Tim
Tue Apr 24 01:14:43 CDT 2007

KMDF_FW <KMDFFW@discussions.microsoft.com> wrote:
>
>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.

This means you are looking at "alternate setting zero". Interrupt and
isochronous pipes cause bandwidth to be reserved. If there isn't enough
bandwidth available, the pipe is not allowed to become active. Because of
that, the default interface ("alternate setting zero") is required to have
wMaxPacketSize = 0, so it can always be activated.

Your device will also have other alternate setttings that have
wMaxPacketsize > 0. You just have to choose one of those alternate
settings (using USB_FUNCTION_SELECT_INTERFACE) before you start reading
data.

However, I thought you said you wanted to SEND data? USB endpoints go in
one direction only. An "IN" pipe transfers from the device to the host. To
send data, you need to use an "OUT" pipe.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: Q about sending 10k of data to USB device. by KMDFFW

KMDFFW
Tue Apr 24 13:58:03 CDT 2007

Doron:

As for using API WdfUsbTargetDeviceSendControlTransferSynchronously() to
send vendor
command to USB device, I tried it and got an error status of 0xc0000004,
which is the
STATUS_INFO_LENGTH_MISMATCH, where "The specified information record length
does not match the length required for the specified information class."
After checking the memory
descriptor that I used for the control transfer, I did not see an error. Do
you know how this error can be generated?

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@discussions.microsoft.com> wrote in message
> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
>
>
>

Re: Q about sending 10k of data to USB device. by Doron

Doron
Tue Apr 24 23:22:32 CDT 2007

did you initialize the setup packet using the INIT() routine? in general,
you can use KMDF's log (accessible via !wdfkd.wdflogdump) to see what the
error is, read http://blogs.msdn.com/doronh/archive/2006/07/31/684531.aspx
for more info and links on how to use this extension command

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@discussions.microsoft.com> wrote in message
news:A37F470D-1AD1-4502-BC7C-490220AA93A5@microsoft.com...
> Doron:
>
> As for using API WdfUsbTargetDeviceSendControlTransferSynchronously() to
> send vendor
> command to USB device, I tried it and got an error status of 0xc0000004,
> which is the
> STATUS_INFO_LENGTH_MISMATCH, where "The specified information record
> length
> does not match the length required for the specified information class."
> After checking the memory
> descriptor that I used for the control transfer, I did not see an error.
> Do
> you know how this error can be generated?
>
> 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@discussions.microsoft.com> wrote in message
>> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
>>
>>
>>



Re: Q about sending 10k of data to USB device. by KMDFFW

KMDFFW
Wed Apr 25 19:14:01 CDT 2007

Doron:

Thanks for the useful link. And I did the initialization for the setup packet.
Later on I found the error that I encountered was caused by incorrect
data flow direction specified.

Meanwhile, I am wondering whether there is a corresponding kernel API
like Sleep() from user mode? I know there are timer object defined in kernel
mode, but it's kind of overkill for my situation as I just want to have
something
like Sleep(30) since my device is not able to process incoming data fast
enough.

Thanks.

AT
"Doron Holan [MS]" wrote:

> did you initialize the setup packet using the INIT() routine? in general,
> you can use KMDF's log (accessible via !wdfkd.wdflogdump) to see what the
> error is, read http://blogs.msdn.com/doronh/archive/2006/07/31/684531.aspx
> for more info and links on how to use this extension command
>
> 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@discussions.microsoft.com> wrote in message
> news:A37F470D-1AD1-4502-BC7C-490220AA93A5@microsoft.com...
> > Doron:
> >
> > As for using API WdfUsbTargetDeviceSendControlTransferSynchronously() to
> > send vendor
> > command to USB device, I tried it and got an error status of 0xc0000004,
> > which is the
> > STATUS_INFO_LENGTH_MISMATCH, where "The specified information record
> > length
> > does not match the length required for the specified information class."
> > After checking the memory
> > descriptor that I used for the control transfer, I did not see an error.
> > Do
> > you know how this error can be generated?
> >
> > 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@discussions.microsoft.com> wrote in message
> >> news:97CE50BF-ED67-4223-8C23-E98255389C92@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
> >>
> >>
> >>
>
>
>

Re: Q about sending 10k of data to USB device. by KMDFFW

KMDFFW
Wed Apr 25 19:24:01 CDT 2007

Tim:

Hi, thanks for the detailed explaination. I was able to achieve what I need
to do
with the driver by sending the data as part of a vendor command.

AT

"Tim Roberts" wrote:

> KMDF_FW <KMDFFW@discussions.microsoft.com> wrote:
> >
> >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.
>
> This means you are looking at "alternate setting zero". Interrupt and
> isochronous pipes cause bandwidth to be reserved. If there isn't enough
> bandwidth available, the pipe is not allowed to become active. Because of
> that, the default interface ("alternate setting zero") is required to have
> wMaxPacketSize = 0, so it can always be activated.
>
> Your device will also have other alternate setttings that have
> wMaxPacketsize > 0. You just have to choose one of those alternate
> settings (using USB_FUNCTION_SELECT_INTERFACE) before you start reading
> data.
>
> However, I thought you said you wanted to SEND data? USB endpoints go in
> one direction only. An "IN" pipe transfers from the device to the host. To
> send data, you need to use an "OUT" pipe.
> --
> Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>

Re: Q about sending 10k of data to USB device. by Maxim

Maxim
Thu Apr 26 05:57:43 CDT 2007

> Meanwhile, I am wondering whether there is a corresponding kernel API
> like Sleep() from user mode?

KeDelayExecutionThread

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com