forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Correct usage of usbmass to avoid MS corruption

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
ahman



Joined: 31 May 2006
Posts: 22

PostPosted: Wed Sep 12, 2007 3:56 pm    Post subject: Correct usage of usbmass to avoid MS corruption Reply with quote

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:

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.
Back to top
View user's profile Send private message
Hellcat



Joined: 24 Jan 2007
Posts: 84

PostPosted: Wed Sep 12, 2007 8:36 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
e_boris



Joined: 19 May 2007
Posts: 25

PostPosted: Wed Sep 12, 2007 10:37 pm    Post subject: Reply with quote

Thanks for the tip. How do you get the device names? is there any name lists? I mean for the “fatms0:”
Back to top
View user's profile Send private message MSN Messenger
ahman



Joined: 31 May 2006
Posts: 22

PostPosted: Thu Sep 13, 2007 1:57 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
weltall



Joined: 20 Feb 2004
Posts: 310

PostPosted: Fri Sep 14, 2007 3:40 pm    Post subject: Reply with quote

thanks for the tip ahman :)
Back to top
View user's profile Send private message Visit poster's website
kururin



Joined: 05 Jul 2006
Posts: 36

PostPosted: Fri Sep 14, 2007 8:31 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sun Jun 22, 2008 8:28 pm    Post subject: Reply with quote

Does anyone have more information about devctl commands for the flash. Such as free space, etc?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group