Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > How to send setup packet to USB control end point
Ask a questionAsk a question
 

AnswerHow to send setup packet to USB control end point

  • Thursday, November 05, 2009 6:27 AMMojo George Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have a USB device which has only one interface  that of USB mass storage. I need to send vendor specific data to the device as USB setup packets. How can I do this?

    I could not find any IOCTL command for that except some for querryng informtion like descriptor.

    I tried to send USBUSER_OP_SEND_ONE_PACKET request. But it fails with error - UsbUserFeatureDisabled.  This error may be due to following reason. In usbuser.h, it has already been stated that USBUSER_OP_SEND_ONE_PACKET enabled when the devlopr key is set in the registry. I could not find such a key and not sure where to add this.

    Note : I could do this using "LibUsb-Win32" filter driver and its library. but I need to do this without a filter driver.

Answers

  • Saturday, November 07, 2009 1:51 PMSheng Jiang 蒋晟MVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    1 you can not send arbitrary control code without knowing the device type. If the device does not validate inputs, unexpected behavior can happen, including hardware damage.
    2 VC is not supported for driver development. If you need help in DDK, post to a DDK newsgroup.


    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP

All Replies

  • Thursday, November 05, 2009 6:41 PMSheng Jiang 蒋晟MVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It is not the bus who send you response. It is the hardware who send the response. the USB cable is just a bridge. Contact the manufacture of the hardware if you want to know what kind of IO codes are supported by the hardware.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
  • Saturday, November 07, 2009 9:42 AMMojo George Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    1. 

    I want to send only USB setup packet to control end point of the device. I was able to do this with the help of a filter driver to the same device. But I need to do without a filter driver. How do I do this from a user mode application?

    2.
    In usbuser.h, it has been stated that USBUSER_OP_SEND_ONE_PACKET enabled when the devlopr key is set in the registry. I could not find such a key and not sure where to add this. Any help on this?
  • Saturday, November 07, 2009 1:51 PMSheng Jiang 蒋晟MVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    1 you can not send arbitrary control code without knowing the device type. If the device does not validate inputs, unexpected behavior can happen, including hardware damage.
    2 VC is not supported for driver development. If you need help in DDK, post to a DDK newsgroup.


    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP