Correct usage of usbmass to avoid MS corruption

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ahman
Posts: 22
Joined: Wed May 31, 2006 10:57 am

Correct usage of usbmass to avoid MS corruption

Post by ahman »

I noticed that some homebrews enable the use of usb mass storage, but incorrect usage will result in memory stick corruption.

Once a particular homebrew turned on usbmass and allow the user to use a PC to copy some files to the MS. Upon completion, the homebrew turned off usbmass. At this moment, the memory stick driver cache (consists of FAT table, etc) on the PSP is out of date and if the homebrew modify files on the MS, the memory stick will be corrupted. To avoid corruption, you'll need to invalidate the MS driver cache after unmounting usbmass, like this.

Code: Select all

sceIoDevctl("fatms0:", 0x0240D81E, NULL, 0, NULL, 0 );
The above call to sceIoDevCtl will invalidate the cache and that's also what XMB did when the usbmass is unmounted. This will also result in all open file describtors to be closed.
Hellcat
Posts: 83
Joined: Wed Jan 24, 2007 2:52 pm

Post by Hellcat »

Wow, good info!
I will put that into the program I am currently writing....

sceIoDevctl("flashfat0:", 0x0240D81E, NULL, 0, NULL, 0 );
would do the same for flash0:/, am I right?
e_boris
Posts: 25
Joined: Sat May 19, 2007 2:45 pm

Post by e_boris »

Thanks for the tip. How do you get the device names? is there any name lists? I mean for the “fatms0:”
ahman
Posts: 22
Joined: Wed May 31, 2006 10:57 am

Post by ahman »

Hellcat wrote:Wow, good info!
I will put that into the program I am currently writing....

sceIoDevctl("flashfat0:", 0x0240D81E, NULL, 0, NULL, 0 );
would do the same for flash0:/, am I right?
I doubt this command code will work on the flash. However, I haven't tried it myself.
e_boris wrote:Thanks for the tip. How do you get the device names? is there any name lists? I mean for the “fatms0:”
Actually, the "fatms0:" is a well known device name for the memory stick. If you try to disassemble some of the firmware PRXes, you'll find many different device names. I believe someone has also posted a device name list in this forum. You may wanna search for it.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

thanks for the tip ahman :)
kururin
Posts: 36
Joined: Wed Jul 05, 2006 7:19 am

Post by kururin »

Hellcat wrote:Wow, good info!
I will put that into the program I am currently writing....

sceIoDevctl("flashfat0:", 0x0240D81E, NULL, 0, NULL, 0 );
would do the same for flash0:/, am I right?
the devctl codes are specific for each device. The one to flush flashfats is 0x00005802.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Does anyone have more information about devctl commands for the flash. Such as free space, etc?
Post Reply