Hello All,
I get stuck on this one,
I have:
an Embedded Artists LPC1788 cortex-m3 developers board. using TCP-net and Flash-fs and RTX kernel i've managed to use all TCP functions (in tasks, like TCP sockets, TFTP server, HTTP) and also using my microSD card (2 GB sandisk) with FAT etc. I have USB mass storage class working that directly can access my microsd card. so in windows i get a disk that has 2 GB size with my files. (yeah it works :D )
Now I want to make it write protect for windows, I want read access to the microSD in windows, but the user may not delete or manipulate the data. At this time I made in mscuser.c that the functions MSC_MemoryWrite and MSC_MemoryVerify don't access the microSD. In windows I can read the microSD now, but when I write/delete files it is only in the cache of windows. when I unplug and plug in my device, I see my original microSD again.
what do I want: ok what I have can work.. but I want that windows knows that my microSD is an write protected device, so that you'll get an error if you try to write of delete files.
my device may access the microSD to store files by himself (logging) but only by USB mass storage it must be blocked.
Is there any way to set this? like in the function MSC_Inquiry, maybe some parameter of bulbuf?
I hope that someone can help me with this.
Greetings,
Wouter
I suspect you're substantially underestimating the scope of the problem you've created there.
Even reading that file system from the Windows side won't work reliably while you're secretly also writing to it behind Windows' back. Windows strictly assumes itself to be the only system accessing those files. It may appear to work, but ultimately it won't.
Dear Hans-Bernhard,
I know that you may not manipulate the microSD at the same time. In my code I check if the USB is connected otherwise the ARM will not access the microSD by himself. Like your Android mobile phone. If you connect the phone to your pc and you want mass storage access, the microSD will be unmounted (MCU cannot access the microSD directly anymore).
your sdcard reader must check if the write protect is on (SD-card switch on the left side). it must say in some way to windows that it is write protected.
my only question is: How can I say to windows that a USB mass storage device is write protected (read only)
regards,
Maybe there is a SCSI command for that - I don't know if that code is available anymore with the recent "let hide everything that we can make money with" move by Keil (oh, yeah). Either way, you can always power down USB while addressing the SD card from the microcontroller side, remounting later.
<quote>"let hide everything that we can make money with" move by Keil (oh, yeah).</quote>
Tapeer,
yew are a cynic.
in case yoo donot understand plz check hear
dictionary.reference.com/.../cynic
Always yo're freind.
Zeusti
Hi,
I've got it working, my mass storage device is now write protected. Searched for SCSI commands with write protection parameters, but this didn't work.
just comment out the SCSI_WRITE10 and SCSI_WRITE12 commands in function MSC_GetCBW in mscuser.c if windows tries a write command, it will go to fail. Windows then responds that it is write protected!
Yes, I thought it would be something like that. Congratulations.
<quote>Yes, I thought it would be something like that.</quote>
LMFAO
and to disable deleting (you can't write so delete would not work, but you'll get no message and file goes away) you must edit the MSC_ModeSense10 and MSC_ModeSense6 parameters with write protection for modesense10 it is byte 3 bit 8, for modesense6 it is byte 2 bit 8 (found on internet)
now you can uncomment the write functions too, because windows will see that the device is write protected, and when deleting it will give also a "write protected" error
Wouter ,
I don't have time to check but I'm curious - is it possible to make a transaction "write only" ?
Tamir,
Ehm, that would be strange, think that you won't be able to see the microSD FAT and files, but in windows you should can open the microSD and write something on the microSD which you can't see?
hope you understand me, but in my opinion that is strange.
I'll test a little thing but I don't think it's going to work.
It seems then that the same SCSI commands are used to deliver file system image details as are used to deliver data. I thought there might be a way to coax a device to reveal its file system structure, but not to allow read access to the content of the file system.
Then you should look at the USB bootloader examples with CRP. when CRP is enabled, the mass storage device is loaded but you can't read the file (firmware), you can only update it. looking at the code in the read function it returns 0x00 each byte if CRP 2 or 3 is enabled. but the FAT system is static here, don't know how to do it on your sdcard which is dynamic.