I am a novice to USB driver development, and modifying Windows’s DDK usbsamp demo (testapp.exe and usbsamp.sys) to send vendor requests so that Snoopy will identify a packet as 0x0019 VENDOR_ENDPOINT, but all I can ever get is 0x0008 CONTROL_TRANSFER.
I am trying everything I can with UsbBuildVendorRequest(pUrb, URB_FUNCTION_VENDOR_ENDPOINT, …) and DeviceIoControl(handle, …) in the testapp, and WdfMemoryCreatePreallocated(…), WdfUsbTargetDeviceFormatRequestForControlTransfer(…), and WdfUsbTargetDeviceSendControlTransferSynchronously(…) from the driver, but I don’t know what I’m doing, and nothing I’ve tried works. Also, which way is “up” and which way is “down”?
xxxxx@juno.com wrote:
I am a novice to USB driver development, and modifying Windows’s DDK usbsamp demo (testapp.exe and usbsamp.sys) to send vendor requests so that Snoopy will identify a packet as 0x0019 VENDOR_ENDPOINT, but all I can ever get is 0x0008 CONTROL_TRANSFER.
Those are not packet types. Those are URB request codes. URBs are just
a way of making requests of the host controller driver. The URB will be
translated into the actual packet type for transmission on the wire.
All of these URBs are just simple control transfers (in fact, 3/4 of the
URB codes are just simple control transfers):
URB_FUNCTION_VENDOR_DEVICE
URB_FUNCTION_VENDOR_INTERFACE
URB_FUNCTION_VENDOR_ENDPOINT
URB_FUNCTION_VENDOR_OTHER
URB_FUNCTION_CLASS_DEVICE
URB_FUNCTION_CLASS_INTERFACE
URB_FUNCTION_CLASS_ENDPOINT
URB_FUNCTION_CLASS_OTHER
The ONLY difference between those is the number that eventually ends up
in the bmRequestType byte of the control transfer packet.
I am trying everything I can with UsbBuildVendorRequest(pUrb, URB_FUNCTION_VENDOR_ENDPOINT, …) and DeviceIoControl(handle, …) in the testapp, and WdfMemoryCreatePreallocated(…), WdfUsbTargetDeviceFormatRequestForControlTransfer(…), and WdfUsbTargetDeviceSendControlTransferSynchronously(…) from the driver, but I don’t know what I’m doing, and nothing I’ve tried works.
How are you defining “works”? If you are trying to send a vendor
request to an endpoint, then the request code you have is correct.
However, you should not be doing UsbBuildVendorRequest in your
application. That should be in your driver.
Is there a reason you can’t use WinUSB for this? That way, you don’t
need a driver at all.
Also, which way is “up” and which way is “down”?
Where do you see those terms? USB uses the terms IN and OUT, always
from the point of view of the host. A host->device transfer is OUT, a
device->host transfer is IN. I can imagine you might talk about
host->device as being “down”, but not in the USB stack.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.