Hello!

I am trying to use the usb function driver with the mass storage class
and am losing my RAMDISK folder on my device once I attach the USB
cable and the UsbMsFn STORE_Init function is called.

Here is the debug from after I attach my USB cable to the host and the
STORE_Init() function is called:

344138 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
DeviceName = DSK1:

344143 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
Removable = 1

344146 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
IOCTL_DISK_GETINFO passed

344146 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
bytes per sector = 512

344146 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
cylinders = 0

344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
flags = 0xa

344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
heads = 0

344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
sectors = 2

344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
total sectors = 64

344151 PID:3ec4432 TID:e3c7bd92 0x83c747f0:
FSD_UnmountDisk(0x1c6700): unmounting...

344151 PID:3ec4432 TID:e3c7bd92 0x83c747f0: FATFS!UnmountDisk:
unmounting all volumes on disk 001C6700

344155 PID:3ec4432 TID:e3c7bd92 0x83c747f0: <<< Unloading module
diskcache.dll at address 0x03E80000-0x03E89000 (RW data at
0x01FF2000-0x01FF24F4)

Unloaded symbols for 'D:\WINCE500\PBWORKSPACES\VESTA\RELDIR
\KSO_ARMV4I_DEBUG\DISKCACHE.DLL'

344157 PID:3ec4432 TID:e3c7bd92 0x83c747f0: FATFS!FATDetach complete
(0 sectors written in 0 requests)

344158 PID:3ec4432 TID:e3c7bd92 0x83c747f0: <<< Unloading module
fatfsd.dll at address 0x03E90000-0x03EBB000 (RW data at
0x01FF4000-0x01FF463C)

Unloaded symbols for 'D:\WINCE500\PBWORKSPACES\VESTA\RELDIR
\KSO_ARMV4I_DEBUG\FATFSD.DLL'

As I said, I am using RAMDISK and already have my DSK1: device with
the "Storage Card" folder available on my device. The STORE_Init()
function calls OpenStore() and then an IOCTL to GETINFO and then a
DismountStore() function call. Does anyone know why this function
would want to dismount the store? The STORE_Close() function also
calls for the dismount, but that makes sense. Once the
DismountStore() function is called, my "Storage Card" folder goes
away. Can anyone explain this to me? Is this a bug with that
sample? Or am I just doing something wrong?

I am using the Microsoft provided
\\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\USBFN\CLASS\STORAGE
implementation and the STORE_Init() function in \STORAGE\EMULATION
\SCSI2\BLOCK\block.cpp and basing my function driver on the mainstone
II implementation.

I still have not seen my host PC acknowledge my device regardless of
whether I allow the dismount to be called or not and will try a USB
analyzer next to look at what is going on there.

Any help would be greatly appreciated!!

Thanks,
Vanessa

Re: usb function mass storage class - RAMDISK folder goes away after usb attach by Mike

Mike
Fri Mar 14 01:38:00 PDT 2008

vsanchez@vocollect.com wrote in news:b3342e92-1220-4518-9b63-
3b0dd9118a42@n58g2000hsf.googlegroups.com:

> Hello!
>
> I am trying to use the usb function driver with the mass storage class
> and am losing my RAMDISK folder on my device once I attach the USB
> cable and the UsbMsFn STORE_Init function is called.
>
> Here is the debug from after I attach my USB cable to the host and the
> STORE_Init() function is called:
>
> 344138 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> DeviceName = DSK1:
>
> 344143 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> Removable = 1
>
> 344146 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> IOCTL_DISK_GETINFO passed
>
> 344146 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> bytes per sector = 512
>
> 344146 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> cylinders = 0
>
> 344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> flags = 0xa
>
> 344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> heads = 0
>
> 344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> sectors = 2
>
> 344147 PID:c3e49bae TID:e3c7bd92 0x83c747f0: UsbMsFn!STORE_Init:
> total sectors = 64
>
> 344151 PID:3ec4432 TID:e3c7bd92 0x83c747f0:
> FSD_UnmountDisk(0x1c6700): unmounting...
>
> 344151 PID:3ec4432 TID:e3c7bd92 0x83c747f0: FATFS!UnmountDisk:
> unmounting all volumes on disk 001C6700
>
> 344155 PID:3ec4432 TID:e3c7bd92 0x83c747f0: <<< Unloading module
> diskcache.dll at address 0x03E80000-0x03E89000 (RW data at
> 0x01FF2000-0x01FF24F4)
>
> Unloaded symbols for 'D:\WINCE500\PBWORKSPACES\VESTA\RELDIR
> \KSO_ARMV4I_DEBUG\DISKCACHE.DLL'
>
> 344157 PID:3ec4432 TID:e3c7bd92 0x83c747f0: FATFS!FATDetach complete
> (0 sectors written in 0 requests)
>
> 344158 PID:3ec4432 TID:e3c7bd92 0x83c747f0: <<< Unloading module
> fatfsd.dll at address 0x03E90000-0x03EBB000 (RW data at
> 0x01FF4000-0x01FF463C)
>
> Unloaded symbols for 'D:\WINCE500\PBWORKSPACES\VESTA\RELDIR
> \KSO_ARMV4I_DEBUG\FATFSD.DLL'
>
> As I said, I am using RAMDISK and already have my DSK1: device with
> the "Storage Card" folder available on my device. The STORE_Init()
> function calls OpenStore() and then an IOCTL to GETINFO and then a
> DismountStore() function call. Does anyone know why this function
> would want to dismount the store? The STORE_Close() function also
> calls for the dismount, but that makes sense. Once the
> DismountStore() function is called, my "Storage Card" folder goes
> away. Can anyone explain this to me? Is this a bug with that
> sample? Or am I just doing something wrong?
>
> I am using the Microsoft provided
> \\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\USBFN\CLASS\STORAGE
> implementation and the STORE_Init() function in \STORAGE\EMULATION
> \SCSI2\BLOCK\block.cpp and basing my function driver on the mainstone
> II implementation.
>
> I still have not seen my host PC acknowledge my device regardless of
> whether I allow the dismount to be called or not and will try a USB
> analyzer next to look at what is going on there.
>
> Any help would be greatly appreciated!!
>
> Thanks,
> Vanessa
>
>

Hi Vanessa,

the USB function mass storage class driver needs a physical block device
to work correctly and for that reason uses your RAMDisk. Have a look
into the registry of the mass storage class driver and you will find
this

"DeviceName"="DSK1:"

Without that block driver the mass storage doesn't work correctly.

regards,

Mike
--
Digi International Inc.
http://www.digi.com

Re: usb function mass storage class - RAMDISK folder goes away after usb attach by Valter

Valter
Fri Mar 14 06:10:33 PDT 2008

vsanchez@vocollect.com wrote in
news:b3342e92-1220-4518-9b63-3b0dd9118a42@n58g2000hsf.googlegroups.co
m:

> Hello!
>
> I am trying to use the usb function driver with the mass storage
> class and am losing my RAMDISK folder on my device once I attach
> the USB cable and the UsbMsFn STORE_Init function is called.
[...]


The USB mass-storage protols works at blocks/sectors level and the PC
(or USB-host eqipped device) will handle the filesystem.
This will make sharing access to the media from both the PC and the
local OS impossbile or, at least, very complex, because they may work
on the same blocks or the same files, resulting in data losses or
worse.
That's why the mass-storage function driver needs a "physical device"
to be used (you can't use the driver to access the object store, for
example) and dismounts it as soon as it is going to be accessed by the
PC.

--
Valter Minute
www.fortechembeddedlabs.it
Training, support and development for Windows CE
(the reply address of this message is invalid)