Author Topic: Reading and Writing to a USB mass storage Pen drive  (Read 14374 times)

Rajiv

  • Member
  • ***
  • Posts: 3
Reading and Writing to a USB mass storage Pen drive
« on: March 09, 2012, 03:09:56 am »
Hi, I am newe to USB programming. I need to communicate with a USB mass storage device using WINUSB api. Need to perform the folloewing:
1) Read from USB mass storage pen drive.
2)Write data to a USB mass storage pen drive.

Does WinUSB has functions to perform the above ? How can i test these functionalities with a pen drive?

Rajiv

  • Member
  • ***
  • Posts: 3
Re: Reading and Writing to a USB mass storage Pen drive
« Reply #1 on: March 09, 2012, 05:28:25 am »
Also please confirm whether some code needs to be written on the firmware side so that the device can understand the WinUSB commands from host application?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Reading and Writing to a USB mass storage Pen drive
« Reply #2 on: March 09, 2012, 09:12:02 am »
On reading the descriptors from the device, the host PC assigns the mass-storage driver to the device. Thus applications use the file system to read and write to files on the drive. WinUSB is for devices that don't have a class driver available.

Jan

Rajiv

  • Member
  • ***
  • Posts: 3
Re: Reading and Writing to a USB mass storage Pen drive
« Reply #3 on: March 10, 2012, 09:42:51 am »
Thanks for the reply Jan.

So it means that the USB functions will not work with a pen drive? Actually I am developing a host PC application that will communicate with a hardware device which is being developed by another team. So I am trying to test the WinUSB functions with the Pen drive until i get the hardware device but the data transfer methods (control, builk) are not working with the pen drive.
Could you please specify whether the firmware team needs to write some extra code so that the host application can communicate with it using WinUSB functions?

Thanks,
Rajiv

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Reading and Writing to a USB mass storage Pen drive
« Reply #4 on: March 10, 2012, 10:09:44 am »
You might be able manually assign the WinUSB driver via Windows Device Manager, but trying to emulate a mass-storage driver with WinUSB, especially if the final design isn't a mass-storage device, doesn't seem like a productive use of your time.

You need to know what host driver the final device will use. See if the team can provide or suggest a development board that can run whatever firmware the team has so far.

If you just want to experiment with WinUSB, use a device with compatible firmware. See:

http://www.lvr.com/winusb.htm

Jan