Author Topic: USB Mass Storage  (Read 14167 times)

Mitch

  • Member
  • ***
  • Posts: 2
USB Mass Storage
« on: October 06, 2012, 11:23:21 pm »
Does Windows send a request to the endpoint device for any file that is requested? Suppose there is an attempt to get a handle on a file that doesn't actually exist on the USB endpoint storage device. Does Windows cache what it believes are the files on the device and use that cache to determine if it exists, or does it always go to the device, returning with a "file not found" error?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB Mass Storage
« Reply #1 on: October 07, 2012, 12:17:17 pm »
I don't know the answer to your question, but in general, after the USB host has enumerated a mass-storage device, it should be the only entity that is writing to the device. If the device firmware wants to change what's on the device, it should indicate MEDIUM NOT PRESENT before doing so. See:

http://www.lvr.com/forum/index.php?topic=293.msg892#msg892
« Last Edit: October 07, 2012, 01:09:17 pm by Jan Axelson »

Mitch

  • Member
  • ***
  • Posts: 2
Re: USB Mass Storage
« Reply #2 on: October 07, 2012, 09:17:47 pm »
That is helpful, thanks. I guess my question should be, how does the host know what is on the device? I have one clue that Windows does not know what is on the device. When an application makes a request to read a file with a path of the device, if the device emulator is stopped then Windows stops and will eventually timeout. Even if the file is known to not exist. That makes it seem that when a request is made for a file with the device path the host has to go to the device and request some information.

I am reading the UMS book and this is what I don't understand. Where is this taking place? For example, in chapter 3 regarding the Mass Storage Class, the host specifies the LBA and the USB communications doesn't know or care about the location of files. So, how does the host know what LBA to request? Does it get a certain LBA w/FAT and then determine from that, for itself, that the file does or does not exist?

Thanks again.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: USB Mass Storage
« Reply #3 on: October 07, 2012, 10:43:33 pm »
The host locates files from the information in the directories. The host knows where to find the root directory, and the root directory points to any subdirectories.

Reading the information each time it's needed is the safest route.