| Details |
Message |
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 11:24 GMT
Toolset None
|
 USB: mounting file systems
Cactus Blip
Hello,
If I mount a USB device on a windows machine, can the device in any
reliable way create files so that they appear on the windows
explorer? I know the device is mounted on Windows so that Windows
should be the one to determine the contents. But is it possible or is
this a clear violation of the rules? what happens if the device
creates a file, resets itself (assuming it can do that by control
over the data lines) to force reenumeration? will Windows see the new
file?
|
|
|
Read-Only
Author Ulrich Behrenbeck
Posted 12-Mar-2009 12:39 GMT
Toolset None
|
 RE: USB: mounting file systems
Ulrich Behrenbeck
Check Keil Samples. It's already there. Look for USB Mass
Storage.
To "notify" Windows that a modified file is available, try a Soft
Dis/Connect Sequence
|
|
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 13:04 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
thanks. I already found it - using an LPC2478. I hope I get it to
work...
|
|
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 13:52 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
Ulrich,
I had a quick look in the data sheet of the LPC2478. Am I correct in
assuming that a hardware change is necessary in order to allow
"softconnect" to work (namely, an external resistor) ?
|
|
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 16:33 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
Ulrich,
I think we have a problem with the hardware here, but anyway: are you
saying the using the USB_Connect function should force a
re-enumeration? I cannot tell as our hardware is probably at
fault...
|
|
|
Read-Only
Author Tsuneo Chinzei
Posted 12-Mar-2009 14:43 GMT
Toolset None
|
 RE: USB: mounting file systems
Tsuneo Chinzei
Windows caches directory and FAT on its side. When the device
alters these blocks on the media without intervention of Windows,
mismatch occurs. Windows will take this mismatch as disk error. When
the device touches to media, unmount the media first.
Emulate SD card reader response for media exchange.
Just after enumeration,
Windows put several SCSI commands to know about the media. In this
sequence, respond to the command as follows.
INQUIRY
- return RMB = 1 (removable)
PREVENT ALLOW MEDIA REMOVAL
- when PREVENT = 00, success this command. when PREVENT = 01, fail
it
With this response, Windows doesn't make write cache. It prevents
disorder caused by unmount.
To unmount the media,
Windows put TEST UNIT READY every 1 sec. Fail this command while
unmounted.
To REQUEST SENSE just after this TEST UNIT READY, return this sense
data
Status = CHECK CONDITION
Sense Key = NOT READY (0x02)
Additional Sense Code = MEDIUM NOT PRESENT (ASC: 0x3A, ASCQ:
0x00)
While unmounted, fail any other SCSI commands, and return
above
After the operation of device side finishes, re-mount the media -
respond to SCSI commands as usual.
Tsuneo
|
|
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 14:48 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
thanks. I am going to try this.
|
|
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 15:13 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
Tsuneo,
which byte in the reply for REQUEST SENSE needs to be set in order
to have Status = CHECK CONDITION ?
Which numerical code is it?
|
|
|
Read-Only
Author Cactus Blip
Posted 12-Mar-2009 15:17 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
And could you please tell me what the format of the reply to
PREVENT ALLOW MEDIA REMOVAL should be?
|
|
|
Read-Only
Author Tsuneo Chinzei
Posted 12-Mar-2009 18:51 GMT
Toolset None
|
 RE: USB: mounting file systems
Tsuneo Chinzei
"which byte in the reply for REQUEST SENSE needs to be set in
order to have Status = CHECK CONDITION ?"
Please ignore it - it make sense just for SCSI device server.
For MSC-BOT, It means TEST UNIT READY command returns fail in its
CSW.
"And could you please tell me what the format of the reply to
PREVENT ALLOW MEDIA REMOVAL should be?"
PREVENT_ALLOW_MEDIUM_REMOVAL spc3r23.pdf(p184)
Recently, T10.org restricted the access to the draft SCSI
specs.
You can still download them from these T11 links, but it will be also
closed sooner or later.
http://www.t11.org/t10/drafts/spc3/spc3r23.pdf
http://www.t11.org/t10/drafts/sbc2/sbc2r16.pdf
http://www.t11.org/t10/drafts/mmc3/mmc3r10.pdf
Tsuneo
|
|
|
Read-Only
Author Cactus Blip
Posted 13-Mar-2009 08:21 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
Tsuneo,
thanks a lot for your help. I'll take it from here.
|
|
|
Read-Only
Author Cactus Blip
Posted 13-Mar-2009 09:39 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
Tsuneo,
I am sorry to bother you again but I am having some trouble
here...when I try to do this
case SCSI_MEDIA_REMOVAL:
if ( (BulkBuf[4] & 3) == 0)
{
CSW.bStatus = CSW_CMD_PASSED;
MSC_SetCSW();
}
else if ( (BulkBuf[4] & 3) == 1)
{
goto fail;
}
I cannot write to the device anymore. I guess I'm doing something
wrong in passing the command, because failing it is the default
behavior and it works. The RMB bit is set to 1. What am I doing wrong
here?
|
|
|
Read-Only
Author Cactus Blip
Posted 13-Mar-2009 11:35 GMT
Toolset None
|
 RE: USB: mounting file systems
Cactus Blip
Tsuneo,
I have one small question left. If I have a device with an HID
interface and a MSC interface, how can I prevent the MSC part to be
mapped to a windows drive unless an HID report of some kind comes
in?
|
|