Author Topic: How to get WinUSB handle of USB Mass Storage Class device (Bulk only transport)  (Read 12141 times)

cgopalg

  • Member
  • ***
  • Posts: 9
Hi,

I'm writing an WinUSB based application.

My device will use a firmware that supports Mass Storage Class or DFU class.

How I can use WinUSB APIs to identify whether the FW running on device supports Mass storage class or DFU class?

I tried getting the handle by accessing the device path using GUID_INTERFACE_DISK (when connected as mass storage device).
CreateFile returns valid handle.

However WinUSB_Initialize API returns error (error not supported).

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
WinUSB is for devices that don't use an available USB class driver. If you don't have a DFU-class driver, you could use WinUSB for that function. To find out if the device is using the mass-storage system, look for it in the available system drives.

cgopalg

  • Member
  • ***
  • Posts: 9
Hi Jan,

Thanks.
Let me rephrase my question as below.

My device supports Mass storage class and DFU class. However both are exclusive (means the firmware running on device can support mass storage or DFU).

I want to develop an application on windows to send some data to the device firmware.
Before sending data, I want to know how my application on windows know what class (mass storage or DFU) the firmware running on device supports.

Can I use winUSB, IOCTL using DeviceIOControl or something else?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Have the application look for the mass-storage device. Use the .NET DriveInfo class, or look for a specific file if that's feasible, etc. 

Or look for the device using USBView:

http://code.msdn.microsoft.com/windowshardware/USBView-sample-application-e3241039

Or just try to access the DFU device if you can do that with your driver.

cgopalg

  • Member
  • ***
  • Posts: 9
Hi Jan,

Thanks for the details. I think the information is useful.